]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
rcu: Fix rcu_barrier() race that could result in too-short wait
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Thu, 18 Dec 2014 20:31:27 +0000 (12:31 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 6 Jan 2015 19:01:15 +0000 (11:01 -0800)
commit41050a009640f9f330a5b916563ca7faf853a98c
treee3788995b7ae651215a39ac1e98fb2b1a81aa53c
parent87af9e7ff9d909e70a006ca0974466e2a1d8db0a
rcu: Fix rcu_barrier() race that could result in too-short wait

The rcu_barrier() no-callbacks check for no-CBs CPUs has race conditions.
It checks a given CPU's lists of callbacks, and if all three no-CBs lists
are empty, ignores that CPU.  However, these three lists could potentially
be empty even when callbacks are present if the check executed just as
the callbacks were being moved from one list to another.  It turns out
that recent versions of rcutorture can spot this race.

This commit plugs this hole by consolidating the per-list counts of
no-CBs callbacks into a single count, which is incremented before
the corresponding callback is posted and after it is invoked.  Then
rcu_barrier() checks this single count to reliably determine whether
the corresponding CPU has no-CBs callbacks.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/tree.c
kernel/rcu/tree.h
kernel/rcu/tree_plugin.h