[lkml]   [1998]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: test_and_set_bit() not atomic forever? [cli/sti in char/vt.c [patch]]
    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

     \ /
      Last update: 2005-03-22 13:42    [W:0.020 / U:24.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site