Skip to content

Commit 94c721e

Browse files
sean-jcjoergroedel
authored andcommitted
iommu/amd: Ensure GA log notifier callbacks finish running before module unload
Synchronize RCU when unregistering KVM's GA log notifier to ensure all in-flight interrupt handlers complete before KVM-the module is unloaded. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20250315031048.2374109-1-seanjc@google.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 8ffd015 commit 94c721e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,14 @@ int amd_iommu_register_ga_log_notifier(int (*notifier)(u32))
982982
{
983983
iommu_ga_log_notifier = notifier;
984984

985+
/*
986+
* Ensure all in-flight IRQ handlers run to completion before returning
987+
* to the caller, e.g. to ensure module code isn't unloaded while it's
988+
* being executed in the IRQ handler.
989+
*/
990+
if (!notifier)
991+
synchronize_rcu();
992+
985993
return 0;
986994
}
987995
EXPORT_SYMBOL(amd_iommu_register_ga_log_notifier);

0 commit comments

Comments
 (0)