|author||Andy Lutomirski <firstname.lastname@example.org>||2014-12-03 15:37:08 -0800|
|committer||Linus Torvalds <email@example.com>||2014-12-03 20:55:58 -0800|
context_tracking: Restore previous state in schedule_user
It appears that some SCHEDULE_USER (asm for schedule_user) callers in arch/x86/kernel/entry_64.S are called from RCU kernel context, and schedule_user will return in RCU user context. This causes RCU warnings and possible failures. This is intended to be a minimal fix suitable for 3.18. Reported-and-tested-by: Dave Jones <firstname.lastname@example.org> Cc: Oleg Nesterov <email@example.com> Cc: Frédéric Weisbecker <firstname.lastname@example.org> Acked-by: Paul E. McKenney <email@example.com> Signed-off-by: Andy Lutomirski <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 24beb9bb4c3e..89e7283015a6 100644
@@ -2874,10 +2874,14 @@ asmlinkage __visible void __sched schedule_user(void)
* or we have been woken up remotely but the IPI has not yet arrived,
* we haven't yet exited the RCU idle mode. Do it here manually until
* we find a better solution.
+ * NB: There are buggy callers of this function. Ideally we
+ * should warn if prev_state != IN_USER, but that will trigger
+ * too frequently to make sense yet.
+ enum ctx_state prev_state = exception_enter();