summaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/common.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-02-25 23:08:05 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-06-11 15:14:39 +0200
commitdd8e2d9ae64fa4348530df3e45e9f874d807a1c2 (patch)
treed8a1385c19507d2ddfb26155e1eebd7c540a54b6 /arch/x86/entry/common.c
parent8f159f1dfa1ea29d70a84335fe6a8bd501a9eecd (diff)
downloadlinux-dd8e2d9ae64fa4348530df3e45e9f874d807a1c2.tar.gz
linux-dd8e2d9ae64fa4348530df3e45e9f874d807a1c2.tar.bz2
linux-dd8e2d9ae64fa4348530df3e45e9f874d807a1c2.zip
x86/entry: Move irq tracing on syscall entry to C-code
Now that the C entry points are safe, move the irq flags tracing code into the entry helper: - Invoke lockdep before calling into context tracking - Use the safe trace_hardirqs_on_prepare() trace function after context tracking established state and RCU is watching. enter_from_user_mode() is also still invoked from the exception/interrupt entry code which still contains the ASM irq flags tracing. So this is just a redundant and harmless invocation of tracing / lockdep until these are removed as well. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Link: https://lkml.kernel.org/r/20200505134340.611961721@linutronix.de
Diffstat (limited to 'arch/x86/entry/common.c')
-rw-r--r--arch/x86/entry/common.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 9892fb7c9d44..7473c1297a84 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -40,19 +40,36 @@
#include <trace/events/syscalls.h>
#ifdef CONFIG_CONTEXT_TRACKING
-/* Called on entry from user mode with IRQs off. */
+/**
+ * enter_from_user_mode - Establish state when coming from user mode
+ *
+ * Syscall 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
+ */
__visible noinstr void enter_from_user_mode(void)
{
enum ctx_state state = ct_state();
+ lockdep_hardirqs_off(CALLER_ADDR0);
user_exit_irqoff();
instrumentation_begin();
CT_WARN_ON(state != CONTEXT_USER);
+ trace_hardirqs_off_prepare();
instrumentation_end();
}
#else
-static inline void enter_from_user_mode(void) {}
+static __always_inline void enter_from_user_mode(void)
+{
+ lockdep_hardirqs_off(CALLER_ADDR0);
+ instrumentation_begin();
+ trace_hardirqs_off_prepare();
+ instrumentation_end();
+}
#endif
static noinstr void exit_to_user_mode(void)