Skip to content

Commit 96e2fbc

Browse files
svens-s390KAGA-KOKO
authored andcommitted
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
1 parent bb79356 commit 96e2fbc

2 files changed

Lines changed: 29 additions & 11 deletions

File tree

‎include/linux/entry-common.h‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,27 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
101101
}
102102
#endif
103103

104+
/**
105+
* enter_from_user_mode - Establish state when coming from user mode
106+
*
107+
* Syscall/interrupt entry disables interrupts, but user mode is traced as
108+
* interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
109+
*
110+
* 1) Tell lockdep that interrupts are disabled
111+
* 2) Invoke context tracking if enabled to reactivate RCU
112+
* 3) Trace interrupts off state
113+
*
114+
* Invoked from architecture specific syscall entry code with interrupts
115+
* disabled. The calling code has to be non-instrumentable. When the
116+
* function returns all state is correct and interrupts are still
117+
* disabled. The subsequent functions can be instrumented.
118+
*
119+
* This is invoked when there is architecture specific functionality to be
120+
* done between establishing state and enabling interrupts. The caller must
121+
* enable interrupts before invoking syscall_enter_from_user_mode_work().
122+
*/
123+
void enter_from_user_mode(struct pt_regs *regs);
124+
104125
/**
105126
* syscall_enter_from_user_mode_prepare - Establish state and enable interrupts
106127
* @regs: Pointer to currents pt_regs
@@ -110,7 +131,8 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
110131
* function returns all state is correct, interrupts are enabled and the
111132
* subsequent functions can be instrumented.
112133
*
113-
* This handles lockdep, RCU (context tracking) and tracing state.
134+
* This handles lockdep, RCU (context tracking) and tracing state, i.e.
135+
* the functionality provided by enter_from_user_mode().
114136
*
115137
* This is invoked when there is extra architecture specific functionality
116138
* to be done between establishing state and handling user mode entry work.

‎kernel/entry/common.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,7 @@
1010
#define CREATE_TRACE_POINTS
1111
#include <trace/events/syscalls.h>
1212

13-
/**
14-
* __enter_from_user_mode - Establish state when coming from user mode
15-
*
16-
* Syscall/interrupt entry disables interrupts, but user mode is traced as
17-
* interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
18-
*
19-
* 1) Tell lockdep that interrupts are disabled
20-
* 2) Invoke context tracking if enabled to reactivate RCU
21-
* 3) Trace interrupts off state
22-
*/
13+
/* See comment for enter_from_user_mode() in entry-common.h */
2314
static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
2415
{
2516
arch_check_user_regs(regs);
@@ -33,6 +24,11 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
3324
instrumentation_end();
3425
}
3526

27+
void noinstr enter_from_user_mode(struct pt_regs *regs)
28+
{
29+
__enter_from_user_mode(regs);
30+
}
31+
3632
static inline void syscall_enter_audit(struct pt_regs *regs, long syscall)
3733
{
3834
if (unlikely(audit_context())) {

0 commit comments

Comments
 (0)