KVM: LAPIC: Return 0 when getting the tscdeadline timer if the lapic is hw disabled
PATCH 1/2 KVM: LAPIC: Return 0 when getting the tscdeadline timer if the lapic is hw disabled
From: Wanpeng Li <[email protected]>
Return 0 when getting the tscdeadline timer if the lapic is hw disabled
--- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/lapic.c +1 -1
@@ -2182,7 +2182,7 @@ u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) {struct kvm_lapic *apic = vcpu->arch.apic; -if (!lapic_in_kernel (vcpu) || +if (!kvm_apic_present (vcpu) || !apic_lvtt_tscdeadline (apic))return 0 ;
Signature · 1 line
2.7.4
PATCH 2/2 KVM: LAPIC: Guarantee the timer is in tsc-deadline mode when setting
From: Wanpeng Li <[email protected]>
Check apic_lvtt_tscdeadline() mode directly instead of apic_lvtt_oneshot() and apic_lvtt_period() to guarantee the timer is in tsc-deadline mode when wrmsr MSR_IA32_TSCDEADLINE.
--- arch/x86/kvm/lapic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/lapic.c +2 -2
@@ -2193,8 +2193,8 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) {struct kvm_lapic *apic = vcpu->arch.apic; -if (!kvm_apic_present (vcpu) ||apic_lvtt_oneshot (apic) || -apic_lvtt_period (apic)) +if (!kvm_apic_present (vcpu) || + !apic_lvtt_tscdeadline (apic))return ;hrtimer_cancel (&apic->lapic_timer.timer);
Signature · 1 line
2.7.4
Re: [PATCH 2/2] KVM: LAPIC: Guarantee the timer is in tsc-deadline mode when setting
Quoted 16 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Check
apic_lvtt_tscdeadline()mode directly instead ofapic_lvtt_oneshot()andapic_lvtt_period()to guarantee the timer is in tsc-deadline mode when wrmsrMSR_IA32_TSCDEADLINE.Signed-off-by Wanpeng Li <[email protected]>--- arch/x86/kvm/lapic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/lapic.c +0
-0
arch/x86/kvm/lapic.c void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) · line 2197
Quoted 7 lines
arch/x86/kvm/lapic.c +2
-2@@ -2193,8 +2193,8 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) {struct kvm_lapic *apic = vcpu->arch.apic; -if (!kvm_apic_present (vcpu) ||apic_lvtt_oneshot (apic) || -apic_lvtt_period (apic)) +if (!kvm_apic_present (vcpu) || + !apic_lvtt_tscdeadline (apic))
Definitely prefer to fix the indentation here since both lines are touched anyways.
Quoted 6 lines
arch/x86/kvm/lapic.c +0
-0return ;hrtimer_cancel (&apic->lapic_timer.timer);Signature · 1 line
2.7.4
Quoted 15 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Return 0 when getting the tscdeadline timer if the lapic is hw disabled
Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wanpeng Li <[email protected]>--- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/lapic.c +0
-0
arch/x86/kvm/lapic.c u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) · line 2186
Quoted 6 lines
arch/x86/kvm/lapic.c +1
-1@@ -2182,7 +2182,7 @@ u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) {struct kvm_lapic *apic = vcpu->arch.apic; -if (!lapic_in_kernel (vcpu) || +if (!kvm_apic_present (vcpu) || !apic_lvtt_tscdeadline (apic))
Paolo, want want to fix up the indentation when applying?
if (!kvm_apic_present(vcpu) || !apic_lvtt_tscdeadline(apic)
Quoted 5 lines
arch/x86/kvm/lapic.c +0
-0return 0 ;Signature · 1 line
2.7.4
Quoted 20 lines · Sean Christopherson
Quoted 18 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
Return 0 when getting the tscdeadline timer if the lapic is hw disabled
Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wanpeng Li <[email protected]>--- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/kvm/lapic.c +0
-0@@ -2182,7 +2182,7 @@ u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) {struct kvm_lapic *apic = vcpu->arch.apic;
Quoted 7 lines
arch/x86/kvm/lapic.c u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) · line 2186
Quoted 3 lines
arch/x86/kvm/lapic.c +1
-1-if (!lapic_in_kernel (vcpu) || +if (!kvm_apic_present (vcpu) || !apic_lvtt_tscdeadline (apic))Paolo, want want to fix up the indentation when applying?
if (!kvm_apic_present(vcpu) || !apic_lvtt_tscdeadline(apic)
Agreed, Paolo do you need I send another version or you can fix up when applying?
Wanpeng