[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] calling the VMX instructions from HVM guest application



 

> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Praveen Kushwaha
> Sent: 28 March 2007 07:56
> To: xen-devel@xxxxxxxxxxxxxxxxxxx; xen-users@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-devel] calling the VMX instructions from HVM 
> guest application
> 
>  
> 
> Hi 
> 
>         Since the xen(Intel) provide the VMX instruction set 
> (like VMPTRLD, VMREAD, VMWRITE, VMCLEAR VMCALL  etc.) to 
> manage the VMCS. 
> 
>         I have some queries regarding these instructions:
> 
>  
> 
> 1.      Can an application in HVM guest  call these VMX 
> instructions? If yes how to call these VMX instructions, is 
> it through the hyper calls or through other mechanism? 

There is ONE of these instructions that can be used (without problems)
by the guest: VMCALL, which forces a VMExit to the hypervisor. Ok, so if
you do a VMCLEAR for example in the guest, then it will actually just
cause a VMExit for that too - but with a different exit value (in this
particular example EXIT_REASON_VMCLEAR), which will be used by the
hypervisor to instruct the guest to do a "invalid opcode" [1] (using the
vmx_inject_exception function). See line 2754 in
.../xen/arch/x86/hvm/vmx/vmx.c). It seems like the svm.c code isn't
doing exactly the same thing (it's crashing the guest instead. I'll see
if I can fix that up - I don't think the current behaviour is correct).


[1] Invalid opcode is also the result if this instruction was executed
without enabling VMX/SVM in the first place. See AMD and Intel
documentation for the respective instructions.

> 
> 2.      Is VMCS structure is updated by the processor 
> automatically in case VMexit happens ? Suppose VMExit 
> operation caused due to VMcall then  
> 
>        Will the VMCS structure will be updated 
> automatically(i.e. Guest state information is saved on VMCS) 
> ?
Yes, the processor writes to VMCS with the current state of the
processor at the time of VMExit (regardless of the reason for te
Vmexit). 

> can the application in HVM guest also
>        store some information on VMCS?

Aside from register values stored by the processor (rAX, rSP), there is
no information that the guest has free control over that is stored in
the VMCS. As part of the VMEXIT handler, the rest of the registers from
the guest are also stored, so those can be seen and modified by the
hypervisor (this is for example the case on a mov %cr0,%rbx). 

> 
> 3.      what are the other way to pass information from HVM 
> guest to hypervisor. Though there is VMWRITE instruction is 
> there, but how actually it works? I mean to say that , if 
> VMWRITE instruction will be called then VMExit will happen. 
> Then how exactly to pass information to hypervisor using VMCS?

The VWWRITE instruction is only allowed within the hypervisor itself.
The guest is not allowed (and should never be allowed) to touch the
VMCS. The VMCS belongs to the hypervisor to control the guest, and
there's no reason why the guest should even know that such a think
exists. 

--
Mats
> 
>             
> 
>             Above of some questions might not be intelligent 
> enough. If anyone has  information regarding it please reply.
> 
>  
> 
> Thanks,
> 
> Praveen Kushwaha
> 
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.