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: <4B57A60E.5030306@zytor.com>
Date:	Wed, 20 Jan 2010 16:55:42 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
CC:	Christoph Lameter <cl@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Andi Kleen <andi@...stfloor.org>
Subject: Re: [x86] Unify semaphore_32.S and rwlock_64.S

On 01/20/2010 04:46 PM, Linus Torvalds wrote:
> 
> 
> On Wed, 20 Jan 2010, Linus Torvalds wrote:
>>
>> 	#define RWSEM_UNLOCKED_VALUE            0x00000000
>> 	#define RWSEM_ACTIVE_BIAS               0x00000001
>> 	#define RWSEM_ACTIVE_MASK               0x3fffffff
>> 	#define RWSEM_WAITING_BIAS              (~RWSEM_ACTIVE_MASK)
>> 	#define RWSEM_ACTIVE_READ_BIAS          RWSEM_ACTIVE_BIAS
>> 	#define RWSEM_ACTIVE_WRITE_BIAS         (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
> 
> Btw, doing that RWSEM_WAITING_BIAS cleanup (we currently have it as an 
> independent constant) means that now all constants are shared except for 
> that RWSEM_ACTIVE_MASK. So it ends up being something like this:
> 
> 	#ifdef CONFIG_RWSEM_64bit
> 	  typedef __s64 rwsem_count_t;
> 	  #define RWSEM_ACTIVE_MASK	0x3fffffff
> 	#else
> 	  typedef __s32 rwsem_count_t;
> 	  #define RWSEM_ACTIVE_MASK     0xffff
> 	#endif
> 
> 	#define RWSEM_UNLOCKED_VALUE	0x00000000
> 	#define RWSEM_ACTIVE_BIAS	0x00000001
> 	#define RWSEM_WAITING_BIAS	(~RWSEM_ACTIVE_MASK)
> 	#define RWSEM_ACTIVE_READ_BIAS	RWSEM_ACTIVE_BIAS   
> 	#define RWSEM_ACTIVE_WRITE_BIAS	(RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
> 
> with just that two-line difference for the 32-bit/64-bit case.
> 
> At least I _think_ so.
> 

Yes, I already had that change in my tree (or rather, I wrote it as
(-RWSEM_ACTIVE_MASK-1) to be consistent with what was previously there,
but (~RWSEM_ACTIVE_MASK) makes more sense.)

> And it's worth noting (again) that I didn't actually push the 
> twsem_count_t changes down into the slow-path code in lib/rwsem.c. There's 
> a few variables there that might need looking at too. I _think_ they are 
> all ok as-is (unlike the header file, lib/rwsem.c seems to consistently 
> use 'signed long' rather than mix 32-bit and 64-bit types), but it migh be 
> cleaner to make them rwsem_count_t's too.

Yes, if we have it we should it consistently.

	-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ