Re: [PATCH v2 2/2] KVM: arm64: vgic-its: Remove the pending state of a discarded LPI

From: Fuad Tabba

Date: Sat Oct 17 2026 - 03:47:44 EST


Hi Marc,

In case it saves you writing it, this is what I tested on top of v2
and your series:

diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index d24c391e0aae2..37059d1338406 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -834,25 +834,34 @@ static int vgic_its_cmd_handle_discard(struct kvm *kvm, struct vgic_its *its,
int ite_esz = vgic_its_get_abi(its)->ite_esz;
gpa_t gpa = device->itt_addr + ite->event_id * ite_esz;
struct vgic_irq *irq = ite->irq;
- bool queued;
+ struct kvm_vcpu *vcpu, *target;

vgic_its_invalidate_cache(its);

/*
- * A queued LPI can be pending in a running vCPU's list register,
- * which the exit path folds back: halt the guest before clearing.
+ * Only an LPI on a vCPU's AP list can be in its list registers,
+ * which the exit path folds back, and that exit moves the LPI
+ * to its target vCPU if the target has changed: pause both.
*/
- scoped_guard(raw_spinlock_irqsave, &irq->irq_lock)
- queued = irq->vcpu;
+ scoped_guard(raw_spinlock_irqsave, &irq->irq_lock) {
+ vcpu = irq->vcpu;
+ target = irq->target_vcpu;
+ }

- if (queued)
- kvm_arm_halt_guest(kvm);
+ if (vcpu) {
+ if (target != vcpu)
+ kvm_pause_vcpu(target);
+ kvm_pause_vcpu(vcpu);
+ }

scoped_guard(raw_spinlock_irqsave, &irq->irq_lock)
irq->pending_latch = false;

- if (queued)
- kvm_arm_resume_guest(kvm);
+ if (vcpu) {
+ kvm_resume_vcpu(vcpu);
+ if (target != vcpu)
+ kvm_resume_vcpu(target);
+ }

its_free_ite(kvm, ite);


Cheers,
/fuad