[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4862D7FE.7070507@kernel.org>
Date: Wed, 25 Jun 2008 16:42:54 -0700
From: "H. Peter Anvin" <hpa@...nel.org>
To: Jeremy Fitzhardinge <jeremy@...p.org>
CC: Arjan van de Ven <arjan@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
xen-devel <xen-devel@...ts.xensource.com>,
Stephen Tweedie <sct@...hat.com>,
Eduardo Habkost <ehabkost@...hat.com>,
Mark McLoughlin <markmc@...hat.com>
Subject: Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr
Jeremy Fitzhardinge wrote:
>>
>> Actually, I believe the barrier(); before is actually incorrect, since
>> it would affect the wrmsr() register arguments rather than the wrmsr
>> instruction itself.
>
> How so? What kind of failure do think might occur? Some effect on how
> the wrmsr arguments are evaluated?
>
> barrier() is specifically a compiler optimisation barrier, so the
> barrier before would prevent the compiler from moving anything logically
> before the wrmsr to afterwards.
>
The barrier() before prevents the compiler from optimizing the access to
the arguments (before they go into registers), not the actual wrmsr;
this has to do with the ordering of operations around the barrier above.
The barrier *after* does what you just describe.
> That said, making the wrmsr itself a memory clobber may be simpler
> understand with a comment, rather than separate barriers...
This should be functionally equivalent to a barrier(); after, and given
that this is clearly a point of confusion *already*, I think the memory
clobber is better.
-hpa
--
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