From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
clameter@sgi.com, mingo@redhat.com
Subject: Re: [patch 01/28] Fall back on interrupt disable in cmpxchg8b on 80386 and 80486
Date: Wed, 29 Aug 2007 09:51:23 +1000 [thread overview]
Message-ID: <46D4B4FB.8000001@yahoo.com.au> (raw)
In-Reply-To: <20070828113122.GA12241@Krystal>
Mathieu Desnoyers wrote:
> * Nick Piggin (nickpiggin@yahoo.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.
next prev parent reply other threads:[~2007-08-28 23:51 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-27 15:52 [patch 00/28] Add cmpxchg64_local and cmpxchg_local to each architecture Mathieu Desnoyers
2007-08-27 15:52 ` [patch 01/28] Fall back on interrupt disable in cmpxchg8b on 80386 and 80486 Mathieu Desnoyers
2007-08-28 1:40 ` Nick Piggin
2007-08-28 11:31 ` Mathieu Desnoyers
2007-08-28 23:51 ` Nick Piggin [this message]
2007-08-27 15:52 ` [patch 02/28] Add cmpxchg64 and cmpxchg64_local to alpha Mathieu Desnoyers
2007-08-27 15:52 ` [patch 03/28] Add cmpxchg64 and cmpxchg64_local to mips Mathieu Desnoyers
2007-08-28 13:58 ` Ralf Baechle
2007-08-27 15:52 ` [patch 04/28] Add cmpxchg64 and cmpxchg64_local to powerpc Mathieu Desnoyers
2007-09-22 4:46 ` Paul Mackerras
2007-09-22 14:35 ` Mathieu Desnoyers
2007-08-27 15:52 ` [patch 05/28] Add cmpxchg64 and cmpxchg64_local to x86_64 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 06/28] Add cmpxchg_local to asm-generic for per cpu atomic operations Mathieu Desnoyers
2007-08-27 15:52 ` [patch 07/28] Add cmpxchg_local to arm Mathieu Desnoyers
2007-08-27 15:52 ` [patch 08/28] Add cmpxchg_local to avr32 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 09/28] Add cmpxchg_local to blackfin, replace __cmpxchg by generic cmpxchg Mathieu Desnoyers
2007-08-27 15:52 ` [patch 10/28] Add cmpxchg_local to cris Mathieu Desnoyers
2007-08-27 15:52 ` [patch 11/28] Add cmpxchg_local to frv Mathieu Desnoyers
2007-08-27 15:52 ` [patch 12/28] Add cmpxchg_local to h8300 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 13/28] Add cmpxchg_local, cmpxchg64 and cmpxchg64_local to ia64 Mathieu Desnoyers
2007-08-27 19:32 ` Christoph Lameter
2007-08-27 15:52 ` [patch 14/28] New cmpxchg_local (optimized for UP case) for m32r Mathieu Desnoyers
2007-08-27 15:52 ` [patch 15/28] Fix m32r __xchg Mathieu Desnoyers
2007-08-27 15:52 ` [patch 16/28] m32r: build fix of arch/m32r/kernel/smpboot.c Mathieu Desnoyers
2007-08-27 15:52 ` [patch 17/28] local_t m32r use architecture specific cmpxchg_local Mathieu Desnoyers
2007-08-27 15:52 ` [patch 18/28] Add cmpxchg_local to m86k Mathieu Desnoyers
2007-08-27 15:52 ` [patch 19/28] Add cmpxchg_local to m68knommu Mathieu Desnoyers
2007-08-27 15:52 ` [patch 20/28] Add cmpxchg_local to parisc Mathieu Desnoyers
2007-08-27 15:52 ` [patch 21/28] Add cmpxchg_local to ppc Mathieu Desnoyers
2007-08-27 15:52 ` [patch 22/28] Add cmpxchg_local to s390 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 23/28] Add cmpxchg_local to sh, use generic cmpxchg() instead of cmpxchg_u32 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 24/28] Add cmpxchg_local to sh64 Mathieu Desnoyers
2007-08-27 15:52 ` [patch 25/28] Add cmpxchg_local to sparc, move __cmpxchg to system.h Mathieu Desnoyers
2007-08-27 15:53 ` [patch 26/28] Add cmpxchg_local to sparc64 Mathieu Desnoyers
2007-08-27 15:53 ` [patch 27/28] Add cmpxchg_local to v850 Mathieu Desnoyers
2007-08-27 15:53 ` [patch 28/28] Add cmpxchg_local to xtensa Mathieu Desnoyers
2007-08-27 16:17 ` [patch 00/28] Add cmpxchg64_local and cmpxchg_local to each architecture Andrew Morton
2007-08-27 17:31 ` Mathieu Desnoyers
2007-08-27 19:29 ` Christoph Lameter
2007-08-27 19:35 ` Christoph Lameter
2007-08-27 20:19 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46D4B4FB.8000001@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox