Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1438555
| From | Wanpeng Li <kernellwp@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it |
| Date | 2016-07-07 14:20 +0200 |
| Message-ID | <rSgrE-6LS-41@gated-at.bofh.it> (permalink) |
| References | <rSgrD-6LS-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Wanpeng Li <wanpeng.li@hotmail.com>
We will go to vcpu_run() loop after L0 emulates VMRESUME which maybe
incur kvm_sched_out and kvm_sched_in operations since cond_resched()
will be called once need resched. Preemption timer will be reprogrammed
if vCPU is scheduled to a different pCPU. Then the preemption timer
bit of vmcs02 will be set if L0 enable preemption timer to run L1 even
if L1 doesn't enable preemption timer to run L2.
This patch fix it by don't reprogram preemption timer of vmcs02 if L1's
vCPU is scheduled on diffent pCPU when we are in the way to vmresume
nested guest, and fallback to hrtimer based emulated method.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Yunhong Jiang <yunhong.jiang@intel.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Haozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
v3 -> v4:
* fallback to hrtimer based emulated method when in the way to vmresume nested guest
arch/x86/kvm/x86.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0cc6cf8..05137c0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2743,8 +2743,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
mark_tsc_unstable("KVM discovered backwards TSC");
if (kvm_lapic_hv_timer_in_use(vcpu) &&
+ (is_guest_mode(vcpu) ||
kvm_x86_ops->set_hv_timer(vcpu,
- kvm_get_lapic_tscdeadline_msr(vcpu)))
+ kvm_get_lapic_tscdeadline_msr(vcpu))))
kvm_lapic_switch_to_sw_timer(vcpu);
if (check_tsc_unstable()) {
u64 offset = kvm_compute_tsc_offset(vcpu,
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest Wanpeng Li <kernellwp@gmail.com> - 2016-07-07 14:20 +0200
[PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-07 14:20 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Paolo Bonzini <pbonzini@redhat.com> - 2016-07-07 14:40 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-07 15:30 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Paolo Bonzini <pbonzini@redhat.com> - 2016-07-07 16:40 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-08 02:40 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Paolo Bonzini <pbonzini@redhat.com> - 2016-07-08 12:20 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-08 16:00 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-08 16:10 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Paolo Bonzini <pbonzini@redhat.com> - 2016-07-08 17:50 +0200
Re: [PATCH v4 2/2] KVM: nVMX: Fix preemption timer bit set in vmcs02 even if L1 doesn't enable it Wanpeng Li <kernellwp@gmail.com> - 2016-07-09 01:00 +0200
Re: [PATCH v4 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest Paolo Bonzini <pbonzini@redhat.com> - 2016-07-07 14:40 +0200
Re: [PATCH v4 1/2] KVM: nVMX: Fix incorrect preemption timer vmexit in nested guest yunhong jiang <yunhong.jiang@linux.intel.com> - 2016-07-08 00:20 +0200
csiph-web