Aliasing issue with TAILQ on ppc64 ?

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Sep 18 16:04:51 UTC 2012


In message <CAJ-FndAwUDJsJZNqihzdfz60UEhS75oOYijjb7LAzT+wx1V6DA at mail.gmail.com>
, Attilio Rao writes:

>Yep, it likely means you need to use compiler memory barriers then.
>I didn't look into details the implementation of TAILQ (but I can if
>you want)

Yes, It might be helpful if you knew what you were talking about,
rather than shoot from the hip :-)

> to point you precisely where, but it seems you already know
>that code well enough to tell where.

I know perfectly well where to insert the memory barrier.

My point is that I don't think many people amongst our users
would realize that you _need_ memory barriers when you need
TAILQ's and I don't think I know of a single instance in our
source tree that does...

>TAILQ is certainly subjective to aliasing because it is inlined code,

It's not inlining that makes it subject to aliasing, it's the casting.

Please RTFC.

>However, please note that this type of issue is not only related to
>ppc64, but to all gcc/clang supported platforms.

Which is very much why I bloody raise it on arch@ in the first place.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list