From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Simon Graham <simon.graham@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Jan Beulich <JBeulich@suse.com>
Subject: Re: Possible issue with x86_emulate when writing results back to memory
Date: Thu, 9 Jan 2014 16:21:47 +0000 [thread overview]
Message-ID: <52CECC9B.50100@citrix.com> (raw)
In-Reply-To: <31EF1F85386F3941A65C4C158E12835D195E435A@FTLPEX01CL03.citrite.net>
On 09/01/14 16:07, Simon Graham wrote:
>>> Does this seem a reasonable explanation of the issue?
>> Yes - as long as you can also explain why a spin lock operation
>> would make it into the emulation code in the first place.
>>
> Well, that one is tough and I don't have a good answer... the only thing I would say is that in our system we ALWAYS have the shadow memory tracking enabled (to track changes to framebuffers)
Full shadow, or just logdirty?
With logdirty, frequent pagefaults will occur (which are costly in terms
of vmexits), but I would not expect emulation to occur.
Even with full shadow, emulation only kicks in for non-standard RAM,
which is basically IO to qemu, and instructions trying to write to the
pagetables themselves, which are trapped and emulated for safety reasons.
>
>>> The attached patch is for discussion purposes only - if it is deemed
>>> acceptable I'll resubmit a proper patch request against unstable.
>> I'd rather not add limited scope special casing like that, but instead
>> make the copying much more like real hardware (i.e. not just deal
>> with the 16- and 32-bit cases, and especially not rely on memcpy()
>> using 64-bit reads/writes when it can). IOW - don't use memcpy()
>> here at all (and have a single routine doing The Right Thing (tm)
>> rather than having two clones now, and perhaps more later on -
>> I'd in particular think that the read side in shadow code would also
>> need a similar adjustment).
> My concern was that memcpy is (I assume!) highly optimized - it certainly should be if it isn't and I would worry that a change to make it atomic for the purposes of instruction emulation would result in an across the board perf hit when in most cases it isn't necessary that it be atomic.
>
> This would be fine for the writeback code in the shadow module BUT the __hvm_copy routine is used generically in situations where atomicity is not required...
__hvm_copy() is probably too low to be thinking about this. There are
many things such as grant_copy() which do not want "hardware like" copy
properties, preferring instead to have less overhead.
~Andrew
next prev parent reply other threads:[~2014-01-09 16:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 15:39 Possible issue with x86_emulate when writing results back to memory Simon Graham
2014-01-09 15:53 ` Andrew Cooper
2014-01-09 16:02 ` Simon Graham
2014-01-09 16:05 ` Jan Beulich
2014-01-09 16:06 ` David Vrabel
2014-01-09 16:00 ` Jan Beulich
2014-01-09 16:07 ` Simon Graham
2014-01-09 16:21 ` Andrew Cooper [this message]
2014-01-09 17:33 ` Simon Graham
2014-01-10 9:29 ` Jan Beulich
2014-01-10 13:09 ` Simon Graham
2014-01-10 15:47 ` Jan Beulich
2014-01-10 15:57 ` Simon Graham
2014-01-10 16:26 ` Jan Beulich
2014-01-09 16:23 ` Jan Beulich
2014-01-09 16:30 ` Simon Graham
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=52CECC9B.50100@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=simon.graham@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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.