public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: fix system hang on reboot -f
@ 2025-02-20 10:15 Yunhui Cui
  2025-02-21  8:40 ` Ethan Zhao
  2025-02-24  1:02 ` Baolu Lu
  0 siblings, 2 replies; 8+ messages in thread
From: Yunhui Cui @ 2025-02-20 10:15 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will, robin.murphy, iommu, linux-kernel; +Cc: Yunhui Cui

When entering intel_iommu_shutdown, system interrupts are disabled,
and the reboot process might be scheduled out by down_write(). If the
scheduled process does not yield (e.g., while(1)), the system will hang.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 drivers/iommu/intel/iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index cc46098f875b..76a1d83b46bf 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2871,7 +2871,8 @@ void intel_iommu_shutdown(void)
 	if (no_iommu || dmar_disabled)
 		return;
 
-	down_write(&dmar_global_lock);
+	if (!down_write_trylock(&dmar_global_lock))
+		return;
 
 	/* Disable PMRs explicitly here. */
 	for_each_iommu(iommu, drhd)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-02-24  5:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 10:15 [PATCH] iommu/vt-d: fix system hang on reboot -f Yunhui Cui
2025-02-21  8:40 ` Ethan Zhao
2025-02-21  9:46   ` [External] " yunhui cui
2025-02-24  2:53     ` Ethan Zhao
2025-02-24  3:21     ` Ethan Zhao
2025-02-24  1:02 ` Baolu Lu
2025-02-24  3:42   ` [External] " yunhui cui
2025-02-24  5:37   ` Ethan Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox