All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Abel Gordon <ABELG@il.ibm.com>
Cc: dongxiao.xu@intel.com, Jan Kiszka <jan.kiszka@web.de>,
	jun.nakajima@intel.com, kvm@vger.kernel.org,
	kvm-owner@vger.kernel.org,
	"Nadav Har'El" <nyh@math.technion.ac.il>,
	owasserm@redhat.com
Subject: Re: [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs
Date: Sun, 14 Apr 2013 14:16:02 +0300	[thread overview]
Message-ID: <20130414111602.GL17919@redhat.com> (raw)
In-Reply-To: <OFCBC9D731.442AAB90-ONC2257B4D.003AB007-C2257B4D.003B7C4E@il.ibm.com>

On Sun, Apr 14, 2013 at 01:49:44PM +0300, Abel Gordon wrote:
> 
> 
> Gleb Natapov <gleb@redhat.com> wrote on 14/04/2013 01:34:52 PM:
> 
> > On Sun, Apr 14, 2013 at 12:27:10PM +0200, Jan Kiszka wrote:
> > > On 2013-04-14 12:07, Gleb Natapov wrote:
> > > > On Sun, Apr 14, 2013 at 01:00:10PM +0300, Gleb Natapov wrote:
> > > >> On Sun, Apr 14, 2013 at 12:51:34PM +0300, Abel Gordon wrote:
> > > >>>
> > > >>>
> > > >>> Gleb Natapov <gleb@redhat.com> wrote on 12/04/2013 01:48:04 PM:
> > > >>>
> > > >>>> On Fri, Apr 12, 2013 at 01:44:14PM +0300, Abel Gordon wrote:
> > > >>>>>
> > > >>>>> Ok, so then you prefer to add the inline functions to read/
> > write to the
> > > >>>>> vmcs12
> > > >>>>> fields, (to set the request bit if shadowed field changed) and
> you are
> > > >>> not
> > > >>>>> concerned
> > > >>>>> about any merge/rebase mess. I will work on this direction.
> > > >>>>> I'll first send an independent patch to introduce the accessors.
> Once
> > > >>> you
> > > >>>>> apply this patch, I'll continue and send you v2 patches for
> shadow
> > > >>> vmcs.
> > > >>>>>
> > > >>>>> Do you agree ?
> > > >>>> Yes.
> > > >>>
> > > >>> Looking again at the code it seems like we could avoid adding the
> > > >>> accessors.
> > > >>> We could just set a flag in nested_vmx_vmexit and
> > > >>> nested_vmx_entry_failure. Then, in vmx_vcpu_run we check/reset
> > the flag and
> > > >>> call copy_vmcs12_to_shadow (if required).
> > > >>>
> > > >>> What do you think ?
> > > >> Good idea! With accessors we can do further optimization by copying
> only
> > > >> things that changed, but it will be premature optimization at this
> > > >> point.
> > > >>
> > > > Actually this is good idea only if we know for sure that VMX
> emulation
> > > > changes vmcs12 only during guest entry/exit. Is this the case? I
> think
> > > > so.
> > >
> > > Some vmcs12 fields that are exposed to L1 are changed outside L2<->L1
> > > transitions. What comes to my mind: L0 emulates some change that L1
> does
> > > not trap, e.g. CRx accesses. Or what do you mean?
> > >
> > If vmcs12 is changed by L0 while L2 is running this is OK. If L0 changes
> > shadowed vmcs12 field while L1 is running this is not OK. So for
> > instance if field XXX is R/W but we allow only read to be shadowed then
> > write emulation in L0 has to sync new value back to shadow before going
> > back to L1.
> 
> Exactly.
> 
> While L1 runs (L1 root mode), L0 does NOT change VMCS12 (unless L1
> executes vmwrite).
> VMCS12 fields are changed once L1 launches/resumes L2 and there is a
> L2 exit.
> 
> L0 can change VMCS12 while it handles a L2 exit directly which is not
> forwarded to L1. But that's OK because L1 will eventually see the change
> once we switch to L1 due to other exit that L0 let L1 handle.
> 
> L0 should NOT change VMCS12 fields if L1 is running and L1 didn't
> execute any vmlaunch, vmresume or vmwrite instruction.
> 
The question is: is there a case like I described above when we shadow
only reads from R/W field and handle vmwrites in L0?

--
			Gleb.

  reply	other threads:[~2013-04-14 11:16 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 16:03 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1 Abel Gordon
2013-03-10 16:03 ` [PATCH 01/11] KVM: nVMX: Stats counters for nVMX Abel Gordon
2013-04-08 10:27   ` Gleb Natapov
2013-04-10 19:08     ` Abel Gordon
2013-04-11  6:10       ` Gleb Natapov
2013-03-10 16:04 ` [PATCH 02/11] KVM: nVMX: Shadow-vmcs control fields/bits Abel Gordon
2013-03-10 16:04 ` [PATCH 03/11] KVM: nVMX: Detect shadow-vmcs capability Abel Gordon
2013-04-08 11:12   ` Gleb Natapov
2013-04-10 19:14     ` Abel Gordon
2013-03-10 16:05 ` [PATCH 04/11] KVM: nVMX: Introduce vmread and vmwrite bitmaps Abel Gordon
2013-04-08 11:50   ` Gleb Natapov
2013-04-10 19:14     ` Abel Gordon
2013-03-10 16:05 ` [PATCH 05/11] KVM: nVMX: Refactor handle_vmwrite Abel Gordon
2013-04-09 11:05   ` Gleb Natapov
2013-04-10 20:35     ` Abel Gordon
2013-03-10 16:06 ` [PATCH 06/11] KVM: nVMX: Allocate shadow vmcs Abel Gordon
2013-03-10 16:06 ` [PATCH 07/11] KVM: nVMX: Release " Abel Gordon
2013-03-10 16:07 ` [PATCH 08/11] KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12 Abel Gordon
2013-03-10 16:07 ` [PATCH 09/11] KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcs Abel Gordon
2013-04-09 12:47   ` Gleb Natapov
2013-04-10 19:15     ` Abel Gordon
2013-03-10 16:08 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the " Abel Gordon
2013-03-10 22:43   ` Nadav Har'El
2013-03-11  7:54     ` Abel Gordon
2013-04-09 13:14       ` Gleb Natapov
2013-04-10 19:15         ` Abel Gordon
2013-04-11  6:54           ` Gleb Natapov
2013-04-12 10:26             ` Abel Gordon
2013-04-12 10:31               ` Gleb Natapov
2013-04-12 10:44                 ` Abel Gordon
2013-04-12 10:48                   ` Gleb Natapov
2013-04-14  9:51                     ` Abel Gordon
2013-04-14 10:00                       ` Gleb Natapov
2013-04-14 10:07                         ` Gleb Natapov
2013-04-14 10:27                           ` Jan Kiszka
2013-04-14 10:34                             ` Abel Gordon
2013-04-14 10:34                             ` Gleb Natapov
2013-04-14 10:49                               ` Abel Gordon
2013-04-14 11:16                                 ` Gleb Natapov [this message]
2013-04-14 13:47                                   ` Abel Gordon
2013-04-14 14:41                                     ` Gleb Natapov
2013-03-10 16:08 ` [PATCH 11/11] KVM: nVMX: Enable and disable shadow vmcs functionality Abel Gordon
2013-03-21 12:22 ` [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1 Orit Wasserman
2013-03-21 13:56   ` Abel Gordon
2013-04-18  8:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v4 Abel Gordon
2013-04-18  8:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon
2013-04-18 11:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v5 Abel Gordon
2013-04-18 11:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon

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=20130414111602.GL17919@redhat.com \
    --to=gleb@redhat.com \
    --cc=ABELG@il.ibm.com \
    --cc=dongxiao.xu@intel.com \
    --cc=jan.kiszka@web.de \
    --cc=jun.nakajima@intel.com \
    --cc=kvm-owner@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=nyh@math.technion.ac.il \
    --cc=owasserm@redhat.com \
    /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.