From: Keir Fraser <keir@xen.org>
To: Jan Beulich <JBeulich@novell.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
Christoph Egger <Christoph.Egger@amd.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: regression from c/s 22071:c5aed2e049bc (ept: Put locks around ept_get_entry) ?
Date: Thu, 16 Dec 2010 16:42:46 +0000 [thread overview]
Message-ID: <C92FF206.D1D6%keir@xen.org> (raw)
In-Reply-To: <4D0A4AC90200007800028731@vpn.id2.novell.com>
On 16/12/2010 16:22, "Jan Beulich" <JBeulich@novell.com> wrote:
>> Probably a similar assumption to what we make in x86_64's pte_write_atomic()
>> implementation? Possibly pte_{read,write}_atomic() should cast the pte
>> pointer to volatile, and the EPT reads/writes should be similarly wrapped in
>> macros which do casting. I'm sure we make various other assumptions about
>> read/write atomicity in Xen, but aiming to fix them as we find them is maybe
>> not a bad idea.
>>
>> If that sounds good, I can propose a patch?
>
> Oh, yes. I didn't even consider there might be more places.
>
> What I'm surprised about is you suggesting to take the "volatile"
> route instead of the barrier() one...
I don't think barrier() would solve the problem at hand. The idiom we are
dealing with is something like:
x = *px;
[barrier()]
<mess with fields in x>
[barrier()]
*px = x;
I don't see that adding the bracketed barrier() calls above ensures that the
access to *px are done in a single atomic instruction. There's nothing
touching non-local variables between the two barrier()s, so for example the
code that messes with x could be moved after the second barrier() and then
the compiler could choose to mess with *px directly if it wishes.
The issue is not one of serialisation or code ordering. It is one of
memory-access atomicity. Thus it seems to me that volatile is the correct
approach therefore. Perhaps *(volatile type *)px = x or, really, even better
I should define some {read,write}_atomic{8,16,32,64} accessor functions
which use inline asm to absolutely definitely emit a single atomic 'mov'
instruction.
Make sense?
-- Keir
next prev parent reply other threads:[~2010-12-16 16:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 8:39 regression from c/s 22071:c5aed2e049bc (ept: Put locks around ept_get_entry) ? Jan Beulich
2010-12-14 10:47 ` George Dunlap
2010-12-14 10:48 ` George Dunlap
2010-12-14 12:37 ` Jan Beulich
2010-12-14 14:32 ` George Dunlap
2010-12-14 14:34 ` George Dunlap
2010-12-14 14:50 ` Jan Beulich
2010-12-16 15:51 ` Jan Beulich
2010-12-16 16:12 ` Keir Fraser
2010-12-16 16:22 ` Jan Beulich
2010-12-16 16:42 ` Keir Fraser [this message]
2010-12-16 16:50 ` Jan Beulich
2010-12-16 17:03 ` Keir Fraser
2010-12-16 20:34 ` Keir Fraser
2010-12-17 11:15 ` Tim Deegan
2010-12-20 16:24 ` George Dunlap
2010-12-17 14:03 ` Olaf Hering
2010-12-17 14:18 ` Keir Fraser
2010-12-16 16:59 ` Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C92FF206.D1D6%keir@xen.org \
--to=keir@xen.org \
--cc=Christoph.Egger@amd.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@novell.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.