All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yu-Hsiang Tseng" <asas1asas200@gmail.com>,
	amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/vpe: don't let the idle work gate VPE during suspend
Date: Wed, 02 Dec 2026 09:41:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-245334@kernel.org> (raw)
In-Reply-To: <20261201090146.24296-1-asas1asas200@gmail.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: missing reset-domain lock in media IP idle workers
  [1]
--

commit a09c7e7c3fa4da197942c25c5f4fe4c66e24d21f
Author: Yu-Hsiang Tseng <asas1asas200@gmail.com>

drm/amdgpu/vpe: don't let the idle work gate VPE during suspend

This commit cancels pending VPE idle work when ungating VPE and reschedules
the idle work if a suspend is in progress so that VPE stays powered up until
vpe_hw_fini() stops the ring.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> index f6adbc1906fde..235ceb62d5d69 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c
> @@ -362,6 +362,10 @@ static void vpe_idle_work_handler(struct work_struct *work)
>  	if (fences)
>  		goto reschedule;
>  
> +	/* Suspend needs VPE to stay ungated until vpe_hw_fini() */
> +	if (adev->in_suspend)
> +		goto reschedule;
> +
>  	if (vpe_need_dpm0_at_power_down(adev) && vpe_get_dpm_level(adev) != 0)
>  		goto reschedule;

[Severity: High]
This problem wasn't introduced by this patch, but can vpe_idle_work_handler()
and other media IP idle workers (such as vcn_v2_5_idle_work_handler()) race
with an active GPU reset [1]?

Unlike newer IP block idle handlers that serialize against GPU resets with
down_read_trylock(&adev->reset_domain->sem), this handler calls
amdgpu_device_ip_set_powergating_state() without taking the reset domain
read lock:

CPU0                              CPU1
amdgpu_device_gpu_recover()
  down_write(&adev->reset_domain->sem)
                                  vpe_idle_work_handler()
                                    amdgpu_device_ip_set_powergating_state()
                                      <-- unsynchronized powergating access
  up_write(&adev->reset_domain->sem)

Altering powergating state while a GPU reset is mid-flight can corrupt
hardware register state and cause system lockups or crashes.

[1] https://sashiko.dev/#/bug/linux-fa3dff9c-bfd3-4822-8c68-70af026e226f

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201090146.24296-1-asas1asas200@gmail.com?part=1

      reply	other threads:[~2026-12-02  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:01 [PATCH] drm/amdgpu/vpe: don't let the idle work gate VPE during suspend Yu-Hsiang Tseng
2026-12-02  9:41 ` 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-245334@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=asas1asas200@gmail.com \
    --cc=dri-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.