Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433686 > unrolled thread
| Started by | Wanpeng Li <kernellwp@gmail.com> |
|---|---|
| First post | 2016-06-29 13:30 +0200 |
| Last post | 2016-06-29 18:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 1/2] KVM: x86: introduce cancel_hv_tscdeadline Wanpeng Li <kernellwp@gmail.com> - 2016-06-29 13:30 +0200
Re: [PATCH v2 1/2] KVM: x86: introduce cancel_hv_tscdeadline yunhong jiang <yunhong.jiang@linux.intel.com> - 2016-06-29 18:50 +0200
| From | Wanpeng Li <kernellwp@gmail.com> |
|---|---|
| Date | 2016-06-29 13:30 +0200 |
| Subject | [PATCH v2 1/2] KVM: x86: introduce cancel_hv_tscdeadline |
| Message-ID | <rPlQR-3z0-9@gated-at.bofh.it> |
From: Wanpeng Li <wanpeng.li@hotmail.com>
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>
---
arch/x86/kvm/lapic.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index fdc05ae..9c20ac1 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1349,14 +1349,19 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
}
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)
{
struct kvm_lapic *apic = vcpu->arch.apic;
WARN_ON(!apic->lapic_timer.hv_timer_in_use);
WARN_ON(swait_active(&vcpu->wq));
- kvm_x86_ops->cancel_hv_timer(vcpu);
- apic->lapic_timer.hv_timer_in_use = false;
+ cancel_hv_tscdeadline(apic);
apic_timer_expired(apic);
}
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);
/* In case the sw timer triggered in the window */
- if (atomic_read(&apic->lapic_timer.pending)) {
- apic->lapic_timer.hv_timer_in_use = false;
- kvm_x86_ops->cancel_hv_timer(apic->vcpu);
- }
+ if (atomic_read(&apic->lapic_timer.pending))
+ cancel_hv_tscdeadline(apic);
}
trace_kvm_hv_timer_state(vcpu->vcpu_id,
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)
return;
- kvm_x86_ops->cancel_hv_timer(vcpu);
- apic->lapic_timer.hv_timer_in_use = false;
+ cancel_hv_tscdeadline(apic);
if (atomic_read(&apic->lapic_timer.pending))
return;
--
1.9.1
[toc] | [next] | [standalone]
| From | yunhong jiang <yunhong.jiang@linux.intel.com> |
|---|---|
| Date | 2016-06-29 18:50 +0200 |
| Message-ID | <rPqQy-6AE-29@gated-at.bofh.it> |
| In reply to | #1433686 |
On Wed, 29 Jun 2016 19:23:56 +0800
Wanpeng Li <kernellwp@gmail.com> wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> 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>
It's ok for me, thanks for the patch, Wanpeng.
--jyh
> ---
> arch/x86/kvm/lapic.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index fdc05ae..9c20ac1 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1349,14 +1349,19 @@ bool kvm_lapic_hv_timer_in_use(struct
> kvm_vcpu *vcpu) }
> 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)
> {
> struct kvm_lapic *apic = vcpu->arch.apic;
>
> WARN_ON(!apic->lapic_timer.hv_timer_in_use);
> WARN_ON(swait_active(&vcpu->wq));
> - kvm_x86_ops->cancel_hv_timer(vcpu);
> - apic->lapic_timer.hv_timer_in_use = false;
> + cancel_hv_tscdeadline(apic);
> apic_timer_expired(apic);
> }
> 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);
>
> /* In case the sw timer triggered in the
> window */
> - if (atomic_read(&apic->lapic_timer.pending))
> {
> - apic->lapic_timer.hv_timer_in_use =
> false;
> -
> kvm_x86_ops->cancel_hv_timer(apic->vcpu);
> - }
> + if (atomic_read(&apic->lapic_timer.pending))
> + cancel_hv_tscdeadline(apic);
> }
> trace_kvm_hv_timer_state(vcpu->vcpu_id,
> 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)
> return;
>
> - kvm_x86_ops->cancel_hv_timer(vcpu);
> - apic->lapic_timer.hv_timer_in_use = false;
> + cancel_hv_tscdeadline(apic);
>
> if (atomic_read(&apic->lapic_timer.pending))
> return;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web