[PATCH] drm/amdkfd: Disallow debugfs to hang hws when GPU is resetting

Oak Zeng Oak.Zeng at amd.com
Wed Jul 7 16:28:07 UTC 2021


If GPU is during a resetting cycle, writing to GPU can cause
unpredictable protection fault. Disallow using kfd debugfs
hang_hws to hang hws if GPU is resetting.

Signed-off-by: Oak Zeng <Oak.Zeng at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 9e4a05e..c380be9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -1390,6 +1390,11 @@ int kfd_debugfs_hang_hws(struct kfd_dev *dev)
 		return -EINVAL;
 	}
 
+	if (dev->dqm->is_resetting) {
+		pr_err("HWS is already under resetting, please wait the current reset to finish\n");
+		return -EBUSY;
+	}
+
 	r = pm_debugfs_hang_hws(&dev->dqm->packets);
 	if (!r)
 		r = dqm_debugfs_execute_queues(dev->dqm);
-- 
2.7.4



More information about the amd-gfx mailing list