This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-devel] [PATCH] Calculate correct instruction length for data-fa

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, "Khoa Huynh" <khoa@xxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems
From: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Date: Fri, 28 Apr 2006 11:02:25 +0200
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 28 Apr 2006 02:03:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcZqikKRJyd510L5TxeI2Gof0dpbdAAF71FA
Thread-topic: [Xen-devel] [PATCH] Calculate correct instruction length for data-fault VM exits on VT-x systems
> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Keir Fraser
> Sent: 28 April 2006 07:03
> To: Khoa Huynh
> Cc: xen-devel
> Subject: Re: [Xen-devel] [PATCH] Calculate correct 
> instruction length for data-fault VM exits on VT-x systems
> On 28 Apr 2006, at 02:52, Khoa Huynh wrote:
> > It should be noted that VMX only uses this instrlen 
> function when the 
> > hypervisor needs the instruction-length info and that info is 
> > undefined in VMCS, e.g., for MMIO instructions.  In other 
> cases where 
> > the instruction-length field is valid in VMCS, the hypervisor 
> > continues to get that info from VMCS (via vmread operation).
> I don't believe we need the instruction-length at all, and I 
> suspect that the decoder could be removed from hvm/svm 
> entirely. There are two broad categories of instruction I'm 
> thinking of:
>   1. Instructions with their own VMEXIT reason code tend to 
> be really simple so we know their length anyway and, if not, 
> the instr-length field should be valid
>   2. For mmio instructions, the emulator can work out the 
> length for itself and increment eip appropriately. There's no 
> need to know the instruction length in advance of invoking 
> the emulator.
> I guess there may be one or two instructions, particularly on 
> AMD, where we aren't feeding the instruction to the mmio 
> emulator and the instruction isn't fixed length, so perhaps 
> we'll need a small decoder in hvm/svm for those. But even if 
> so, it could be much simpler than what is there right now.

Yes, this is correct. There is a specific routine that takes as an
argument which instruction(s) we're looking for, and calculates it's
length, for this purpose [since we do know which instructions we are
looking for]. 

I'll look at your previous suggestion of merging the MMIO emulation into
x86_emulate later on today. We probably do need to sum up the length and
pass it back to the caller - as that code doesn't know how to update the
correct field of the different processor architectures (vmcb vs. vmcs
vs. stack-frame for Para-virtual machine). But it shouldn't be
particularly hard to achieve this. 


Xen-devel mailing list