summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2022-04-13 20:41:12 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2022-05-01 19:51:21 -0700
commit55427d5b0dff5754f3579dde93955aac483e8d6a (patch)
tree6acc44817c296f6a1f1c25894fb843880d749705
parent961c5efbc493ef497fe68ec07a4ed081acba4c92 (diff)
downloadlwn-55427d5b0dff5754f3579dde93955aac483e8d6a.tar.gz
lwn-55427d5b0dff5754f3579dde93955aac483e8d6a.zip
xtensa: enable context tracking
Put user exit context tracking call on the common kernel entry/exit path (function calls are impossible at earlier kernel entry stages because PS.EXCM is not cleared yet). Put user entry context tracking call on the user exit path. Syscalls go through this common code too, so nothing specific needs to be done for them. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r--Documentation/features/time/context-tracking/arch-support.txt2
-rw-r--r--arch/xtensa/Kconfig1
-rw-r--r--arch/xtensa/kernel/entry.S9
3 files changed, 11 insertions, 1 deletions
diff --git a/Documentation/features/time/context-tracking/arch-support.txt b/Documentation/features/time/context-tracking/arch-support.txt
index bb1c1801553e..72e7aadeda7e 100644
--- a/Documentation/features/time/context-tracking/arch-support.txt
+++ b/Documentation/features/time/context-tracking/arch-support.txt
@@ -27,5 +27,5 @@
| sparc: | ok |
| um: | TODO |
| x86: | ok |
- | xtensa: | TODO |
+ | xtensa: | ok |
-----------------------
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index bca2763495a1..553144ae1d4d 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -31,6 +31,7 @@ config XTENSA
select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
+ select HAVE_CONTEXT_TRACKING
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_CONTIGUOUS
select HAVE_EXIT_THREAD
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index d09f2c38ba84..f2c789a5a92a 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -457,6 +457,12 @@ KABI_W or a3, a3, a2
abi_call trace_hardirqs_off
1:
#endif
+#ifdef CONFIG_CONTEXT_TRACKING
+ l32i abi_tmp0, a1, PT_PS
+ bbci.l abi_tmp0, PS_UM_BIT, 1f
+ abi_call context_tracking_user_exit
+1:
+#endif
/* Go to second-level dispatcher. Set up parameters to pass to the
* exception handler and call the exception handler.
@@ -540,6 +546,9 @@ common_exception_return:
j .Lrestore_state
.Lexit_tif_loop_user:
+#ifdef CONFIG_CONTEXT_TRACKING
+ abi_call context_tracking_user_enter
+#endif
#ifdef CONFIG_HAVE_HW_BREAKPOINT
_bbci.l abi_saved0, TIF_DB_DISABLED, 1f
abi_call restore_dbreak