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


Groups > linux.kernel > #1492550

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

From Paolo Bonzini <pbonzini@redhat.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-7@gated-at.bofh.it> (permalink)
References <sm86R-6hq-5@gated-at.bofh.it> <sm86S-6hq-37@gated-at.bofh.it> <sm9FD-7lr-11@gated-at.bofh.it> <smipz-4jE-5@gated-at.bofh.it> <smlx8-66C-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 28/09/2016 13:40, Wu, Feng wrote:
> IIUIC, the issue you describe above is that IPI for posted-interrupts may be
> issued between
> 
> vcpu->mode = IN_GUEST_MODE;
> 
> and
> 
> local_irq_disable();
> 
> But if that really happens, we will call kvm_vcpu_kick() in
> vmx_deliver_posted_interrupt(), hence the vcpu->mode will be changed
> to EXITING_GUEST_MODE, then we will goto cancel_injection in
> vcpu_enter_guest, so the posted-interrupt will be delivered to guest
> in the next vmentry. Seems I cannot see the problem. Do I miss something?

No, if that happens kvm_trigger_posted_interrupt returns true, hence
kvm_vcpu_kick is not called.  With the fix, the IPI is processed as soon
as the guest enters non-root mode, and the interrupt is injected.


The other issue occurs when the IPI is sent between

                        kvm_x86_ops->hwapic_irr_update(vcpu,
                                kvm_lapic_find_highest_irr(vcpu));

and

	vcpu->mode = IN_GUEST_MODE;

In this case, kvm_vcpu_kick is called but it (correctly) doesn't do
anything because it sees vcpu->mode == OUTSIDE_GUEST_MODE.  Then the
guest is entered with PIR.ON, but the PI interrupt is not pending and
hence the interrupt is never delivered to the guest.  The fix for this
is to move the RVI update after IN_GUEST_MODE.  Then the source CPU uses
the posted interrupt IPI instead of kvm_cpu_kick, and everything works.

Paolo

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