summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/vgic/vgic.c
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2024-02-21 05:42:52 +0000
committerOliver Upton <oliver.upton@linux.dev>2024-02-23 21:46:02 +0000
commit50ac89bb709275731217f74da8ccef8c99def319 (patch)
treee05f78354f8d5b32edf7f6fe364503eaf78c2209 /arch/arm64/kvm/vgic/vgic.c
parent864d4304ec1e67b8235e2aae5d31bdad6dd8aa7c (diff)
KVM: arm64: vgic: Ensure the irq refcount is nonzero when taking a ref
It will soon be possible for get() and put() calls to happen in parallel, which means in most cases we must ensure the refcount is nonzero when taking a new reference. Switch to using vgic_try_get_irq_kref() where necessary, and document the few conditions where an IRQ's refcount is guaranteed to be nonzero. Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20240221054253.3848076-10-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/kvm/vgic/vgic.c')
-rw-r--r--arch/arm64/kvm/vgic/vgic.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
index 76abf3d946fe..df9e1aa1956c 100644
--- a/arch/arm64/kvm/vgic/vgic.c
+++ b/arch/arm64/kvm/vgic/vgic.c
@@ -395,7 +395,8 @@ retry:
/*
* Grab a reference to the irq to reflect the fact that it is
- * now in the ap_list.
+ * now in the ap_list. This is safe as the caller must already hold a
+ * reference on the irq.
*/
vgic_get_irq_kref(irq);
list_add_tail(&irq->ap_list, &vcpu->arch.vgic_cpu.ap_list_head);