mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
rcu: Warn on allegedly impossible rcu_read_unlock_special() from irq
After commit #10f39bb1b2 (rcu: protect __rcu_read_unlock() against
scheduler-using irq handlers), it is no longer possible to enter
the main body of rcu_read_lock_special() from an NMI, interrupt, or
softirq handler. In theory, this implies that the check for "in_irq()
|| in_serving_softirq()" must always fail, so that in theory this check
could be removed entirely.
In practice, this commit wraps this condition with a WARN_ON_ONCE().
If this warning never triggers, then the condition will be removed
entirely.
[ paulmck: And one way of triggering the WARN_ON() is if a scheduling
clock interrupt occurs in an RCU read-side critical section, setting
RCU_READ_UNLOCK_NEED_QS, which is handled by rcu_read_unlock_special().
Updated this commit to return if only that bit was set. ]
Signed-off-by: Lai Jiangshan <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
This commit is contained in:
parent
24ef659a85
commit
79a62f957e
1 changed files with 6 additions and 2 deletions
|
|
@ -361,10 +361,14 @@ void rcu_read_unlock_special(struct task_struct *t)
|
|||
special = t->rcu_read_unlock_special;
|
||||
if (special & RCU_READ_UNLOCK_NEED_QS) {
|
||||
rcu_preempt_qs(smp_processor_id());
|
||||
if (!t->rcu_read_unlock_special) {
|
||||
local_irq_restore(flags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hardware IRQ handlers cannot block. */
|
||||
if (in_irq() || in_serving_softirq()) {
|
||||
/* Hardware IRQ handlers cannot block, complain if they get here. */
|
||||
if (WARN_ON_ONCE(in_irq() || in_serving_softirq())) {
|
||||
local_irq_restore(flags);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue