Re: [PATCH v2 tip/core/rcu 0/13] Miscellaneous fixes for 4.12

From: Josh Triplett
Date: Wed Apr 19 2017 - 10:59:12 EST


On Wed, Apr 19, 2017 at 07:47:30AM -0700, Paul E. McKenney wrote:
> On Wed, Apr 19, 2017 at 02:08:47PM +0200, Peter Zijlstra wrote:
> > On Wed, Apr 19, 2017 at 01:48:08PM +0200, Christian Borntraeger wrote:
> > > On 04/19/2017 01:28 PM, Peter Zijlstra wrote:
> > > >
> > > > So the thing Maz complained about is because KVM assumes
> > > > synchronize_srcu() is 'free' when there is no srcu_read_lock() activity.
> > > > This series 'breaks' that.
> > >
> > > Why is such a behaviour change not mentioned in the cover letter?
> > > I could not find anything in the patch descriptions that would
> > > indicate a slowdown. How much slower did it get?
> > >
> > > But indeed, there are several places at KVM startup which have been
> > > reworked to srcu since normal rcu was too slow for several usecases.
> > > (Mostly registering devices and related data structures at startup,
> > > basically the qemu/kvm coldplug interaction)
> >
> > I suspect Paul is not considering this a 'normal' RCU feature, and
> > therefore didn't think about changing this.
> >
> > I know I was fairly surprised by this requirement when I ran into it;
> > and only accidentally remembered it now that maz complained.
>
> Indeed -- the natural thing to have done back when KVM's scalability was
> first being worked on would have been to simply change synchronize_rcu()
> to synchronize_rcu_expedited(). However, at that time, these things
> did try_stop_cpus() and the like, which was really bad for latency.
> Moving to SRCU avoided this problem. Of course, now that KVM uses
> SRCU, why change unless there is a problem? Besides, I vaguely recall
> some KVM cases where srcu_read_lock() is used from CPUs that look to
> be idle or offline from RCU's perspective, and that sort of thing only
> works for SRCU.
>
> Which reminds me...
>
> The RCU expedited primitives have been completely rewritten since then,
> and no longer use try_stop_cpus(), no longer disturb idle CPUs, and no
> longer disturb nohz_full CPUs running in userspace. In addition, there
> is the rcupdate.rcu_normal kernel boot paramter for those who want to
> completely avoid RCU expedited primitives.
>
> So it seems to me to be time for the patch below. Thoughts?
>
> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit 333d383fad42b4bdef3d27d91e940a6eafed3f91
> Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> Date: Wed Apr 19 07:37:45 2017 -0700
>
> checkpatch: Remove checks for expedited grace periods
>
> There was a time when the expedited grace-period primitives
> (synchronize_rcu_expedited(), synchronize_rcu_bh_expedited(), and
> synchronize_sched_expedited()) used rather antisocial kernel
> facilities like try_stop_cpus(). However, they have since been
> housebroken to use only single-CPU IPIs, and typically cause less
> disturbance than a scheduling-clock interrupt. Furthermore, this
> disturbance can be eliminated entirely using NO_HZ_FULL on the
> one hand or the rcupdate.rcu_normal boot parameter on the other.
>
> This commit therefore removes checkpatch's complaints about use
> of the expedited RCU primitives.
>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

Reviewed-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>

Still something to hesitate a bit before using, but not something
checkpatch should warn about.