Re: deadlock avoidance?

Davide Libenzi (davidel@maticad.it)
Thu, 9 Dec 1999 09:00:28 +0100


Thursday, December 09, 1999 4:06 AM
Keith Owens <kaos@ocs.com.au> 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.

Of course !

Cheers,
Davide.

--
Debian, the freedom in freedom.

- 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/