Re: bitmaps/bitops

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Sun Mar 16 2003 - 16:42:57 EST


On Sun, 2003-03-16 at 01:31, Pete Zaitcev wrote:
> > but the prototype for test_and_set_bit() depends on $(ARCH), and it's
> > not consistent, with the second arg (bitmap address) being one of:
> > volatile void *
> > void *
> > volatile unsigned long *
>
> It should be unsigned long pointer. I have no idea why
> volatile is still alive. Perhaps Linus can remember why he
> left it in on is386. Other arch maintainers midnlessly ape him
> in this area. I think I even kept his e-mail where he explains
> why volatile has to go.

Several 2.4 drivers assume the test_and_set point is a memory
barrier for locking. Lots of

        if(test_and_set_bit(0, &foo))
        {
                x=foodev->blah

Since its inline code and not a memory barrier otherwise there
is little stop the compile doing

        x=foodev->blah

first

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:18 EST