mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
KVM: x86: introduce cancel_hv_tscdeadline
Introduce cancel_hv_tscdeadline() to encapsulate preemption timer cancel stuff. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Yunhong Jiang <yunhong.jiang@intel.com> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9175d2e97b
commit
bd97ad0e7e
1 changed files with 10 additions and 8 deletions
|
@ -1349,14 +1349,19 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use);
|
EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use);
|
||||||
|
|
||||||
|
static void cancel_hv_tscdeadline(struct kvm_lapic *apic)
|
||||||
|
{
|
||||||
|
kvm_x86_ops->cancel_hv_timer(apic->vcpu);
|
||||||
|
apic->lapic_timer.hv_timer_in_use = false;
|
||||||
|
}
|
||||||
|
|
||||||
void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
|
void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
struct kvm_lapic *apic = vcpu->arch.apic;
|
struct kvm_lapic *apic = vcpu->arch.apic;
|
||||||
|
|
||||||
WARN_ON(!apic->lapic_timer.hv_timer_in_use);
|
WARN_ON(!apic->lapic_timer.hv_timer_in_use);
|
||||||
WARN_ON(swait_active(&vcpu->wq));
|
WARN_ON(swait_active(&vcpu->wq));
|
||||||
kvm_x86_ops->cancel_hv_timer(vcpu);
|
cancel_hv_tscdeadline(apic);
|
||||||
apic->lapic_timer.hv_timer_in_use = false;
|
|
||||||
apic_timer_expired(apic);
|
apic_timer_expired(apic);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer);
|
EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer);
|
||||||
|
@ -1376,10 +1381,8 @@ void kvm_lapic_switch_to_hv_timer(struct kvm_vcpu *vcpu)
|
||||||
hrtimer_cancel(&apic->lapic_timer.timer);
|
hrtimer_cancel(&apic->lapic_timer.timer);
|
||||||
|
|
||||||
/* In case the sw timer triggered in the window */
|
/* In case the sw timer triggered in the window */
|
||||||
if (atomic_read(&apic->lapic_timer.pending)) {
|
if (atomic_read(&apic->lapic_timer.pending))
|
||||||
apic->lapic_timer.hv_timer_in_use = false;
|
cancel_hv_tscdeadline(apic);
|
||||||
kvm_x86_ops->cancel_hv_timer(apic->vcpu);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
trace_kvm_hv_timer_state(vcpu->vcpu_id,
|
trace_kvm_hv_timer_state(vcpu->vcpu_id,
|
||||||
apic->lapic_timer.hv_timer_in_use);
|
apic->lapic_timer.hv_timer_in_use);
|
||||||
|
@ -1395,8 +1398,7 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu)
|
||||||
if (!apic->lapic_timer.hv_timer_in_use)
|
if (!apic->lapic_timer.hv_timer_in_use)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kvm_x86_ops->cancel_hv_timer(vcpu);
|
cancel_hv_tscdeadline(apic);
|
||||||
apic->lapic_timer.hv_timer_in_use = false;
|
|
||||||
|
|
||||||
if (atomic_read(&apic->lapic_timer.pending))
|
if (atomic_read(&apic->lapic_timer.pending))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue