Re: [patch 01/28] Fall back on interrupt disable in cmpxchg8b on 80386 and 80486

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Nick Piggin ([email protected]) 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.

Mathieu


-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux