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] [day] [month] [year] [list]
Date:   Mon, 21 Mar 2022 13:32:27 +0000
From:   Will Deacon <will@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Frederic Weisbecker <frederic@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Phil Auld <pauld@...hat.com>,
        Alex Belits <abelits@...vell.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Xiongfeng Wang <wangxiongfeng2@...wei.com>,
        Neeraj Upadhyay <quic_neeraju@...cinc.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yu Liao <liaoyu15@...wei.com>,
        Boqun Feng <boqun.feng@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Paul Gortmaker <paul.gortmaker@...driver.com>,
        Uladzislau Rezki <uladzislau.rezki@...y.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH 16/19] context_tracking: Convert state to atomic_t

On Sat, Mar 12, 2022 at 11:54:09PM +0100, Peter Zijlstra wrote:
> On Wed, Mar 02, 2022 at 04:48:07PM +0100, Frederic Weisbecker wrote:
> > +static __always_inline int __ct_state(void)
> > +{
> > +	return atomic_read(this_cpu_ptr(&context_tracking.state));
> > +}
> 
> One arguably horrible thing to do would be to write it like:
> 
> 	return __this_cpu_read(context_tracking.state.counter);
> 
> IIRC that will actually DTRT since atomic_read() is basically defined to
> be READ_ONCE() and this_cpu_read() implies the same.
> 
> Only PowerPC and s390 implement arch_atomic_read() in asm, but I don't
> think they have a particularly good reason to. The only other weird case
> is Alpha, where READ_ONCE() implies smp_mb() because Alpha. I'm not sure
> we care about that case, hmm?

If we don't care about the dependency ordering, then __READ_ONCE() is the
chappy to use if the types don't get in the way too much.

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ