AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Zhu" <James.Zhu@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/amdgpu: clear in_runpm when runtime suspend fails in prepare
Date: Tue, 01 Dec 2026 14:28:41 +0000	[thread overview]
Message-ID: <sashiko-outbox-243482@kernel.org> (raw)
In-Reply-To: <20261201141500.3346608-1-James.Zhu@amd.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/amdgpu: uncleaned runpm state in
  amdgpu_pmops_runtime_suspend() [1]
--

commit 3c42fe64301c37b90df126008a21b7d19c71b9fc
Author: James Zhu <James.Zhu@amd.com>

drm/amdgpu: clear in_runpm when runtime suspend fails in prepare

This commit routes amdgpu_device_prepare() failures in
amdgpu_pmops_runtime_suspend() through the error cleanup block so that
adev->in_runpm and adev->mp1_state are reset on failure.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index d2db20c172c69..7bd53054ef6e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2907,9 +2907,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
>  		adev->mp1_state = PP_MP1_STATE_UNLOAD;
>  
>  	ret = amdgpu_device_prepare(drm_dev);
> -	if (ret)
> -		return ret;
> -	ret = amdgpu_device_suspend(drm_dev, false);
> +	if (!ret)
> +		ret = amdgpu_device_suspend(drm_dev, false);
>  	if (ret) {
>  		adev->in_runpm = false;
>  		if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO)

[Severity: High]
This problem wasn't introduced by this patch, but on AMDGPU_RUNPM_PX
systems does this error path [1] leave drm_dev->switch_power_state
stuck at DRM_SWITCH_POWER_CHANGING when amdgpu_device_prepare() or
amdgpu_device_suspend() fails?

Earlier in amdgpu_pmops_runtime_suspend():

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c:amdgpu_pmops_runtime_suspend() {
    ...
	adev->in_runpm = true;
	if (adev->pm.rpm_mode == AMDGPU_RUNPM_PX)
		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
    ...
}

Because the failure cleanup does not restore drm_dev->switch_power_state
to DRM_SWITCH_POWER_ON, drm_open_helper() will reject all subsequent DRM
device opens with -EINVAL while the device remains active.

[1] https://sashiko.dev/#/bug/linux-c9ddb109-ab18-4c50-8882-a9a764aa1bd4

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201141500.3346608-1-James.Zhu@amd.com?part=1

      parent reply	other threads:[~2026-12-01 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 14:14 [PATCH 1/3] drm/amdgpu: clear in_runpm when runtime suspend fails in prepare James Zhu
2026-12-01 14:14 ` [PATCH 2/3] drm/amdkfd: rebuild CWSR TBA/TMA in VRAM after system resume James Zhu
2026-12-01 14:15 ` [PATCH 3/3] Revert "drm/amdkfd: move TBA/TMA back to system memory" James Zhu
2026-12-01 14:37   ` sashiko-bot
2026-12-01 14:28 ` sashiko-bot [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=sashiko-outbox-243482@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=James.Zhu@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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