Re: deadlock avoidance?

Keith Owens (kaos@ocs.com.au)
Thu, 09 Dec 1999 14:06:48 +1100


On Wed, 8 Dec 1999 20:32:50 +0100,
dlibenzi@maticad.it (Davide Libenzi) wrote:
>CPU0 CPU1
>A = 0x1111 A = 0x2222
>
>Then A result or 0x1111 or 0x2222, no 0x1122 nor 0x2211 !
>This is in every Linux supported architecture.

But only if A is correctly aligned. If A starts at address n*8+7 then
at least one arch (i370) can generate 0x1122 for the above code. Most
variables are correctly aligned but if you are doing something nasty
like mapping shorts or ints over unaligned storage like this

char buf[16]; /* Assume starts at address n*8 */
CPU 0 CPU 1
*((__u16 *)(buf+7)) = 0x1111; *((__u16 *)(buf+7)) = 0x2222;

then the results are undefined.

-
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.tux.org/lkml/