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: <20180708010511.GB18424@guoren-Inspiron-7460>
Date:   Sun, 8 Jul 2018 09:05:11 +0800
From:   Guo Ren <ren_guo@...ky.com>
To:     Andrea Parri <andrea.parri@...rulasolutions.com>
Cc:     Peter Zijlstra <peterz@...radead.org>, linux-arch@...r.kernel.org,
        linux-kernel@...r.kernel.org, tglx@...utronix.de,
        daniel.lezcano@...aro.org, jason@...edaemon.net, arnd@...db.de,
        c-sky_gcc_upstream@...ky.com, gnu-csky@...tor.com,
        thomas.petazzoni@...tlin.com, wbx@...ibc-ng.org,
        green.hu@...il.com, Will Deacon <will.deacon@....com>
Subject: Re: [PATCH V2 11/19] csky: Atomic operations

On Sat, Jul 07, 2018 at 10:10:24PM +0200, Andrea Parri wrote:
> On Sat, Jul 07, 2018 at 04:08:47PM +0800, Guo Ren wrote:
> > On Fri, Jul 06, 2018 at 02:17:16PM +0200, Peter Zijlstra wrote:
> 
> > 	CPU0			CPU1
> > 
> > 	WRITE_ONCE(x, 1)	WRITE_ONCE(y, 1)
> > 	r0 = xchg(&y, 2)	r1 = xchg(&x, 2)
> > 
> > must not allow: r0==0 && r1==0
> > So we must add a smp_mb between WRITE_ONCE() and xchg(), right?
> 
> The state (r0==0 && r1==0) _must_ not be allowed in the above snippet (so,
> even without the additional smp_mb() between WRITE_ONCE() and xchg()).  In
> informal terms, xchg() provides the smp_mb().
Got it, thx.

> Compare implementations of xchg() and xchg_relaxed().  The following could
> also be helpful (in addition to the references pointed out earlier):
> 
>   Documentation/atomic_t.txt
Thx for the tip.

 Guo Ren

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ