From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: amd-gfx@lists.freedesktop.org
Cc: Mario Limonciello <superm1@kernel.org>
Subject: [PATCH v5 5/5] drm/amd: Reset the GPU if pmops failed
Date: Sat, 25 Oct 2025 23:29:40 -0500 [thread overview]
Message-ID: <20251026042942.549389-6-superm1@kernel.org> (raw)
In-Reply-To: <20251026042942.549389-1-superm1@kernel.org>
If the GPU fails to suspend the return code is passed up to the caller
but it's left in an inconsistent state. This could lead to hangs
if userspace tries to access it.
The last stage of all pmpops calls (success or fail) is the complete()
callback. If by the time the PM core reaches this state the GPU is still
in suspend something went really wrong, so reset it.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
v5:
* Handle case of DPM_FLAG_SMART_SUSPEND (Lijo)
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index cee90f9e58a9..4d437e31d1bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2590,6 +2590,17 @@ static int amdgpu_pmops_prepare(struct device *dev)
static void amdgpu_pmops_complete(struct device *dev)
{
+ struct drm_device *drm_dev = dev_get_drvdata(dev);
+ struct amdgpu_device *adev = drm_to_adev(drm_dev);
+
+ /* sequence failed, use a big 🔨 try to cleanup */
+ if (adev->in_suspend && !pm_runtime_suspended(dev)) {
+ adev->in_suspend = adev->in_s0ix = adev->in_s3 = false;
+ dev_crit(adev->dev, "pmpops sequence failed, resetting\n");
+ amdgpu_asic_reset(adev);
+ return;
+ }
+
amdgpu_device_complete(dev_get_drvdata(dev));
}
--
2.51.1
prev parent reply other threads:[~2025-10-26 4:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 4:29 [PATCH v5 0/5] Unwind failed suspend Mario Limonciello (AMD)
2025-10-26 4:29 ` [PATCH v5 1/5] drm/amdgpu: Drop PMFW RLC notifier from amdgpu_device_suspend() Mario Limonciello (AMD)
2025-10-31 12:01 ` Antheas Kapenekakis
2025-10-31 12:59 ` Mario Limonciello (AMD) (kernel.org)
2025-10-26 4:29 ` [PATCH v5 2/5] drm/amd: Add an unwind for failures in amdgpu_device_ip_suspend_phase1() Mario Limonciello (AMD)
2025-10-30 15:14 ` Alex Deucher
2025-10-30 15:16 ` Mario Limonciello (AMD) (kernel.org)
2025-10-30 15:18 ` Alex Deucher
2025-10-30 15:20 ` Mario Limonciello (AMD) (kernel.org)
2025-10-26 4:29 ` [PATCH v5 3/5] drm/amd: Add an unwind for failures in amdgpu_device_ip_suspend_phase2() Mario Limonciello (AMD)
2025-10-26 4:29 ` [PATCH v5 4/5] drm/amd: Unwind for failed device suspend Mario Limonciello (AMD)
2025-10-26 4:29 ` Mario Limonciello (AMD) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251026042942.549389-6-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox