kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: Arthur Chunqi Li <yzt356@gmail.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"jan.kiszka@web.de" <jan.kiszka@web.de>,
	"gleb@redhat.com" <gleb@redhat.com>
Subject: Re: [PATCH v3] KVM: nVMX: Fully support of nested VMX preemption timer
Date: Fri, 13 Sep 2013 13:58:49 +0200	[thread overview]
Message-ID: <5232FDF9.1000605@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E0A8F7C1E@SHSMSX104.ccr.corp.intel.com>

Il 05/09/2013 11:24, Zhang, Yang Z ha scritto:
> > Here I have such consideration: this logic is wrong if CPU support
> > PIN_BASED_VMX_PREEMPTION_TIMER but doesn't support
> > VM_EXIT_SAVE_VMX_PREEMPTION_TIMER, though I don't know if this does
> > occurs. So the codes above reads the MSR and reserves the features it
> > supports, and here I just check if these two features are supported
> > simultaneously.
> 
> No. Only VM_EXIT_SAVE_VMX_PREEMPTION_TIMER depends on
> PIN_BASED_VMX_PREEMPTION_TIMER. PIN_BASED_VMX_PREEMPTION_TIMER is an
> independent feature

Not for the current implementation of the preemption timer in nested VMX.

In order to emulate PIN_BASED_VMX_PREEMPTION_TIMER, you need to
decrement the preemption timer in vmcs02 whenever you have an L2->L0->L2
exit.  The current implementation chooses to use
VM_EXIT_SAVE_VMX_PREEMPTION_TIMER to do this decrement.

It is possible to not use it.  As the Intel SDM says (31.13), "the VMM
may use another timer (e.g. the TSC) to track the amount of time the VM
has run while still using the VMX-preemption timer for VM preemption. In
this scenario the VMM would not save the VMX-preemption timer on each
VM-exit but instead would reload the VMX-preemption timer with initial
VM quantum less the time the VM has already run. This scenario includes
all the VM-entry and VM-exit latencies in the VM run time".  In fact,
perhaps it's even a better choice, but for Arthur's code it is correct
to depend on VM_EXIT_SAVE_VMX_PREEMPTION_TIMER.

Paolo

      parent reply	other threads:[~2013-09-13 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 15:22 [PATCH v3] KVM: nVMX: Fully support of nested VMX preemption timer Arthur Chunqi Li
2013-09-05  7:45 ` Zhang, Yang Z
2013-09-05  8:47   ` Arthur Chunqi Li
2013-09-05  9:24     ` Zhang, Yang Z
2013-09-05  9:50       ` Arthur Chunqi Li
2013-09-05 11:05         ` Zhang, Yang Z
2013-09-05 14:19           ` Arthur Chunqi Li
2013-09-13 11:58       ` Paolo Bonzini [this message]

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=5232FDF9.1000605@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=yang.z.zhang@intel.com \
    --cc=yzt356@gmail.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 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).