summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2025-03-15 06:10:48 +0300
committerJoerg Roedel <jroedel@suse.de>2025-04-28 14:40:20 +0300
commit94c721ea03c7078163f41dbaa101ac721ddac329 (patch)
tree600ce6c7fee3fb23b90de9a6797688d7f7370d0c
parent8ffd015db85fea3e15a77027fda6c02ced4d2444 (diff)
downloadlinux-94c721ea03c7078163f41dbaa101ac721ddac329.tar.xz
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>
-rw-r--r--drivers/iommu/amd/iommu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index be8761bbef0f..15e334264881 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -982,6 +982,14 @@ int amd_iommu_register_ga_log_notifier(int (*notifier)(u32))
{
iommu_ga_log_notifier = notifier;
+ /*
+ * Ensure all in-flight IRQ handlers run to completion before returning
+ * to the caller, e.g. to ensure module code isn't unloaded while it's
+ * being executed in the IRQ handler.
+ */
+ if (!notifier)
+ synchronize_rcu();
+
return 0;
}
EXPORT_SYMBOL(amd_iommu_register_ga_log_notifier);