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: <46D4B4FB.8000001@yahoo.com.au>
Date:	Wed, 29 Aug 2007 09:51:23 +1000
From:	Nick Piggin <nickpiggin@...oo.com.au>
To:	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
CC:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	clameter@....com, mingo@...hat.com
Subject: Re: [patch 01/28] Fall back on interrupt disable in cmpxchg8b on
 80386 and 80486

Mathieu Desnoyers wrote:
> * Nick Piggin (nickpiggin@...oo.com.au) wrote:
> 
>>Mathieu Desnoyers wrote:
>>
>>
>>>Q:
>>>What's the reason to have cmpxchg64_local on 32 bit architectures?
>>>Without that need all this would just be a few simple defines.
>>>
>>>A:
>>>cmpxchg64_local on 32 bits architectures takes unsigned long long
>>>parameters, but cmpxchg_local only takes longs. Since we have cmpxchg8b
>>>to execute a 8 byte cmpxchg atomically on pentium and +, it makes sense
>>>to provide a flavor of cmpxchg and cmpxchg_local using this instruction.
>>>
>>>Also, for 32 bits architectures lacking the 64 bits atomic cmpxchg, it
>>>makes sense _not_ to define cmpxchg64 while cmpxchg could still be
>>>available.
>>>
>>>Moreover, the fallback for cmpxchg8b on i386 for 386 and 486 is a
>>>different case than cmpxchg (which is only required for 386). Using
>>>different code makes this easier.
>>>
>>>However, cmpxchg64_local will be emulated by disabling interrupts on all
>>>architectures where it is not supported atomically.
>>>
>>>Therefore, we *could* turn cmpxchg64_local into a cmpxchg_local, but it
>>>would make the 386/486 fallbacks ugly, make its design different from
>>>cmpxchg/cmpxchg64 (which really depends on atomic operations and cannot
>>>be emulated) and require the __cmpxchg_local to be expressed as a macro
>>>rather than an inline function so the parameters would not be fixed to
>>>unsigned long long in every case.
>>>
>>>So I think cmpxchg64_local makes sense there, but I am open to
>>>suggestions.
>>
>>Every new thing like this (especially 64 bit operation on 32 bit
>>architectures) adds a tiny bit more burden for maintainers. Are
>>there any callers? If not, don't add it. It's simple to add if we
>>do get a good reason.
>>
> 
> 
> I am actually using it in LTTng in my timestamping code. I use it to
> work around CPUs with asynchronous TSCs. I need to update 64 bits
> values atomically on this 32 bits architecture.
> 
> I plan to submit this timestamping code soon.

OK fair enough. So long as there is a user (and you are sure said
user is going to get upstream -- sometimes it is easier to put
this patchset in with the one that is going to call it, but OTOH
that can turn people off reviewing).

-- 
SUSE Labs, Novell Inc.
-
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