[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4862D6CC.7090205@goop.org>
Date: Wed, 25 Jun 2008 16:37:48 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: "H. Peter Anvin" <hpa@...nel.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
H. Peter Anvin wrote:
> Arjan van de Ven wrote:
>>>>
>>> I suppose, though I would be inclined to put the barriers in the
>>> wrmsr macro itself to act as documentation.
>>
>>
>> yeah I meant like this:
>>
>> static inline void native_write_msr(unsigned int msr,
>> unsigned low, unsigned high)
>> {
>> barrier();
>> asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high));
>> barrier();
>> }
>>
>> or in the same in the thing that calls this.
>>
>
> 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.
That said, making the wrmsr itself a memory clobber may be simpler
understand with a comment, rather than separate barriers...
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