]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: VMX: Use x2apic_mode to avoid RDMSR when querying PI state
authorSean Christopherson <seanjc@google.com>
Fri, 15 Jan 2021 22:03:54 +0000 (14:03 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Feb 2021 10:27:22 +0000 (05:27 -0500)
Use x2apic_mode instead of x2apic_enabled() when adjusting the
destination ID during Posted Interrupt updates.  This avoids the costly
RDMSR that is hidden behind x2apic_enabled().

Reported-by: luferry <luferry@163.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210115220354.434807-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/posted_intr.c

index f02962dcc72cb34ac274030d1aaeafe11dcffca6..4831bc44ce66fc0e4773f74f4a213a7e48b8be01 100644 (file)
@@ -54,7 +54,7 @@ void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu)
 
                dest = cpu_physical_id(cpu);
 
-               if (x2apic_enabled())
+               if (x2apic_mode)
                        new.ndst = dest;
                else
                        new.ndst = (dest << 8) & 0xFF00;
@@ -104,7 +104,7 @@ static void __pi_post_block(struct kvm_vcpu *vcpu)
 
                dest = cpu_physical_id(vcpu->cpu);
 
-               if (x2apic_enabled())
+               if (x2apic_mode)
                        new.ndst = dest;
                else
                        new.ndst = (dest << 8) & 0xFF00;
@@ -174,7 +174,7 @@ int pi_pre_block(struct kvm_vcpu *vcpu)
                 */
                dest = cpu_physical_id(vcpu->pre_pcpu);
 
-               if (x2apic_enabled())
+               if (x2apic_mode)
                        new.ndst = dest;
                else
                        new.ndst = (dest << 8) & 0xFF00;