Re: test_and_set_bit() not atomic forever? [cli/sti in char/vt.c [patch]]
Sun, 31 May 1998 16:08:59 +0200

On Sun, May 31, 1998 at 02:34:11PM +0200, Andrea Arcangeli wrote:

> >Hold on: even if the machine has a single CPU, you still need to
> >guarantee atomicity because of interrupt handlers. On a single CPU
> >machine you could do this by disabling interrupts. But you can't
> >just ignore the whole issue because you only have one CPU.
> Woops, I think that test_and_set_bit() has to be atomic only in respect of
> SMP (as i386 implementation). Maybe "atomic" is not the best word to
> describe test_and_set_bit(), "SMP safe" should feel better...

Nuff, see Ethernet drivers' transmit function:

/* Block a timer-based transmit from overlapping. This could better be
done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) {
printk("%s: Transmitter access conflict.\n", dev->name);
return 1;


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to