Re: Linux-2.1.109.. preliminary code freeze.

Linus Torvalds (torvalds@transmeta.com)
Sat, 18 Jul 1998 11:40:03 -0700 (PDT)


On Sat, 18 Jul 1998, Alan Cox wrote:
> > The problem here is applying "test_and_set_bit" to a poorly-aligned char.
> > The variable is "interrupt" in a "struct device" (line 192 in netdevice.h).
> > For the UDB, this can be kludged-around by changing the two char-s to int-s.
> > Somebody else should know the correct solution. The code in question is
> > around line 1560 in de4x5.c:
>
> If we need to ensure alignment of that field for atomic tests then unless
> it breaks anything else (it doesnt seem to at first look) they should be
> int. Im happy to make them ints

I've made them both "unsigned long". No architecture I know of requires
atomic accesses to be "long", but I could imagine some that does (many
architectures essentially require the access to be at least "int").

However, I also added a comment saying that it's a horrible waste of
memory, and at least the thing should be in the _same_ unsigned long (it's
just a bit operation, they can use different bits). I'm not ready to do
that change at this time, but it should be nicer to instead of having
"tbit" and "interrupt" and "start" all be just simple bits, and you'd have

unsigned long dev_flags;
#define NETDEV_START 0
#define NETDEV_TBUSY 1
#define NETDEV_INTERRUPT 2
...

(right now "start" is still a 'char' in my tree, and that's technically
wrong too).

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html