lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210917181024.GS4156@paulmck-ThinkPad-P17-Gen-1>
Date:   Fri, 17 Sep 2021 11:10:24 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>, rcu@...r.kernel.org,
        urezki@...il.com, boqun.feng@...il.com,
        Neeraj Upadhyay <neeraju@...eaurora.org>,
        joel@...lfernandes.org
Subject: Re: [PATCH 2/4] rcu: Remove useless WRITE_ONCE() on
 rcu_data.exp_deferred_qs

On Thu, Sep 16, 2021 at 11:05:14PM +0200, Frederic Weisbecker wrote:
> On Thu, Sep 16, 2021 at 09:43:40AM -0700, Paul E. McKenney wrote:
> > On Thu, Sep 16, 2021 at 02:10:46PM +0200, Frederic Weisbecker wrote:
> > > This variable is never written nor read remotely. Remove this confusion.
> > > 
> > > Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> > > ---
> > >  kernel/rcu/tree_exp.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
> > > index f3947c49eee7..4266610b4587 100644
> > > --- a/kernel/rcu/tree_exp.h
> > > +++ b/kernel/rcu/tree_exp.h
> > > @@ -255,7 +255,7 @@ static void rcu_report_exp_cpu_mult(struct rcu_node *rnp,
> > >   */
> > >  static void rcu_report_exp_rdp(struct rcu_data *rdp)
> > >  {
> > > -	WRITE_ONCE(rdp->exp_deferred_qs, false);
> > > +	rdp->exp_deferred_qs = false;
> > 
> > Are you sure that this can never be invoked from an interrupt handler?
> > And that rdp->exp_deferred_qs is never read from an interrupt handler?
> > If either can happen, then the WRITE_ONCE() does play a role, right?
> 
> Well, the only effect I can imagine is that it can partly prevent from an
> interrupt to report concurrently the quiescent state during the few
> instructions before we mask interrupts and lock the node.
> 
> That's a micro performance benefit that avoid a second call to
> rcu_report_exp_cpu_mult() with the extra locking and early exit.

I am not claiming that current compilers would mess this up, though I
have learned to have great respect for what future compilers might do...

> But then that racy interrupt can still happen before we clear exp_deferred_qs.
> In this case __this_cpu_cmpxchg() would have been more efficient.

Except that __this_cpu_cmpxchg() would have a possibility of failure,
and thus an extra branch not needed by WRITE_ONCE().  Or am I missing
your point here?

I should hasten to add that getting rid of ->exp_deferred_qs is quite
attractive!

							Thanx, Paul

> > >  	rcu_report_exp_cpu_mult(rdp->mynode, rdp->grpmask, true);
> > >  }
> > >  
> > > -- 
> > > 2.25.1
> > > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ