[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <472A7B95.2030001@goop.org>
Date: Thu, 01 Nov 2007 18:21:25 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Zachary Amsden <zach@...are.com>
CC: Jeremy Fitzhardinge <jeremy@...p.org>, lguest@...abs.org,
akpm@...ux-foundation.org, kvm-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, ak@...e.de,
Keir Fraser <Keir.Fraser@...cam.ac.uk>, anthony@...emonkey.ws,
mingo@...e.hu, Glauber de Oliveira Costa <gcosta@...hat.com>,
virtualization@...ts.linux-foundation.org, tglx@...utronix.de
Subject: Re: [Lguest] [PATCH 3/16] read/write_crX, clts and wbinvd for 64-bit
paravirt
Zachary Amsden wrote:
> I understood it as reordering was permitted, but no re-ordering across
> another volatile load, store, or asm was permitted.
It doesn't say that, so I wouldn't assume it. Certainly we had problems
with the pda code; until I added the _proxy_pda dependency variable, the
only fix Andi could find was adding both "volatile" and a memory clobber.
> And of course, as
> long as input and output constraints are written properly, the
> re-ordering should not be vulnerable to pathological movement causing
> the code to malfunction.
>
Yes. I think constraints are the only way to control ordering (even if
it's as heavy-handed as a memory clobber). It would be nice if gcc had
a constraint which was only used for ordering, and never generated a
reference. Then you could make up pseudo-variables in order to express
dependencies without having the risk that the compiler would generate
references.
> It seems that CPU state side effects which can't be expressed in C need
> special care - FPU is certainly one example.
>
Not an immediate problem, fortunately.
> Also, memory clobber on a volatile asm should stop invalid movement
> across TLB flushes and other problems areas.
Yes. Any asm which has global effects on how addresses are interpreted
(like tlbflush, reloading the pagetable base, changing modes, etc) needs
to have a memory clobber.
> Even memory fences should
> have memory clobber in order to stop movement of loads and stores across
> the fence by the compiler.
>
Pretty sure they do. A normal compiler barrier is *just* a memory clobber.
J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists