Re: [PATCH v2] KVM: arm64: vgic-its: Serialize translation cache invalidation under its_lock

From: Oliver Upton

Date: Tue Jun 02 2026 - 17:26:22 EST


Hi Hyunwoo,

Thanks for respinning.

On Tue, Jun 02, 2026 at 04:52:18PM +0900, Hyunwoo Kim wrote:
> @@ -607,17 +609,16 @@ void vgic_its_invalidate_all_caches(struct kvm *kvm)
> struct kvm_device *dev;
> struct vgic_its *its;
>
> - rcu_read_lock();
> + guard(mutex)(&kvm->lock);

Urgh, entirely my mistake but we can get here holding the vcpu->mutex
which is an ordering bug. We can defer the locking cleanup as a long
term fix (which I still want) and take what you had before in v1.

Sorry for the noise.

Thanks,
Oliver

> - list_for_each_entry_rcu(dev, &kvm->devices, vm_node) {
> + list_for_each_entry(dev, &kvm->devices, vm_node) {
> if (dev->ops != &kvm_arm_vgic_its_ops)
> continue;
>
> its = dev->private;
> + guard(mutex)(&its->its_lock);
> vgic_its_invalidate_cache(its);
> }
> -
> - rcu_read_unlock();
> }
>
> int vgic_its_resolve_lpi(struct kvm *kvm, struct vgic_its *its,
> @@ -1725,8 +1726,10 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
> goto out;
>
> its->enabled = !!(val & GITS_CTLR_ENABLE);
> - if (!its->enabled)
> + if (!its->enabled) {
> + guard(mutex)(&its->its_lock);
> vgic_its_invalidate_cache(its);
> + }
>
> /*
> * Try to process any pending commands. This function bails out early
> --
> 2.43.0
>