Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-03 Thread Wanpeng Li
2017-07-03 16:16 GMT+08:00 Paolo Bonzini : > > > On 03/07/2017 10:08, Wanpeng Li wrote: >>> Yeah, I'm not entirely satisfied with it but it's working: start_sw >>> timer will see ktimer->pending and do nothing. >>> >>> But thinking more about it, maybe the "if (r)" can be omitted >>> completely? W

Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-03 Thread Paolo Bonzini
On 03/07/2017 10:08, Wanpeng Li wrote: >> Yeah, I'm not entirely satisfied with it but it's working: start_sw >> timer will see ktimer->pending and do nothing. >> >> But thinking more about it, maybe the "if (r)" can be omitted >> completely? We need to benchmark it but it can be done. > "if (r)

Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-03 Thread Wanpeng Li
2017-07-03 15:30 GMT+08:00 Paolo Bonzini : > > > On 02/07/2017 03:56, Wanpeng Li wrote: - if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending)) + if (!apic_lvtt_period(apic) && (r || atomic_read(&ktimer->pending))) { + if (r) +

Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-03 Thread Paolo Bonzini
On 02/07/2017 03:56, Wanpeng Li wrote: >>> - if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending)) >>> + if (!apic_lvtt_period(apic) && (r || >>> atomic_read(&ktimer->pending))) { >>> + if (r) >>> + apic_timer_expired(apic); >>>

Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-01 Thread Wanpeng Li
2017-07-02 9:35 GMT+08:00 Wanpeng Li : > 2017-06-30 0:58 GMT+08:00 Paolo Bonzini : >> From: Wanpeng Li >> >> If the TSC deadline timer is programmed really close to the deadline or >> even in the past, the computation in vmx_set_hv_timer will program the >> absolute target tsc value to vmcs preemp

Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-07-01 Thread Wanpeng Li
2017-06-30 0:58 GMT+08:00 Paolo Bonzini : > From: Wanpeng Li > > If the TSC deadline timer is programmed really close to the deadline or > even in the past, the computation in vmx_set_hv_timer will program the > absolute target tsc value to vmcs preemption timer field w/ delta == 0. > The next vme

[PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay

2017-06-29 Thread Paolo Bonzini
From: Wanpeng Li If the TSC deadline timer is programmed really close to the deadline or even in the past, the computation in vmx_set_hv_timer will program the absolute target tsc value to vmcs preemption timer field w/ delta == 0. The next vmentry results in an immediate vmx preemption timer vme