The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: Wanpeng Li <kernellwp@gmail.com>, kvm <kvm@vger.kernel.org>,
	Radim Krcmar <rkrcmar@redhat.com>,
	Yunhong Jiang <yunhong.jiang@intel.com>,
	Wanpeng Li <wanpeng.li@hotmail.com>,
	linux-kernel@vger.kernel.org, Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running
Date: Wed, 6 Jul 2016 04:14:57 -0400 (EDT)	[thread overview]
Message-ID: <1071146205.4257957.1467792897523.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160706080901.ywlvgksrhpdyspmv@hz-desktop>

> On 07/06/16 16:01, Haozhong Zhang wrote:
> > On 07/06/16 09:46, Paolo Bonzini wrote:
> > > On 06/07/2016 08:05, Haozhong Zhang wrote:
> > > >> > Nested preemption timer is emulated by hrtimer, so it doesn't
> > > >> > influence vmcs02, why this is needed?
> > > > Nested (L2) preemption timer is not affected for sure, and this patch
> > > > is to fix another problem caused by using L1 preemption timer for L1
> > > > TSC deadline timer. When we use L1 VMX preemption timer for L1 TSC
> > > > deadline timer, we intend to use the pin-based exec config and the VMX
> > > > preemption timer value in vmcs01. However, when L2 guest is running,
> > > > vmcs02 is loaded as the current VMCS so that a different VMX
> > > > preemption timer config is used (i.e. VMX preemption timer is disabled
> > > > in prepare_vmcs02()). If we still use preemption timer for L1 TSC
> > > > deadline timer at this moment, then L1 TSC deadline timer will not be
> > > > able to be triggered when L2 guest is running.
> > > 
> > > The right fix then is to set the pin-based controls in prepare_vmcs02,
> > > based on vcpu->arch.hv_deadline_tsc.
> > 
> > Then KVM needs to distinguish L1 and L2 VMEXITs for preemption timer
> > (or does KVM already have this?). The current implementation which
> > uses a separate hrtimer for L2 preemption timer can easily distinguish
> > them.
> 
> And L1 hypervisor may also want to use preemption timer for L2
> guest. In this case, L0 KVM can not reuse preemption timer for both L1
> and L2.

The vmcs12's preemption timer is emulated by KVM through a separate hrtimer,
so KVM would only use the vmcs02 preemption timer for the L1 APIC timer.

Paolo

  reply	other threads:[~2016-07-06  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  5:10 [PATCH] KVM: VMX: switch to hrtimer for TSC deadline timer when L2 guest is running Haozhong Zhang
2016-07-06  5:37 ` Wanpeng Li
2016-07-06  6:04   ` Paolo Bonzini
2016-07-06  6:05   ` Haozhong Zhang
2016-07-06  7:46     ` Paolo Bonzini
2016-07-06  8:01       ` Haozhong Zhang
2016-07-06  8:09         ` Haozhong Zhang
2016-07-06  8:14           ` Paolo Bonzini [this message]
2016-07-06  8:21             ` Haozhong Zhang

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=1071146205.4257957.1467792897523.JavaMail.zimbra@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=wanpeng.li@hotmail.com \
    --cc=yunhong.jiang@intel.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