Skip to content

Commit 11490b5

Browse files
Keir FraserMarc Zyngier
authored andcommitted
KVM: arm64: vgic: Explicitly implement vgic_dist::ready ordering
In preparation to remove synchronize_srcu() from MMIO registration, remove the distributor's dependency on this implicit barrier by direct acquire-release synchronization on the flag write and its lock-free check. Signed-off-by: Keir Fraser <keirf@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 8810c6e commit 11490b5

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

arch/arm64/kvm/vgic/vgic-init.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ int kvm_vgic_map_resources(struct kvm *kvm)
562562
gpa_t dist_base;
563563
int ret = 0;
564564

565-
if (likely(dist->ready))
565+
if (likely(smp_load_acquire(&dist->ready)))
566566
return 0;
567567

568568
mutex_lock(&kvm->slots_lock);
@@ -593,14 +593,7 @@ int kvm_vgic_map_resources(struct kvm *kvm)
593593
goto out_slots;
594594
}
595595

596-
/*
597-
* kvm_io_bus_register_dev() guarantees all readers see the new MMIO
598-
* registration before returning through synchronize_srcu(), which also
599-
* implies a full memory barrier. As such, marking the distributor as
600-
* 'ready' here is guaranteed to be ordered after all vCPUs having seen
601-
* a completely configured distributor.
602-
*/
603-
dist->ready = true;
596+
smp_store_release(&dist->ready, true);
604597
goto out_slots;
605598
out:
606599
mutex_unlock(&kvm->arch.config_lock);

0 commit comments

Comments
 (0)