public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* atomic_ops.txt vs. test_and_set_bit()
@ 2006-03-27 12:56 Zoltan Menyhart
  0 siblings, 0 replies; only message in thread
From: Zoltan Menyhart @ 2006-03-27 12:56 UTC (permalink / raw)
  To: linux-ia64

I had a look at the atomic_ops.txt:

"      int test_and_set_bit(unsigned long nr, volatils unsigned long *addr);
       int test_and_clear_bit(unsigned long nr, volatils unsigned long *addr);
       int test_and_change_bit(unsigned long nr, volatils unsigned long *addr);
[...]

These routines, like the atomic_t counter operations returning values,
require explicit memory barrier semantics around their execution.  All
memory operations before the atomic bit operation call must be made
visible globally before the atomic bit operation is made visible.
Likewise, the atomic bit operation must be visible globally before any
subsequent memory operation is made visible.  For example:

       obj->dead = 1;
       if (test_and_set_bit(0, &obj->flags))
               /* ... */;
       obj->killed = 1;

The implementation of test_and_set_bit() must guarentee that
"obj->dead = 1;" is visible to cpus before the atomic memory operation
done by test_and_set_bit() becomes visible.  Likewise, the atomic
memory operation done by test_and_set_bit() must become visible before
"obj->killed = 1;" is visible."

The implementation of "test_and_set_bit()" does not meet this
requirement. It's a bad news.
If the description in atomic_ops.txt were not quite up to date... :-)

Regards,

Zoltan 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-27 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27 12:56 atomic_ops.txt vs. test_and_set_bit() Zoltan Menyhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox