Skip to content

Commit 66e3cf7

Browse files
dwmw2sean-jc
authored andcommitted
KVM: x86/xen: remove WARN_ON_ONCE() with false positives in evtchn delivery
The kvm_xen_inject_vcpu_vector() function has a comment saying "the fast version will always work for physical unicast", justifying its use of kvm_irq_delivery_to_apic_fast() and the WARN_ON_ONCE() when that fails. In fact that assumption isn't true if X2APIC isn't in use by the guest and there is (8-bit x)APIC ID aliasing. A single "unicast" destination APIC ID *may* then be delivered to multiple vCPUs. Remove the warning, and in fact it might as well just call kvm_irq_delivery_to_apic(). Reported-by: Michal Luczaj <mhal@rbox.co> Fixes: fde0451 ("KVM: x86/xen: Support per-vCPU event channel upcall via local APIC") Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org> Link: https://lore.kernel.org/r/20240227115648.3104-4-dwmw2@infradead.org Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 8e62bf2 commit 66e3cf7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/x86/kvm/xen.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "x86.h"
1111
#include "xen.h"
1212
#include "hyperv.h"
13-
#include "lapic.h"
13+
#include "irq.h"
1414

1515
#include <linux/eventfd.h>
1616
#include <linux/kvm_host.h>
@@ -570,7 +570,6 @@ void kvm_xen_update_runstate(struct kvm_vcpu *v, int state)
570570
void kvm_xen_inject_vcpu_vector(struct kvm_vcpu *v)
571571
{
572572
struct kvm_lapic_irq irq = { };
573-
int r;
574573

575574
irq.dest_id = v->vcpu_id;
576575
irq.vector = v->arch.xen.upcall_vector;
@@ -579,8 +578,7 @@ void kvm_xen_inject_vcpu_vector(struct kvm_vcpu *v)
579578
irq.delivery_mode = APIC_DM_FIXED;
580579
irq.level = 1;
581580

582-
/* The fast version will always work for physical unicast */
583-
WARN_ON_ONCE(!kvm_irq_delivery_to_apic_fast(v->kvm, NULL, &irq, &r, NULL));
581+
kvm_irq_delivery_to_apic(v->kvm, NULL, &irq, NULL);
584582
}
585583

586584
/*

0 commit comments

Comments
 (0)