linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Sven Schnelle" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sven Schnelle <svens@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: core/entry] entry_Add_enter_from_user_mode_wrapper
Date: Wed, 02 Dec 2020 14:12:01 -0000	[thread overview]
Message-ID: <160691832190.3364.4719149142476327785.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20201201142755.31931-4-svens@linux.ibm.com>

The following commit has been merged into the core/entry branch of tip:

Commit-ID:     96e2fbccd0fc806364a964fdf072bfc858a66109
Gitweb:        https://git.kernel.org/tip/96e2fbccd0fc806364a964fdf072bfc858a66109
Author:        Sven Schnelle <svens@linux.ibm.com>
AuthorDate:    Tue, 01 Dec 2020 15:27:53 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Dec 2020 15:07:57 +01:00

entry_Add_enter_from_user_mode_wrapper

To be called from architecture specific code if the combo interfaces are
not suitable. It simply calls __enter_from_user_mode(). This way
__enter_from_user_mode will still be inlined because it is declared static
__always_inline.

[ tglx: Amend comments and move it to a different location in the header ]

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201201142755.31931-4-svens@linux.ibm.com

---
 include/linux/entry-common.h | 24 +++++++++++++++++++++++-
 kernel/entry/common.c        | 16 ++++++----------
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index a6e98b4..da60980 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -102,6 +102,27 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
 #endif
 
 /**
+ * enter_from_user_mode - Establish state when coming from user mode
+ *
+ * Syscall/interrupt entry disables interrupts, but user mode is traced as
+ * interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
+ *
+ * 1) Tell lockdep that interrupts are disabled
+ * 2) Invoke context tracking if enabled to reactivate RCU
+ * 3) Trace interrupts off state
+ *
+ * Invoked from architecture specific syscall entry code with interrupts
+ * disabled. The calling code has to be non-instrumentable. When the
+ * function returns all state is correct and interrupts are still
+ * disabled. The subsequent functions can be instrumented.
+ *
+ * This is invoked when there is architecture specific functionality to be
+ * done between establishing state and enabling interrupts. The caller must
+ * enable interrupts before invoking syscall_enter_from_user_mode_work().
+ */
+void enter_from_user_mode(struct pt_regs *regs);
+
+/**
  * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts
  * @regs:	Pointer to currents pt_regs
  *
@@ -110,7 +131,8 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
  * function returns all state is correct, interrupts are enabled and the
  * subsequent functions can be instrumented.
  *
- * This handles lockdep, RCU (context tracking) and tracing state.
+ * This handles lockdep, RCU (context tracking) and tracing state, i.e.
+ * the functionality provided by enter_from_user_mode().
  *
  * This is invoked when there is extra architecture specific functionality
  * to be done between establishing state and handling user mode entry work.
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index dff07b4..17b1e03 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -10,16 +10,7 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/syscalls.h>
 
-/**
- * __enter_from_user_mode - Establish state when coming from user mode
- *
- * Syscall/interrupt entry disables interrupts, but user mode is traced as
- * interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
- *
- * 1) Tell lockdep that interrupts are disabled
- * 2) Invoke context tracking if enabled to reactivate RCU
- * 3) Trace interrupts off state
- */
+/* See comment for enter_from_user_mode() in entry-common.h */
 static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
 {
 	arch_check_user_regs(regs);
@@ -33,6 +24,11 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
 	instrumentation_end();
 }
 
+void noinstr enter_from_user_mode(struct pt_regs *regs)
+{
+	__enter_from_user_mode(regs);
+}
+
 static inline void syscall_enter_audit(struct pt_regs *regs, long syscall)
 {
 	if (unlikely(audit_context())) {

  parent reply	other threads:[~2020-12-02 14:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 14:27 [PATCH v2] split up lockdep and syscall related functionality in generic entry code Sven Schnelle
2020-12-01 14:27 ` [PATCH v2 1/5] entry: rename enter_from_user_mode() Sven Schnelle
2020-12-02  9:38   ` [tip: core/entry] entry: Rename enter_from_user_mode() tip-bot2 for Sven Schnelle
2020-12-02 14:12   ` tip-bot2 for Sven Schnelle
2020-12-01 14:27 ` [PATCH v2 2/5] entry: rename exit_from_user_mode() Sven Schnelle
2020-12-01 14:41   ` Sven Schnelle
2020-12-02  9:38   ` [tip: core/entry] entry: Rename exit_to_user_mode() tip-bot2 for Sven Schnelle
2020-12-02 14:12   ` tip-bot2 for Sven Schnelle
2020-12-01 14:27 ` [PATCH v2 3/5] entry: add enter_from_user_mode() wrapper Sven Schnelle
2020-12-02  9:38   ` [tip: core/entry] entry_Add_enter_from_user_mode_wrapper tip-bot2 for Sven Schnelle
2020-12-02 14:12   ` tip-bot2 for Sven Schnelle [this message]
2020-12-01 14:27 ` [PATCH v2 4/5] entry: add exit_to_user_mode() wrapper Sven Schnelle
2020-12-02  9:38   ` [tip: core/entry] entry: Add " tip-bot2 for Sven Schnelle
2020-12-02 14:12   ` tip-bot2 for Sven Schnelle
2020-12-01 14:27 ` [PATCH v2 5/5] entry: add syscall_exit_to_user_mode_work() Sven Schnelle
2020-12-02  9:38   ` [tip: core/entry] entry: Add syscall_exit_to_user_mode_work() tip-bot2 for Sven Schnelle
2020-12-02 14:12   ` tip-bot2 for Sven Schnelle
2020-12-01 23:17 ` [PATCH v2] split up lockdep and syscall related functionality in generic entry code Thomas Gleixner
2020-12-02  0:33 ` Thomas Gleixner

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=160691832190.3364.4719149142476327785.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).