aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-05-11 11:13:05 -0700
committerBen Hutchings <ben@decadent.org.uk>2015-08-12 16:33:12 +0200
commitf25e101926667bf6fcc8d672122d22cdd9e36b50 (patch)
tree509ed07c4d90ce41908e61a844a95fab22872d66 /kernel
parent75d7f51f1aebcf9f2f0d6deadb75c612467a2977 (diff)
downloadkernel_samsung_smdk4412-f25e101926667bf6fcc8d672122d22cdd9e36b50.zip
kernel_samsung_smdk4412-f25e101926667bf6fcc8d672122d22cdd9e36b50.tar.gz
kernel_samsung_smdk4412-f25e101926667bf6fcc8d672122d22cdd9e36b50.tar.bz2
rcu: Correctly handle non-empty Tiny RCU callback list with none ready
commit 6e91f8cb138625be96070b778d9ba71ce520ea7e upstream. If, at the time __rcu_process_callbacks() is invoked, there are callbacks in Tiny RCU's callback list, but none of them are ready to be invoked, the current list-management code will knit the non-ready callbacks out of the list. This can result in hangs and possibly worse. This commit therefore inserts a check for there being no callbacks that can be invoked immediately. This bug is unlikely to occur -- you have to get a new callback between the time rcu_sched_qs() or rcu_bh_qs() was called, but before we get to __rcu_process_callbacks(). It was detected by the addition of RCU-bh testing to rcutorture, which in turn was instigated by Iftekhar Ahmed's mutation testing. Although this bug was made much more likely by 915e8a4fe45e (rcu: Remove fastpath from __rcu_process_callbacks()), this did not cause the bug, but rather made it much more probable. That said, it takes more than 40 hours of rcutorture testing, on average, for this bug to appear, so this fix cannot be considered an emergency. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> [bwh: Backported to 3.2: adjust filename, context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcutiny.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 636af6d..bc84596 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -160,6 +160,11 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)
/* Move the ready-to-invoke callbacks to a local list. */
local_irq_save(flags);
+ if (rcp->donetail == &rcp->rcucblist) {
+ /* No callbacks ready, so just leave. */
+ local_irq_restore(flags);
+ return;
+ }
RCU_TRACE(trace_rcu_batch_start(rcp->name, 0, -1));
list = rcp->rcucblist;
rcp->rcucblist = *rcp->donetail;