2019-07-05 09:59:06

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH] KVM: LAPIC: Reset timer_advance_ns to 1000 after adaptive tuning goes insane

From: Wanpeng Li <[email protected]>

Reset timer_advance_ns to the default value 1000ns after adaptive tuning
goes insane which can happen sporadically in product environment.

Cc: Paolo Bonzini <[email protected]>
Cc: Radim Krčmář <[email protected]>
Signed-off-by: Wanpeng Li <[email protected]>
---
arch/x86/kvm/lapic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 05d8934..454d3dd 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1549,7 +1549,7 @@ static inline void adjust_lapic_timer_advance(struct kvm_vcpu *vcpu,
if (abs(advance_expire_delta) < LAPIC_TIMER_ADVANCE_ADJUST_DONE)
apic->lapic_timer.timer_advance_adjust_done = true;
if (unlikely(timer_advance_ns > 5000)) {
- timer_advance_ns = 0;
+ timer_advance_ns = 1000;
apic->lapic_timer.timer_advance_adjust_done = true;
}
apic->lapic_timer.timer_advance_ns = timer_advance_ns;
--
2.7.4


2019-07-05 09:59:34

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH] KVM: LAPIC: Reset timer_advance_ns to 1000 after adaptive tuning goes insane

On 05/07/19 11:40, Wanpeng Li wrote:
> From: Wanpeng Li <[email protected]>
>
> Reset timer_advance_ns to the default value 1000ns after adaptive tuning
> goes insane which can happen sporadically in product environment.
>
> Cc: Paolo Bonzini <[email protected]>
> Cc: Radim Krčmář <[email protected]>
> Signed-off-by: Wanpeng Li <[email protected]>
> ---
> arch/x86/kvm/lapic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 05d8934..454d3dd 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1549,7 +1549,7 @@ static inline void adjust_lapic_timer_advance(struct kvm_vcpu *vcpu,
> if (abs(advance_expire_delta) < LAPIC_TIMER_ADVANCE_ADJUST_DONE)
> apic->lapic_timer.timer_advance_adjust_done = true;
> if (unlikely(timer_advance_ns > 5000)) {
> - timer_advance_ns = 0;
> + timer_advance_ns = 1000;
> apic->lapic_timer.timer_advance_adjust_done = true;

Do you also want to reset timer_advance_adjust_done to false?

Paolo

> }
> apic->lapic_timer.timer_advance_ns = timer_advance_ns;
>