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]
Date:	Wed, 1 Jun 2016 14:10:45 +0800
From:	Boqun Feng <boqun.feng@...il.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	torvalds@...ux-foundation.org, mingo@...nel.org,
	tglx@...utronix.de, will.deacon@....com,
	paulmck@...ux.vnet.ibm.com, waiman.long@....com,
	fweisbec@...il.com, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, rth@...ddle.net, vgupta@...opsys.com,
	linux@....linux.org.uk, egtvedt@...fundet.no, realmz6@...il.com,
	ysato@...rs.sourceforge.jp, rkuo@...eaurora.org,
	tony.luck@...el.com, geert@...ux-m68k.org, james.hogan@...tec.com,
	ralf@...ux-mips.org, dhowells@...hat.com, jejb@...isc-linux.org,
	mpe@...erman.id.au, schwidefsky@...ibm.com, dalias@...c.org,
	davem@...emloft.net, cmetcalf@...lanox.com, jcmvbkbc@...il.com,
	arnd@...db.de, dbueso@...e.de, fengguang.wu@...el.com
Subject: Re: [PATCH -v2 19/33] locking,powerpc: Implement
 atomic{,64}_fetch_{add,sub,and,or,xor}{,_relaxed,_acquire,_release}()

On Wed, Jun 01, 2016 at 11:11:38AM +0800, Boqun Feng wrote:
> Hi Peter,
> 
> On Tue, May 31, 2016 at 12:19:44PM +0200, Peter Zijlstra wrote:
> [snip]
> >  
> > @@ -329,20 +361,53 @@ atomic64_##op##_return_relaxed(long a, a
> >  	return t;							\
> >  }
> >  
> > +#define ATOMIC64_FETCH_OP_RELAXED(op, asm_op)				\
> > +static inline long							\
> > +atomic64_fetch_##op##_relaxed(long a, atomic64_t *v)			\
> > +{									\
> > +	long res, t;							\
> > +									\
> > +	__asm__ __volatile__(						\
> > +"1:	ldarx	%0,0,%4		# atomic64_fetch_" #op "_relaxed\n"	\
> > +	#asm_op " %1,%3,%0\n"						\
> > +"	stdcx.	%1,0,%4\n"						\
> > +"	bne-	1b\n"							\
> > +	: "=&r" (res), "=&r" (t), "+m" (v->counter)			\
> > +	: "r" (a), "r" (&v->counter)					\
> > +	: "cc");							\
> > +									\
> > +	return t;							\
> 
> Looks like I missed this one in v1, it should be
> 	
> 	return res;
> 
> because the primitives will return the values before modified by the
> operations.
> 

FWIW, I tested on ppc with ATOMIC64_SELFTEST=y for the following branch:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git locking/atomic (afee54ef5b1f2b04)

without this modification, I can hit:

------------[ cut here ]------------
kernel BUG at lib/atomic64_test.c:181!
Oops: Exception in kernel mode, sig: 5 [#1]

with this modification, all the atomic selftests are passed ;-)

Regards,
Boqun

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ