Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1492552

RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv interrupt injection

From "Wu, Feng" <feng.wu@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv interrupt injection
Date 2016-09-28 14:00 +0200
Message-ID <smlGN-69R-3@gated-at.bofh.it> (permalink)
References <sm86R-6hq-5@gated-at.bofh.it> <sm86S-6hq-37@gated-at.bofh.it> <smjYl-5lD-3@gated-at.bofh.it> <smk82-5oX-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Wednesday, September 28, 2016 6:17 PM
> To: Wu, Feng <feng.wu@intel.com>; linux-kernel@vger.kernel.org;
> kvm@vger.kernel.org
> Cc: yang.zhang.wz@gmail.com; mst@redhat.com; rkrcmar@redhat.com
> Subject: Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv
> interrupt injection
> 
> 
> 
> On 28/09/2016 12:04, Wu, Feng wrote:
> >
> >
> >> -----Original Message-----
> >> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> >> Bonzini
> >> Sent: Wednesday, September 28, 2016 5:20 AM
> >> To: linux-kernel@vger.kernel.org; kvm@vger.kernel.org
> >> Cc: yang.zhang.wz@gmail.com; Wu, Feng <feng.wu@intel.com>;
> >> mst@redhat.com; rkrcmar@redhat.com
> >> Subject: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv
> interrupt
> >> injection
> >>
> >> Since bf9f6ac8d749 ("KVM: Update Posted-Interrupts Descriptor when vCPU
> >> is blocked", 2015-09-18) the posted interrupt descriptor is checked
> >> unconditionally for PIR.ON.  Therefore we don't need KVM_REQ_EVENT to
> >> trigger the scan and, if NMIs or SMIs are not involved, we can avoid
> >> the complicated event injection path.
> >
> > But the following code still remains in the KVM_REQ_EVENT checking part:
> >
> > if (kvm_lapic_enabled(vcpu)) {
> > 	update_cr8_intercept(vcpu);
> > 	kvm_lapic_sync_to_vapic(vcpu);
> > }
> >
> > Does this matter?
> 
> Good question, but it doesn't matter for APICv because:
> 
> - update_cr8_intercept is disabled if APICv, see vmx.c:
> 
>         if (enable_apicv)
>                 kvm_x86_ops->update_cr8_intercept = NULL;

Which tree are you using, I am using linux kernel tree with Linux 4.8-rc7,
and I only see the following code in vmx.c

if(!cpu_has_vmx_tpr_shadow())
	kvm_x86_ops->update_cr8_intercept = NULL;

> 
> - kvm_lapic_sync_to_vapic's call to apic_sync_pv_eoi_to_guest is also
> disabled if APICv:
> 
>         if (!pv_eoi_enabled(vcpu) ||
>             apic->irr_pending ||
>             apic->highest_isr_cache == -1 ||
>             kvm_ioapic_handles_vector(apic, apic->highest_isr_cache))
>                 return;
> 
> (highest_isr_cache is always -1 for APICv)
> 
> - The TPR/ISR/IRR shadow that kvm_lapic_sync_to_vapic writes is only
> read by the  paravirtualized TPR access code in the vAPIC ROM
> (pc-bios/optionrom/kvmvapic.S in the QEMU tree). That code never runs if
> you don't get TPR access vmexits, and indeed TPR access vmexits never
> happen if KVM uses APICv (or even only the old-style TPR shadowing).

Good to know this, thanks for sharing!

Thanks,
Feng

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/3] kvm: x86: speedups for APICv Paolo Bonzini <pbonzini@redhat.com> - 2016-09-27 23:30 +0200
  [PATCH 3/3] KVM: x86: do not scan IRR twice on APICv vmentry Paolo Bonzini <pbonzini@redhat.com> - 2016-09-27 23:30 +0200
    Re: [PATCH 3/3] KVM: x86: do not scan IRR twice on APICv vmentry "Michael S. Tsirkin" <mst@redhat.com> - 2016-09-28 16:10 +0200
      Re: [PATCH 3/3] KVM: x86: do not scan IRR twice on APICv vmentry Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 16:50 +0200
    RE: [PATCH 3/3] KVM: x86: do not scan IRR twice on APICv vmentry "Wu, Feng" <feng.wu@intel.com> - 2016-09-29 05:00 +0200
  [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-27 23:30 +0200
    Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Michael S. Tsirkin" <mst@redhat.com> - 2016-09-28 01:10 +0200
      Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 10:30 +0200
        RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Wu, Feng" <feng.wu@intel.com> - 2016-09-28 13:50 +0200
          Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 14:00 +0200
            RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Wu, Feng" <feng.wu@intel.com> - 2016-09-28 14:10 +0200
              Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 14:20 +0200
        Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Michael S. Tsirkin" <mst@redhat.com> - 2016-09-28 15:50 +0200
          Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 16:10 +0200
    RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Wu, Feng" <feng.wu@intel.com> - 2016-09-28 12:10 +0200
      Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 12:20 +0200
        Re: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection Paolo Bonzini <pbonzini@redhat.com> - 2016-09-28 14:00 +0200
          RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Wu, Feng" <feng.wu@intel.com> - 2016-09-28 14:10 +0200
        RE: [PATCH 2/3] kvm: x86: do not use KVM_REQ_EVENT for APICv  interrupt injection "Wu, Feng" <feng.wu@intel.com> - 2016-09-28 14:00 +0200
  Re: [RFC PATCH 0/3] kvm: x86: speedups for APICv Radim Krčmář <rkrcmar@redhat.com> - 2016-09-29 22:00 +0200
    Re: [RFC PATCH 0/3] kvm: x86: speedups for APICv Paolo Bonzini <pbonzini@redhat.com> - 2016-09-29 23:50 +0200
      Re: [RFC PATCH 0/3] kvm: x86: speedups for APICv Radim Krčmář <rkrcmar@redhat.com> - 2016-09-30 15:30 +0200
      Re: [RFC PATCH 0/3] kvm: x86: speedups for APICv Radim Krčmář <rkrcmar@redhat.com> - 2016-09-30 15:40 +0200

csiph-web