Commit 7cc78f8fa02c2485104b86434acbc1538a3bd807
Committed by
Linus Torvalds
1 parent
ebcd241a63
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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 <davej@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff
kernel/sched/core.c
... | ... | @@ -2874,10 +2874,14 @@ |
2874 | 2874 | * or we have been woken up remotely but the IPI has not yet arrived, |
2875 | 2875 | * we haven't yet exited the RCU idle mode. Do it here manually until |
2876 | 2876 | * we find a better solution. |
2877 | + * | |
2878 | + * NB: There are buggy callers of this function. Ideally we | |
2879 | + * should warn if prev_state != IN_USER, but that will trigger | |
2880 | + * too frequently to make sense yet. | |
2877 | 2881 | */ |
2878 | - user_exit(); | |
2882 | + enum ctx_state prev_state = exception_enter(); | |
2879 | 2883 | schedule(); |
2880 | - user_enter(); | |
2884 | + exception_exit(prev_state); | |
2881 | 2885 | } |
2882 | 2886 | #endif |
2883 | 2887 |
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc
-
mentioned in commit bb2dfc