xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Paul Durrant <paul.durrant@citrix.com>
Subject: Re: [PATCH 1/2] x86/HVM: latch linear->phys translation results
Date: Thu, 09 Jun 2016 06:13:35 -0600	[thread overview]
Message-ID: <5759798F02000078000F36D4@prv-mh.provo.novell.com> (raw)
In-Reply-To: <5759590E.80907@citrix.com>

>>> On 09.06.16 at 13:54, <andrew.cooper3@citrix.com> wrote:
> On 08/06/16 14:09, Jan Beulich wrote:
>> ... to avoid re-doing the same translation later again (in a retry, for
>> example). This doesn't help very often according to my testing, but
>> it's pretty cheap to have, and will be of further use subsequently.
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> --- a/xen/arch/x86/hvm/emulate.c
>> +++ b/xen/arch/x86/hvm/emulate.c
>> @@ -678,6 +678,19 @@ static struct hvm_mmio_cache *hvmemul_fi
>>      return cache;
>>  }
>> +static void latch_linear_to_phys(struct hvm_vcpu_io *vio, unsigned long gla,
>> +                                 unsigned long gpa, bool_t write)
>> +{
>> +    if ( vio->mmio_access.gla_valid )
>> +        return;
>> +
>> +    vio->mmio_gva = gla & PAGE_MASK;
> This suggest that mmio_vga is mis-named.
> Looking at the uses, handle_mmio_with_translation() is used
> inconsistently, with virtual addresses from the shadow code, but linear
> addresses from nested hap code.
> Clearly one of these two users are buggy for guests running in a non
> flat way, and it looks to be the shadow side which is buggy.

Right - this field is certainly meant to be a linear address (as all
segment information is gone by the time we get here). But I can't
seem to see an issue with the shadow instance: The "virtual"
address here is the CR2 value of a #PF, which clearly is a linear

And anyway all you say is orthogonal to the change here.

> Following my recent fun with invlpg handling, I am much more conscious
> about the distinction between virtual and linear addresses.  I wonder if
> we want to go so far as to have a TYPE_SAFE() for it, to try and avoid
> further misuse?

Not sure; if you're up to it, I wouldn't mind, but maybe an
alternative would be to have a (segment,offset) container
instead for virtual addresses, such that only linear addresses
can get passed as plain number?


Xen-devel mailing list

  reply	other threads:[~2016-06-09 12:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 13:04 [PATCH 0/2] x86/HVM: avoid full linear->phys translations more frequently Jan Beulich
2016-06-08 13:09 ` [PATCH 1/2] x86/HVM: latch linear->phys translation results Jan Beulich
2016-06-09 11:54   ` Andrew Cooper
2016-06-09 12:13     ` Jan Beulich [this message]
2016-06-14 10:29       ` Andrew Cooper
2016-06-20 13:12     ` Tim Deegan
2016-06-20 13:44       ` Andrew Cooper
2016-06-10 15:17   ` Paul Durrant
2016-06-08 13:10 ` [PATCH 2/2] x86/HVM: use available linear->phys translations in REP MOVS/STOS handling Jan Beulich
2016-06-10 15:17   ` Paul Durrant

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5759798F02000078000F36D4@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH 1/2] x86/HVM: latch linear->phys translation results' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).