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]
Message-ID: <20160603223620.GB3727@twins.programming.kicks-ass.net>
Date:	Sat, 4 Jun 2016 00:36:20 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Jason Low <jason.low2@....com>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ingo Molnar <mingo@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Richard Henderson <rth@...ddle.net>,
	Ivan Kokshaysky <ink@...assic.park.msu.ru>,
	Matt Turner <mattst88@...il.com>,
	Tony Luck <tony.luck@...el.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Terry Rudd <terry.rudd@....com>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Arnd Bergmann <arnd@...db.de>,
	Christoph Lameter <cl@...ux.com>,
	Davidlohr Bueso <dave@...olabs.net>,
	Waiman Long <Waiman.Long@....com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Peter Hurley <peter@...leysoftware.com>,
	Jason Low <jason.low2@...com>
Subject: Re: [RFC][PATCH 0/7] locking/rwsem: Convert rwsem count to
 atomic_long_t

On Fri, Jun 03, 2016 at 11:09:54AM -0700, Jason Low wrote:
> --- a/arch/alpha/include/asm/rwsem.h
> +++ b/arch/alpha/include/asm/rwsem.h
> @@ -25,8 +25,8 @@ static inline void __down_read(struct rw_semaphore *sem)
>  {
>  	long oldcount;
>  #ifndef	CONFIG_SMP
> -	oldcount = sem->count;
> -	sem->count += RWSEM_ACTIVE_READ_BIAS;
> +	oldcount = atomic_long_read(&sem->count);
> +	atomic_long_add(RWSEM_ACTIVE_READ_BIAS, &sem->count);
>  #else

That _completely_ misses the point of the whole !SMP code.

Something like:

diff --git a/arch/alpha/include/asm/rwsem.h b/arch/alpha/include/asm/rwsem.h
index a217bf8..77873d0 100644
--- a/arch/alpha/include/asm/rwsem.h
+++ b/arch/alpha/include/asm/rwsem.h
@@ -25,8 +25,8 @@ static inline void __down_read(struct rw_semaphore *sem)
 {
 	long oldcount;
 #ifndef	CONFIG_SMP
-	oldcount = sem->count;
-	sem->count += RWSEM_ACTIVE_READ_BIAS;
+	oldcount = sem->count.counter;
+	sem->count.counter += RWSEM_ACTIVE_READ_BIAS;
 #else
 	long temp;
 	__asm__ __volatile__(

preserves the intent.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ