]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
srcu: Provide ordering for CPU not involved in grace period
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 5 Jul 2017 20:30:21 +0000 (13:30 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 28 Sep 2017 14:30:57 +0000 (10:30 -0400)
commit02f39f4081e4a0429bdd38056b696c4ad276a973
treec478d99fdbcc511a392067e33da42c4ea4287109
parentd890442b70cfc513666ac6bf1be6cd1f927bd27b
srcu: Provide ordering for CPU not involved in grace period

BugLink: http://bugs.launchpad.net/bugs/1720154
commit 35732cf9dd38b1efb0f2f22c91c61b51337d1ac3 upstream.

Tree RCU guarantees that every online CPU has a memory barrier between
any given grace period and any of that CPU's RCU read-side sections that
must be ordered against that grace period.  Since RCU doesn't always
know where read-side critical sections are, the actual implementation
guarantees order against prior and subsequent non-idle non-offline code,
whether in an RCU read-side critical section or not.  As a result, there
does not need to be a memory barrier at the end of synchronize_rcu()
and friends because the ordering internal to the grace period has
ordered every CPU's post-grace-period execution against each CPU's
pre-grace-period execution, again for all non-idle online CPUs.

In contrast, SRCU can have non-idle online CPUs that are completely
uninvolved in a given SRCU grace period, for example, a CPU that
never runs any SRCU read-side critical sections and took no part in
the grace-period processing.  It is in theory possible for a given
synchronize_srcu()'s wakeup to be delivered to a CPU that was completely
uninvolved in the prior SRCU grace period, which could mean that the
code following that synchronize_srcu() would end up being unordered with
respect to both the grace period and any pre-existing SRCU read-side
critical sections.

This commit therefore adds an smp_mb() to the end of __synchronize_srcu(),
which prevents this scenario from occurring.

Reported-by: Lance Roy <ldr709@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Lance Roy <ldr709@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/rcu/srcutree.c