* [PATCH 6.18.y 0/5] KVM/arm64 stable fixes
@ 2026-12-05 10:41 Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable
- Make the ITS MOVALL command a full synchronisation point for the
whole VM, stopping it so that the command can execute withough
having to fight for locks.
- Bound PINTID during ITE table restore, avoiding the possibility
that the guest plants an out-of-range LPI INTID in its own
in-memory ITS tables prior to restore.
- Do not blindly trust the vINTID field coming from KVM, and
reject anything that is out of the boundaries that the hardware
ITS is configured to support.
- Add signal_pending checks to the scan_its_table() loop; device
table entries with num_eventid_bits = 16 (or 65536 EventIDs per
device) are valid but takes a long time to restore.
- Remove quadratic complexity from the algorithm used to prune
IRQs sitting in the AP list has a quadratic complexity, and
simplify the locking while at that.
Marc Zyngier (3):
KVM: arm64: vgic-its: Stop the VM when handling MOVALL
irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries
KVM: arm64: vgic: Linearise AP list pruning process
Raghavendra Rao Ananta (2):
KVM: arm64: vgic-its: Bound PINTID during ITE table restore
KVM: arm64: vgic-its: Add signal checks in scan_its_table()
arch/arm64/kvm/vgic/vgic-its.c | 17 ++-
arch/arm64/kvm/vgic/vgic.c | 171 +++++++++++++++----------------
drivers/irqchip/irq-gic-v3-its.c | 3 +-
3 files changed, 103 insertions(+), 88 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 6.18.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
@ 2026-12-05 10:41 ` Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Marc Zyngier
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable
commit b31bce255a009b17c26bcada1f23c15ebc3fbff1 upstream.
MOVALL is a royal pain, as it requires us to iterate over all the LPIs
and move them around if they are on the correct source vcpu, and
requiring locking for each of them.
This locking can result in contention for vcpus that enter and exit
the guest, and hinders forward progress. In order to make sure such
process is not contended, just stop the VM altogether.
Nobody in their right mind uses MOVALL anyway, as this is a rather
braindead aspect of the GICv3 architecture.
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20261015100539.1011760-8-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
arch/arm64/kvm/vgic/vgic-its.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 0f77c755b16f9..397c882609314 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -1399,6 +1399,15 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its,
if (vcpu1 == vcpu2)
return 0;
+ /*
+ * Bulk operations such as MOVALL are a pain, as they can clash
+ * badly locking-wise with other vcpus entering and exiting the
+ * guest, should they be affected by it. Stopping the guest is a
+ * safer bet to ensure uncontended access and ultimately forward
+ * progress. Yeah...
+ */
+ kvm_arm_halt_guest(kvm);
+
xa_for_each(&dist->lpi_xa, intid, irq) {
irq = vgic_get_irq(kvm, intid);
if (!irq)
@@ -1411,6 +1420,8 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its,
vgic_its_invalidate_cache(its);
+ kvm_arm_resume_guest(kvm);
+
return 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.18.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
@ 2026-12-05 10:41 ` Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Marc Zyngier
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable,
Raghavendra Rao Ananta, Stefan Teodorescu, Damiano Melotti
From: Raghavendra Rao Ananta <rananta@google.com>
commit 1e9b13ae786d3846a3722e88907e4f3b371c343f upstream.
During ITS table restore (KVM_DEV_ARM_ITS_RESTORE_TABLES), vgic_its_restore_ite()
validates only that the restored interrupt ID satisfies `lpi_id >= VGIC_MIN_LPI`
(8192) and fails to validate the upper bound against max_lpis_propbaser(propbaser).
Since the ITE PINTID field is 32-bit (bits 47:16), a guest can plant an
out-of-range LPI INTID in its own in-memory ITS tables prior to restore.
When direct MSI forwarding attaches (via kvm_vgic_v4_set_forwarding()), this
unchecked intid causes two severe consequences:
1. Out-of-Bounds Memory Write:
In its_vlpi_map(), lpi_write_config() calculates the configuration byte
target address as `page_address(map->vm->vprop_page) + hwirq - 8192`.
Since vprop_page is a 64KB page-granular host allocation and hwirq is
unbounded, this causes a 1-byte read-modify-write up to 4GB past the
allocation into neighboring memory, with both the offset and written value
controlled by the guest.
2. Hardware Command Queue Wedge (Host MSI/IRQ DoS):
Immediately following the write, its_vlpi_map() issues a physical VMAPTI
command with `virt_id = map->vintid`. Because virt_id exceeds the hardware's
architected ID limits, the physical GICv4.1 ITS command queue halts on the
malformed descriptor. The hardware read pointer becomes stuck, causing all
subsequent ITS commands to time out and permanently breaking host-wide MSI
handling until reboot:
ITS cmd its_build_discard_cmd failed
ITS queue timeout (24768 24481)
ITS cmd its_build_mapd_cmd failed
ITS queue timeout (24800 24481)
ITS cmd its_build_vmapp_cmd failed
Fix this by validating the upper bound of lpi_id against max_lpis_propbaser()
in vgic_its_restore_ite(), mirroring the check in vgic_its_cmd_handle_mapi().
Fixes: eff484e0298d ("KVM: arm64: vgic-its: ITT save and restore")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Signed-off-by: Damiano Melotti <melotti@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
arch/arm64/kvm/vgic/vgic-its.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 397c882609314..451acdc0b356d 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -2212,7 +2212,8 @@ static int vgic_its_restore_ite(struct vgic_its *its, u32 event_id,
if (!lpi_id)
return 1; /* invalid entry, no choice but to scan next entry */
- if (lpi_id < VGIC_MIN_LPI)
+ if (lpi_id < VGIC_MIN_LPI ||
+ lpi_id >= max_lpis_propbaser(kvm->arch.vgic.propbaser))
return -EINVAL;
offset = val >> KVM_ITS_ITE_NEXT_SHIFT;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.18.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Marc Zyngier
@ 2026-12-05 10:41 ` Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process Marc Zyngier
4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable, Stefan Teodorescu,
Damiano Melotti
commit 6ddf1c750857c66c25bf1e7d13b29bcfd06634f5 upstream.
Do not blindly trust the vINTID field coming from KVM, and reject
anything that is out of the boundaries that the hardware ITS is
configured to support. These LPIs can still be injected as purely
virtual interrupt.
Fixes: d011e4e654d7f ("irqchip/gic-v3-its: Add VLPI map/unmap operations")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Damiano Melotti <melotti@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
drivers/irqchip/irq-gic-v3-its.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 9fb9c06b9242e..5ee061bb4ba5d 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1922,7 +1922,8 @@ static int its_vlpi_map(struct irq_data *d, struct its_cmd_info *info)
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
u32 event = its_get_event_id(d);
- if (!info->map)
+ if (!info->map || info->map->vintid < 8192 ||
+ info->map->vintid >= BIT_ULL(LPI_NRBITS))
return -EINVAL;
if (!its_dev->event_map.vm) {
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.18.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table()
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
` (2 preceding siblings ...)
2026-12-05 10:41 ` [PATCH 6.18.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Marc Zyngier
@ 2026-12-05 10:41 ` Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process Marc Zyngier
4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable,
Raghavendra Rao Ananta, Stefan Teodorescu, Damiano Melotti
From: Raghavendra Rao Ananta <rananta@google.com>
commit 0403edd7fc1c8d1263e179e85d0e987dcc838193 upstream.
During ITS table restore (KVM_DEV_ARM_ITS_RESTORE_TABLES), scan_its_table()
walks guest RAM to restore Device Table Entries (DTEs) and Interrupt
Translation Tables (ITTs) while holding kvm->lock, all vCPU mutexes,
kvm->arch.config_lock, and its->its_lock.
Because a guest can plant valid DTEs with num_eventid_bits = 16 (size = 15,
or 65,536 EventIDs per device) pointing to zeroed/sparse ITT memory
(!lpi_id), vgic_its_restore_ite() returns +1 for each unmapped entry. This
forces scan_its_table() to scan up to 65,536 entries per device (up to
4.30B reads for a 1-level flat table or 21.48B reads for a 2-level indirect
table).
Because scan_its_table() lacks signal checks, executing
KVM_DEV_ARM_ITS_RESTORE_TABLES monopolizes the host CPU in kernel
space for tens to hundreds of seconds.
Fix this by checking signal_pending(current) at the start of the
scan_its_table() loop to allow immediate cancellation (-EINTR) if a VMM
timeout or termination signal arrives.
Fixes: 920a7a8fa92a ("KVM: arm64: vgic-its: Add infrastructure for table lookup")
Reported-by: Stefan Teodorescu <fane@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Signed-off-by: Damiano Melotti <melotti@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
arch/arm64/kvm/vgic/vgic-its.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 451acdc0b356d..abf4568bff4e6 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -2135,6 +2135,9 @@ static int scan_its_table(struct vgic_its *its, gpa_t base, int size, u32 esz,
int next_offset;
size_t byte_offset;
+ if (signal_pending(current))
+ return -EINTR;
+
ret = kvm_read_guest_lock(kvm, gpa, entry, esz);
if (ret)
return ret;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6.18.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
` (3 preceding siblings ...)
2026-12-05 10:41 ` [PATCH 6.18.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Marc Zyngier
@ 2026-12-05 10:41 ` Marc Zyngier
4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2026-12-05 10:41 UTC (permalink / raw)
To: kvmarm, kvm, linux-arm-kernel
Cc: Steffen Eiden, Joey Gouly, Suzuki K Poulose, Oliver Upton,
Zenghui Yu, Fuad Tabba, Paolo Bonzini, stable
commit 504fa43c028d491fd772eb9c264d56bd68a75460 upstream.
The algorithm used to prune IRQs sitting in the AP list has a quadratic
complexity, as any concurrent change in the list results in a restart of
the processing. The locking is also rather complicated, as we have to
take the locks for both source and target vcpus, plus the per-irq lock.
While this has served us well so far, people are finding new and amusing
ways to abuse the locking and perform a DoS on the host. Not fun.
Instead, switch to a linear approach where potentially moved IRQs are
taken off the AP list and then dispatched onto their new targets. This
simplifies the locking (only one vcpu lock at any given time), and only
the interrupts that have been changed during that process are evaluated
again. This allows the pruning process to converge much quicker.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Oliver Upton <oupton@kernel.org>
Cc: stable@vger.kernel.org
---
arch/arm64/kvm/vgic/vgic.c | 171 ++++++++++++++++++-------------------
1 file changed, 85 insertions(+), 86 deletions(-)
diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
index 23720e1131b40..8e92f95e64d09 100644
--- a/arch/arm64/kvm/vgic/vgic.c
+++ b/arch/arm64/kvm/vgic/vgic.c
@@ -656,6 +656,29 @@ int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner)
return ret;
}
+/*
+ * This helper checks the target *and* does the laundry, nuking the irq off
+ * the ap_list when necessary, and doing the refcount drop on LPIs. -ENOENT
+ * is returned when LPI release is warranted.
+ */
+static struct kvm_vcpu *vgic_predict_target(struct kvm *kvm, struct vgic_irq *irq)
+{
+ struct kvm_vcpu *target;
+
+ lockdep_assert_held(&irq->irq_lock);
+
+ target = vgic_target_oracle(irq);
+ if (!target) {
+ list_del(&irq->ap_list);
+ irq->vcpu = NULL;
+
+ if (vgic_put_irq_norelease(kvm, irq))
+ target = ERR_PTR(-ENOENT);
+ }
+
+ return target;
+}
+
/**
* vgic_prune_ap_list - Remove non-relevant interrupts from the list
*
@@ -667,113 +690,89 @@ int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner)
static void vgic_prune_ap_list(struct kvm_vcpu *vcpu)
{
struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
+ DECLARE_BITMAP(pend_map, VGIC_V3_MAX_CPUS) = {};
+ DECLARE_BITMAP(kick_map, VGIC_V3_MAX_CPUS) = {};
+ struct kvm_vcpu *irq_target;
struct vgic_irq *irq, *tmp;
bool deleted_lpis = false;
+ LIST_HEAD(culling_list);
+ int i;
DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
-retry:
raw_spin_lock(&vgic_cpu->ap_list_lock);
list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) {
- struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB;
- bool target_vcpu_needs_kick = false;
-
- raw_spin_lock(&irq->irq_lock);
-
+ guard(raw_spinlock)(&irq->irq_lock);
BUG_ON(vcpu != irq->vcpu);
- target_vcpu = vgic_target_oracle(irq);
-
- if (!target_vcpu) {
- /*
- * We don't need to process this interrupt any
- * further, move it off the list.
- */
- list_del(&irq->ap_list);
- irq->vcpu = NULL;
- raw_spin_unlock(&irq->irq_lock);
-
- /*
- * This vgic_put_irq call matches the
- * vgic_get_irq_ref in vgic_queue_irq_unlock,
- * where we added the LPI to the ap_list. As
- * we remove the irq from the list, we drop
- * also drop the refcount.
- */
- deleted_lpis |= vgic_put_irq_norelease(vcpu->kvm, irq);
- continue;
- }
-
- if (target_vcpu == vcpu) {
- /* We're on the right CPU */
- raw_spin_unlock(&irq->irq_lock);
+ /*
+ * We skip the processing of an irq in a few cases:
+ * - the irq is on the correct target: nothing to do.
+ * - the target is NULL: vgic_predict_target() will have
+ * culled the irq from the ap_list.
+ * - we get an error back: the LPI has been deleted.
+ */
+ irq_target = vgic_predict_target(vcpu->kvm, irq);
+ if (irq_target == vcpu || IS_ERR_OR_NULL(irq_target)) {
+ deleted_lpis |= IS_ERR(irq_target);
continue;
}
/*
- * This interrupt looks like it has to be migrated,
- * make sure it is kept alive while locks are dropped.
+ * Snapshot the vcpus to visit (more may be added later),
+ * and move the IRQ onto the culling list.
*/
- vgic_get_irq_ref(irq);
-
- raw_spin_unlock(&irq->irq_lock);
- raw_spin_unlock(&vgic_cpu->ap_list_lock);
-
- /*
- * Ensure locking order by always locking the smallest
- * ID first.
- */
- if (vcpu->vcpu_id < target_vcpu->vcpu_id) {
- vcpuA = vcpu;
- vcpuB = target_vcpu;
- } else {
- vcpuA = target_vcpu;
- vcpuB = vcpu;
- }
-
- raw_spin_lock(&vcpuA->arch.vgic_cpu.ap_list_lock);
- raw_spin_lock_nested(&vcpuB->arch.vgic_cpu.ap_list_lock,
- SINGLE_DEPTH_NESTING);
- raw_spin_lock(&irq->irq_lock);
-
- /*
- * If the interrupt is still ours and its affinity has
- * been preserved, move it around. Otherwise, it means
- * things have changed while the interrupt was unlocked
- * (it may even have been taken off the list with its
- * affinity left untouched), and we need to replay this.
- *
- * In all cases, we cannot trust the list not to have
- * changed, so we restart from the beginning.
- */
- if (irq->vcpu == vcpu && target_vcpu == vgic_target_oracle(irq)) {
- struct vgic_cpu *new_cpu = &target_vcpu->arch.vgic_cpu;
-
- list_del(&irq->ap_list);
- irq->vcpu = target_vcpu;
- list_add_tail(&irq->ap_list, &new_cpu->ap_list_head);
- target_vcpu_needs_kick = true;
- }
-
- raw_spin_unlock(&irq->irq_lock);
- raw_spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock);
- raw_spin_unlock(&vcpuA->arch.vgic_cpu.ap_list_lock);
-
- deleted_lpis |= vgic_put_irq_norelease(vcpu->kvm, irq);
-
- if (target_vcpu_needs_kick) {
- kvm_make_request(KVM_REQ_IRQ_PENDING, target_vcpu);
- kvm_vcpu_kick(target_vcpu);
- }
-
- goto retry;
+ __set_bit(irq_target->vcpu_id, pend_map);
+ list_move_tail(&irq->ap_list, &culling_list);
}
raw_spin_unlock(&vgic_cpu->ap_list_lock);
+retry:
+ BUG_ON(bitmap_empty(pend_map, VGIC_V3_MAX_CPUS) != list_empty(&culling_list));
+
+ for_each_set_bit(i, pend_map, VGIC_V3_MAX_CPUS) {
+ struct kvm_vcpu *target = kvm_get_vcpu_by_id(vcpu->kvm, i);
+
+ guard(raw_spinlock)(&target->arch.vgic_cpu.ap_list_lock);
+
+ list_for_each_entry_safe(irq, tmp, &culling_list, ap_list) {
+ guard(raw_spinlock)(&irq->irq_lock);
+
+ /*
+ * Check again, now that we hold all the locks. If
+ * the irq has been moved again, leave it for later.
+ */
+ irq_target = vgic_predict_target(vcpu->kvm, irq);
+ if (IS_ERR_OR_NULL(irq_target)) {
+ deleted_lpis |= IS_ERR(irq_target);
+ continue;
+ }
+ /* Catch a potential affinity change */
+ if (irq_target != target) {
+ __set_bit(irq_target->vcpu_id, pend_map);
+ continue;
+ }
+
+ irq->vcpu = target;
+ list_move_tail(&irq->ap_list, &target->arch.vgic_cpu.ap_list_head);
+ __set_bit(target->vcpu_id, kick_map);
+ }
+
+ __clear_bit(i, pend_map);
+ }
+
+ /* Leftovers? Same player shoot again! */
+ if (unlikely(!list_empty(&culling_list)))
+ goto retry;
+
if (unlikely(deleted_lpis))
vgic_release_deleted_lpis(vcpu->kvm);
+
+ for_each_set_bit(i, kick_map, VGIC_V3_MAX_CPUS)
+ kvm_make_request_and_kick(KVM_REQ_IRQ_PENDING,
+ kvm_get_vcpu_by_id(vcpu->kvm, i));
}
static inline void vgic_fold_lr_state(struct kvm_vcpu *vcpu)
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-05 10:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 10:41 [PATCH 6.18.y 0/5] KVM/arm64 stable fixes Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.18.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process Marc Zyngier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.