linux-stable/kernel/rcu
Paul E. McKenney e11ec65cc8 rcu: Add warning to detect half-interrupts
RCU's dyntick-idle code is written to tolerate half-interrupts, that it,
either an interrupt that invokes rcu_irq_enter() but never invokes the
corresponding rcu_irq_exit() on the one hand, or an interrupt that never
invokes rcu_irq_enter() but does invoke the "corresponding" rcu_irq_exit()
on the other.  These things really did happen at one time, as evidenced
by this ca-2011 LKML post:

http://lkml.kernel.org/r/20111014170019.GE2428@linux.vnet.ibm.com

The reason why RCU tolerates half-interrupts is that usermode helpers
used exceptions to invoke a system call from within the kernel such that
the system call did a normal return (not a return from exception) to
the calling context.  This caused rcu_irq_enter() to be invoked without
a matching rcu_irq_exit().  However, usermode helpers have since been
rewritten to make much more housebroken use of workqueues, kernel threads,
and do_execve(), and therefore should no longer produce half-interrupts.
No one knows of any other source of half-interrupts, but then again,
no one seems insane enough to go audit the entire kernel to verify that
half-interrupts really are a relic of the past.

This commit therefore adds a pair of WARN_ON_ONCE() calls that will
trigger in the presence of half interrupts, which the code will continue
to handle correctly.  If neither of these WARN_ON_ONCE() trigger by
mid-2021, then perhaps RCU can stop handling half-interrupts, which
would be a considerable simplification.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Reported-by: Joel Fernandes <joel@joelfernandes.org>
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
2018-08-30 16:02:36 -07:00
..
Kconfig rcu: Drive TASKS_RCU directly off of PREEMPT 2017-08-17 07:26:04 -07:00
Kconfig.debug rcu: Move RCU debug Kconfig options to kernel/rcu 2017-06-08 18:52:44 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rcu.h Merge branches 'fixes1.2018.07.12b' and 'torture1.2018.07.12b' into HEAD 2018-07-12 15:42:41 -07:00
rcu_segcblist.c rcu: Simplify and inline cpu_needs_another_gp() 2018-05-15 10:30:59 -07:00
rcu_segcblist.h rcu: Simplify and inline cpu_needs_another_gp() 2018-05-15 10:30:59 -07:00
rcuperf.c Merge branches 'fixes1.2018.07.12b' and 'torture1.2018.07.12b' into HEAD 2018-07-12 15:42:41 -07:00
rcutorture.c rcutorture: Test extended "rcu" read-side critical sections 2018-08-30 16:02:35 -07:00
srcutiny.c sched/swait: Rename to exclusive 2018-06-20 11:35:56 +02:00
srcutree.c srcu: Add grace-period number to rcutorture statistics printout 2018-07-12 15:39:25 -07:00
sync.c doc: Fix various RCU docbook comment-header problems 2017-10-19 22:26:11 -04:00
tiny.c rcu: Improve rcu_note_voluntary_context_switch() reporting 2018-07-12 15:39:12 -07:00
tree.c rcu: Add warning to detect half-interrupts 2018-08-30 16:02:36 -07:00
tree.h rcu: Defer reporting RCU-preempt quiescent states when disabled 2018-08-30 16:02:34 -07:00
tree_exp.h rcu: Defer reporting RCU-preempt quiescent states when disabled 2018-08-30 16:02:34 -07:00
tree_plugin.h rcu: Remove now-unused ->b.exp_need_qs field from the rcu_special union 2018-08-30 16:02:36 -07:00
update.c rcu: Add comment to the last sleep in the rcu tasks loop 2018-07-12 15:39:21 -07:00