From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-xtensa@linux-xtensa.org
Cc: Chris Zankel <chris@zankel.net>,
linux-kernel@vger.kernel.org, Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH 4/5] xtensa: enable context tracking
Date: Mon, 18 Apr 2022 10:12:04 -0700 [thread overview]
Message-ID: <20220418171205.2413168-5-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20220418171205.2413168-1-jcmvbkbc@gmail.com>
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>
---
.../features/time/context-tracking/arch-support.txt | 2 +-
arch/xtensa/Kconfig | 1 +
arch/xtensa/kernel/entry.S | 9 +++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
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 e3ffd4564009..6134808a633d 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
@@ -456,6 +456,12 @@ KABI_W or a3, a3, a2
beqz abi_tmp0, 1f
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
@@ -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
--
2.30.2
next prev parent reply other threads:[~2022-04-18 17:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 17:12 [PATCH 0/5] xtensa: enable context tracking and VIRT_CPU_ACCOUNTING_GEN Max Filippov
2022-04-18 17:12 ` [PATCH 1/5] xtensa: drop dead code from entry.S Max Filippov
2022-04-18 17:12 ` [PATCH 2/5] xtensa: move trace_hardirqs_off call back to entry.S Max Filippov
2022-04-18 17:12 ` [PATCH 3/5] xtensa: use abi_* register names in the kernel exit code Max Filippov
2022-04-18 17:12 ` Max Filippov [this message]
2022-04-18 17:12 ` [PATCH 5/5] xtensa: enable HAVE_VIRT_CPU_ACCOUNTING_GEN Max Filippov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220418171205.2413168-5-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=chris@zankel.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®