diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-09-05 18:13:53 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-09-08 17:13:59 -0400 |
commit | fd143b210e685f0c4b37895f03fb79cd0555b00d (patch) | |
tree | 6e05e277c6a9f6cffde189ef7375996813a4f231 /arch/x86/kernel/ptrace.c | |
parent | 81f49a8fd7088cfcb588d182eeede862c0e3303e (diff) |
x86, entry: Only call user_exit if TIF_NOHZ
The RCU context tracking code requires that arch code call
user_exit() on any entry into kernel code if TIF_NOHZ is set. This
patch adds a check for TIF_NOHZ and a comment to the syscall entry
tracing code.
The main purpose of this patch is to make the code easier to follow:
one can read the body of user_exit and of every function it calls
without finding any explanation of why it's called for traced
syscalls but not for untraced syscalls. This makes it clear when
user_exit() is necessary.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/0b13e0e24ec0307d67ab7a23b58764f6b1270116.1409954077.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 39296d25708c..bbf338a04a5d 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1449,7 +1449,12 @@ long syscall_trace_enter(struct pt_regs *regs) | |||
1449 | { | 1449 | { |
1450 | long ret = 0; | 1450 | long ret = 0; |
1451 | 1451 | ||
1452 | user_exit(); | 1452 | /* |
1453 | * If TIF_NOHZ is set, we are required to call user_exit() before | ||
1454 | * doing anything that could touch RCU. | ||
1455 | */ | ||
1456 | if (test_thread_flag(TIF_NOHZ)) | ||
1457 | user_exit(); | ||
1453 | 1458 | ||
1454 | /* | 1459 | /* |
1455 | * If we stepped into a sysenter/syscall insn, it trapped in | 1460 | * If we stepped into a sysenter/syscall insn, it trapped in |