* atomic counters larger than 24 bits?
@ 2009-03-26 19:38 Dan Magenheimer
2009-03-26 23:26 ` Samuel Thibault
2009-03-27 18:15 ` Jeremy Fitzhardinge
0 siblings, 2 replies; 4+ messages in thread
From: Dan Magenheimer @ 2009-03-26 19:38 UTC (permalink / raw)
To: Xen-Devel (E-mail)
In tmem, I have some counters that I need to keep coherent,
preferably without a lock, so I'm using atomic_inc/dec etc.
However the comments in include/asm-x86/atomic.h say repeatedly
that the "useful range of an atomic_t is only 24 bits".
First, are the comments true in the xen implementation?
(I don't see any code that restricts them to anything less
than "int".) If they ARE limited to 24 bits, what's the
recommended approach for larger atomic operations... or
do I just need to always use a lock?
Thanks,
Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: atomic counters larger than 24 bits?
2009-03-26 19:38 atomic counters larger than 24 bits? Dan Magenheimer
@ 2009-03-26 23:26 ` Samuel Thibault
2009-03-27 8:52 ` Keir Fraser
2009-03-27 18:15 ` Jeremy Fitzhardinge
1 sibling, 1 reply; 4+ messages in thread
From: Samuel Thibault @ 2009-03-26 23:26 UTC (permalink / raw)
To: Dan Magenheimer; +Cc: Xen-Devel (E-mail)
Dan Magenheimer, le Thu 26 Mar 2009 19:38:13 +0000, a écrit :
> In tmem, I have some counters that I need to keep coherent,
> preferably without a lock, so I'm using atomic_inc/dec etc.
> However the comments in include/asm-x86/atomic.h say repeatedly
> that the "useful range of an atomic_t is only 24 bits".
IIRC the historical reason for this is that some Linux architectures
weren't providing more. The x86 implementation does support signed 32
bits. I believe the ia64 implementation does too.
Samuel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: atomic counters larger than 24 bits?
2009-03-26 23:26 ` Samuel Thibault
@ 2009-03-27 8:52 ` Keir Fraser
0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2009-03-27 8:52 UTC (permalink / raw)
To: Samuel Thibault, Dan Magenheimer; +Cc: Xen-Devel (E-mail)
On 26/03/2009 23:26, "Samuel Thibault" <samuel.thibault@ens-lyon.org> wrote:
> Dan Magenheimer, le Thu 26 Mar 2009 19:38:13 +0000, a écrit :
>> In tmem, I have some counters that I need to keep coherent,
>> preferably without a lock, so I'm using atomic_inc/dec etc.
>> However the comments in include/asm-x86/atomic.h say repeatedly
>> that the "useful range of an atomic_t is only 24 bits".
>
> IIRC the historical reason for this is that some Linux architectures
> weren't providing more. The x86 implementation does support signed 32
> bits. I believe the ia64 implementation does too.
Yes, I'll fix the x86/atomic.h comments. Our atomic_t type is signed and at
least 32 bits. I don't see we'll ever port to an architecture without
cmpxchg or similar to easily support 'full width' atomic_t.
-- Keir
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: atomic counters larger than 24 bits?
2009-03-26 19:38 atomic counters larger than 24 bits? Dan Magenheimer
2009-03-26 23:26 ` Samuel Thibault
@ 2009-03-27 18:15 ` Jeremy Fitzhardinge
1 sibling, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2009-03-27 18:15 UTC (permalink / raw)
To: Dan Magenheimer; +Cc: Xen-Devel (E-mail)
Dan Magenheimer wrote:
> In tmem, I have some counters that I need to keep coherent,
> preferably without a lock, so I'm using atomic_inc/dec etc.
> However the comments in include/asm-x86/atomic.h say repeatedly
> that the "useful range of an atomic_t is only 24 bits".
>
Old sparcs had no way to implement proper atomics, so they used to
reserve a byte in the atomic_t as a spinlock. But I don't think that's
true any more; they have a separate lock hash, and atomics in the kernel
are at least 32-bits.
> First, are the comments true in the xen implementation?
> (I don't see any code that restricts them to anything less
> than "int".) If they ARE limited to 24 bits, what's the
> recommended approach for larger atomic operations... or
> do I just need to always use a lock?
>
I don't think the limitation ever applied to Xen.
J
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-27 18:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 19:38 atomic counters larger than 24 bits? Dan Magenheimer
2009-03-26 23:26 ` Samuel Thibault
2009-03-27 8:52 ` Keir Fraser
2009-03-27 18:15 ` Jeremy Fitzhardinge
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.