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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Jul 2021 14:30:58 +0200
From:   Frederic Weisbecker <frederic@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     "Paul E . McKenney" <paulmck@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Uladzislau Rezki <urezki@...il.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Ingo Molnar <mingo@...nel.org>,
        Neeraj Upadhyay <neeraju@...eaurora.org>,
        Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH 2/2] rcu: Remove needless preemption disablement in
 rcu_all_qs()

On Tue, Jul 06, 2021 at 09:51:01AM +0200, Peter Zijlstra wrote:
> On Tue, Jul 06, 2021 at 01:43:44AM +0200, Frederic Weisbecker wrote:
> > The preemption is already disabled when we write rcu_data.rcu_urgent_qs.
> > We can use __this_cpu_write() directly, although that path is mostly
> > used when CONFIG_PREEMPT=n.
> > 
> > Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> > Cc: Neeraj Upadhyay <neeraju@...eaurora.org>
> > Cc: Joel Fernandes <joel@...lfernandes.org>
> > Cc: Uladzislau Rezki <urezki@...il.com>
> > Cc: Boqun Feng <boqun.feng@...il.com>
> > ---
> >  kernel/rcu/tree_plugin.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> > index 27b74352cccf..38b3d01424d7 100644
> > --- a/kernel/rcu/tree_plugin.h
> > +++ b/kernel/rcu/tree_plugin.h
> > @@ -871,7 +871,7 @@ void rcu_all_qs(void)
> >  		preempt_enable();
> >  		return;
> >  	}
> > -	this_cpu_write(rcu_data.rcu_urgent_qs, false);
> > +	__this_cpu_write(rcu_data.rcu_urgent_qs, false);
> 
> There's another subtle difference between this_cpu_write() and
> __this_cpu_write() aside from preempt. this_cpu_write() is also
> IRQ-safe, while __this_cpu_write() is not.
> 
> I've not looked at the usage here to see if that is relevant, but the
> Changelog only mentioned the preempt side of things, and that argument
> is incomplete in general.

You're right, I missed that. I see this rcu_urgent_qs is set by
RCU TASKS from rcu_tasks_wait_gp() (did I missed another path?).
Not sure if this is called from IRQ nor if it actually matters to
protect against IRQs for that single write.

I'm not quite used to rcu_tasks. Paul?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ