Re: KVM: pvmmu breakage with gcc 4.3.0

Alexandre Oliva
2008-06-26T18:07:30Z

On Jun 26, 2008, Anthony Liguori <anthony@codemonkey.ws> wrote:

> I think a better fix is to add a "memory " clobber to the hypercalls.

This should definitely be done, but I don't see that this is a sure
way to get that initializers that are otherwise unreferenced to be
stored in their locations. IOW, it appears to me that GCC might still
decide to optimize them away, because it doesn't see that the values
can be used.

Now, Marcelo's patch appears to have been the result of a
misunderstanding. I meant to tell him that a simpler "p" notation was
*not* enough to make the problem go away. I thought a better approach
was to have __pa do something along the lines of

({ char *__buf = (char*)buffer; asm ("" : : "o"(*__buf)); ... })

to make it clear that physical addresses are used.

Anyhow, for now, it appears that a "memory" clobber is not only
required for correct semantics, but also enough to fix the problem.
Let's just hope GCC doesn't get too smart.

--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member ¡Sé Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}