From: Keir Fraser Subject: Re: Hypercalls in Intel-VT Date: Mon, 29 Oct 2007 08:13:46 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0255803701==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ashish Bijlani , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --===============0255803701== Content-type: multipart/alternative; boundary="B_3276490427_59522063" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3276490427_59522063 Content-type: text/plain; charset="ISO-2022-JP" Content-transfer-encoding: 7bit The way that PV and HVM guests work is very different. Many of the tricks necessary for hosting PV guests, such as stealing address space for the hypervisor, are not necessary for HVM guests. -- Keir On 29/10/07 07:59, "Ashish Bijlani" wrote: > if a VM's context is saved to and xen's context is loaded from VMCS upon every > VMexit call in VT, the why is xen mapped in the first 64MB region of every > guest VM? As far as I know, TLB will also be flushed when xen's context is > loaded from VMCS host area. > > On 10/26/07, Mark Williamson > wrote: >>> > thanks for your answers. really appreciate your help. however, i've some >>> > more doubts and would appreciate if you could answer the following: >> >> We're now getting a bit outside my understanding of VMX, but the other guys >> may know more. >> >>> > how >>> > does transition happen from root VMX mode to non-root VMX mode? I mean >>> does >>> > it load Xen's CS, DS from the GDT or does it switch GDT to load Xen's GDT? >>> > Also, does it do TLB flush, provided Xen is mapped in the first 64MB of >>> the >>> > guest VM? thanks. >> >> Well, the hardware probably does something equivalent to this. But (as far >> as >> I know) that's not how it looks to software: from the software's point of >> view you are just doing a VMEXIT from non-root mode to root mode. Root mode >> effectively has a different set of control registers / datastructures to >> non-root mode. So software doesn't have to worry so much about the data >> structures involved. I don't *think* the software even has to save / restore >> the guest registers (unless it wants to modify them). >> >> Regarding the TLB flush, again, the hardware quite possibly does that. But >> I'm not aware of anything in the VMX spec that exposes this detail, so Intel >> could easily tag the TLB entries as root / non-root to avoid flushing on a >> VMEXIT / VMENTER. For all I know, they may do this already! >> >> Eddie, did I get that about right? :-) >> >> Cheers, >> Mark >> >>> > >>> > On 10/26/07, Mark Williamson < mark.williamson@cl.cam.ac.uk >>> > wrote: >>>>> > > > that means dom0 doesn't make trap to ring 0 root VMX mode for >>>>> > > > privileged operations like updating cr3? >>>> > > >>>> > > Dom0 always runs paravirtualised, it can't be an HVM domain. So it >>>> just >>>> > > uses >>>> > > the normal paravirtualised interface, regardless of whether VMX is >>>> > > available >>>> > > in the hardware. >>>> > > >>>> > > Cheers, >>>> > > Mark >>>> > > >>>>> > > > On 10/26/07, Dong, Eddie < eddie.dong@intel.com> wrote: >>>>>> > > > > DOm0 works in ring 1 root VMX mode. Anyway can switch from ring 1 to >>>>>> > > > > ring 0 can be used for accessing privileged resource such as INT xx, >>>> > > >>>> > > or >>>> > > >>>>>> > > > > thru exception like I/O. >>>>>> > > > > >>>>>> > > > > But HVM works in non root VMX mode though ring=0, so you need to >>>> > > >>>> > > switch >>>> > > >>>>>> > > > > from non root VMX mode to root VMX mode to access privileged >>>>>> > > > > resource. >>>> > > >>>> > > VM >>>> > > >>>>>> > > > > Exit is the only way to do this. >>>>>> > > > > >>>>>> > > > > ------------------------------ >>>>>> > > > > *From:* xen-devel-bounces@lists.xensource.com [mailto: >>>>>> > > > > xen-devel-bounces@lists.xensource.com] *On Behalf Of *Ashish Bijlani >>>>>> > > > > *Sent:* 2007年10月26日 9:14 >>>>>> > > > > *To:* xen-devel@lists.xensource.com >>>>>> > > > > *Subject:* Re: [Xen-devel] Hypercalls in Intel-VT >>>>>> > > > > >>>>>> > > > > how does dom0 on intel-vt gets privileges to access the hardware >>>> > > >>>> > > devices? >>>> > > >>>>>> > > > > i mean does it get these privileges through superpages? >>>>>> > > > > >>>>>> > > > > On 10/25/07, Cui, Dexuan < dexuan.cui@intel.com >>>>>> > wrote: >>>>>>>> > > > > > > From: xen-devel-bounces@lists.xensource.com >>>>>>>> > > > > > > [mailto: xen-devel-bounces@lists.xensource.com >>>>>>>> ] >>>>>>> > > > > > >>>>>>> > > > > > On Behalf Of Ashish Bijlani >>>>>>> > > > > > >>>>>>>> > > > > > > Sent: 2007年10月26日 8:20 >>>>>>>> > > > > > > To: xen-devel@lists.xensource.com >>>>>>>> > > > > > > Subject: Re: [Xen-devel] Hypercalls in Intel-VT >>>>>>>> > > > > > > >>>>>>>> > > > > > > >>>>>>>> > > > > > > could there be a way to make a transition into xen without a >>>> > > >>>> > > vmexit >>>> > > >>>>>>> > > > > > upon executing an iret inside a guest os krnl? >>>>>>> > > > > > I think we are talking about VMX guest -- the answer it NO... For >>>> > > >>>> > > an >>>> > > >>>>>>> > > > > > VMX guest to return to Xen, a VMexit is a must. You can refert to >>>> > > >>>> > > Intel >>>> > > >>>>>>> > > > > > Software Developer Manual 3B for details. >>>>>>> > > > > > >>>>>>> > > > > > -- Dexuan >>>> > > >>>> > > -- >>>> > > Dave: Just a question. What use is a unicyle with no seat? And no >>>> > > pedals! Mark: To answer a question with a question: What use is a >>>> > > skateboard? Dave: Skateboards have wheels. >>>> > > Mark: My wheel has a wheel! >> >> >> >> -- >> Dave: Just a question. What use is a unicyle with no seat? And no pedals! >> Mark: To answer a question with a question: What use is a skateboard? >> Dave: Skateboards have wheels. >> Mark: My wheel has a wheel! >> > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel --B_3276490427_59522063 Content-type: text/html; charset="ISO-2022-JP" Content-transfer-encoding: quoted-printable Re: [Xen-devel] Hypercalls in Intel-VT The w= ay that PV and HVM guests work is very different. Many of the tricks necessa= ry for hosting PV guests, such as stealing address space for the hypervisor,= are not necessary for HVM guests.

 -- Keir

On 29/10/07 07:59, "Ashish Bijlani" <ashish.bijlani@gmail.com&= gt; wrote:

if a VM's context is saved to and xen's context is load= ed from VMCS upon every VMexit call in VT, the why is xen mapped in the firs= t 64MB region of every guest VM? As far as I know, TLB will also be flushed = when xen's context is loaded from VMCS host area.

On 10/26/07, Mark Williamson <mark.williamson@cl.cam.ac.uk  = <mailto:mark.williamson@cl.= cam.ac.uk> > wrote:
> thanks for your answers. really appreciate your he= lp. however, i've some
> more doubts and would appreciate if you could answer the following:
We're now getting a bit outside my understanding of VMX, but the other guys=
may know more.

> how
> does transition happen from root VMX mode to non-root VMX mode? I mean= does
> it load Xen's CS, DS from the GDT or does it switch GDT to load Xen's = GDT?
> Also, does it do TLB flush, provided Xen is mapped in the first 64MB o= f the
> guest  VM? thanks.

Well, the hardware probably does something equivalent to this.  But (a= s far as
I know) that's not how it looks to software: from the software's point of view you are just doing a VMEXIT from non-root mode to root mode.  Roo= t mode
effectively has a different set of control registers / datastructures to non-root mode.  So software doesn't have to worry so much about the da= ta
structures involved.  I don't *think* the software even has to save / = restore
the guest registers (unless it wants to modify them).

Regarding the TLB flush, again, the hardware quite possibly does that. &nbs= p;But
I'm not aware of anything in the VMX spec that exposes this detail, so Inte= l
could easily tag the TLB entries as root / non-root to avoid flushing on a =
VMEXIT / VMENTER.  For all I know, they may do this already!

Eddie, did I get that about right? :-)

Cheers,
Mark

>
> On 10/26/07, Mark Williamson < mark.williamson@cl.cam.ac.uk <mailto:mark.williamson@cl.cam.ac.= uk> > wrote:
> > > that means dom0 doesn't make trap to ring 0 root VMX mode fo= r
> > > privileged operations like updating cr3?
> >
> > Dom0 always runs paravirtualised, it can't be an HVM domain. &nbs= p;So it just
> > uses
> > the normal paravirtualised interface, regardless of whether VMX i= s
> > available
> > in the hardware.
> >
> > Cheers,
> > Mark
> >
> > > On 10/26/07, Dong, Eddie < eddie.dong@intel.com> wrote= :
> > > >  DOm0 works in ring 1 root VMX mode. Anyway can sw= itch from ring 1 to
> > > > ring 0 can be used for accessing privileged resource su= ch as INT xx,
> >
> > or
> >
> > > > thru exception like I/O.
> > > >
> > > > But HVM works in non root VMX mode though ring=3D0, so yo= u need to
> >
> > switch
> >
> > > > from non root VMX mode to root VMX mode to access privi= leged
> > > > resource.
> >
> > VM
> >
> > > > Exit is the only way to do this.
> > > >
> > > >  ------------------------------
> > > > *From:* xen-devel-bounces@lists.xensource.com [mailto:<= BR> > > > > xen-devel-bounces@lists.xensource.com] *On Behalf Of *A= shish Bijlani
> > > > *Sent:* 2007=1B$BG/=1B(B10=1B$B7n=1B(B26=1B$BF|=1B(B 9:14
> > > > *To:* xen-devel@lists.xensource.com
> > > > *Subject:* Re: [Xen-devel] Hypercalls in Intel-VT
> > > >
> > > > how does dom0 on intel-vt gets privileges to access the= hardware
> >
> > devices?
> >
> > > > i mean does it get these privileges through superpages?=
> > > >
> > > > On 10/25/07, Cui, Dexuan < dexuan.cui@intel.com <mailto:dexuan.cui@intel.com> &g= t; wrote:
> > > > > > From: xen-devel-bounces@lists.xensource.com > > > > > > [mailto: xen-devel-bounces@lists.xensource.co= m <mailto:xen-devel-bounces@lists.xensource.com> ]
> > > > >
> > > > > On Behalf Of Ashish Bijlani
> > > > >
> > > > > > Sent: 2007=1B$BG/=1B(B10=1B$B7n=1B(B26=1B$BF|=1B(B 8:20 > > > > > > To: xen-devel@lists.xensource.com
> > > > > > Subject: Re: [Xen-devel] Hypercalls in Intel-= VT
> > > > > >
> > > > > >
> > > > > > could there be a way to make a transition int= o xen without a
> >
> > vmexit
> >
> > > > > upon executing an iret inside a guest os krnl?
> > > > > I think we are talking about VMX guest -- the answ= er it NO...  For
> >
> > an
> >
> > > > > VMX guest to return to Xen, a VMexit is a must. Yo= u can refert to
> >
> > Intel
> >
> > > > > Software Developer Manual 3B for details.
> > > > >
> > > > > -- Dexuan
> >
> > --
> > Dave: Just a question. What use is a unicyle with no seat?  = And no
> > pedals! Mark: To answer a question with a question: What use is a=
> > skateboard? Dave: Skateboards have wheels.
> > Mark: My wheel has a wheel!



--
Dave: Just a question. What use is a unicyle with no seat?  And no ped= als!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!



____________________= ___________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/x= en-devel

--B_3276490427_59522063-- --===============0255803701== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0255803701==--