KVM: arm64: vgic: Free LPI vgic_irq structs in an RCU-safe manner
authorOliver Upton <oliver.upton@linux.dev>
Wed, 21 Feb 2024 05:42:50 +0000 (05:42 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Fri, 23 Feb 2024 21:46:02 +0000 (21:46 +0000)
Free the vgic_irq structs in an RCU-safe manner to allow reads of the
LPI configuration data to happen in parallel with the release of LPIs.

Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20240221054253.3848076-8-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/vgic/vgic.c
include/kvm/arm_vgic.h

index 15dbd17b3a9e21324d9246e7684b7221eca233cf..3fedc58e663a8704b732f562e2fbd76c9a8cf381 100644 (file)
@@ -125,7 +125,7 @@ void __vgic_put_lpi_locked(struct kvm *kvm, struct vgic_irq *irq)
        xa_erase(&dist->lpi_xa, irq->intid);
        atomic_dec(&dist->lpi_count);
 
-       kfree(irq);
+       kfree_rcu(irq, rcu);
 }
 
 void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
index 71e9d719533b687d1c96be6cb8eb056b5bbd9dfe..47035946648eafd0e4e88e8f49e0143c4ef58605 100644 (file)
@@ -117,6 +117,7 @@ struct irq_ops {
 
 struct vgic_irq {
        raw_spinlock_t irq_lock;        /* Protects the content of the struct */
+       struct rcu_head rcu;
        struct list_head ap_list;
 
        struct kvm_vcpu *vcpu;          /* SGIs and PPIs: The VCPU