All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq
@ 2026-07-07  9:38 Marco Crivellari
  2026-07-07  9:52 ` sashiko-bot
  2026-07-07 11:02 ` Timur Kristóf
  0 siblings, 2 replies; 5+ messages in thread
From: Marco Crivellari @ 2026-07-07  9:38 UTC (permalink / raw)
  To: linux-kernel, dri-devel, amd-gfx
  Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
	Sebastian Andrzej Siewior, Marco Crivellari, Michal Hocko,
	Alex Deucher, Christian Konig, David Airlie, Simona Vetter,
	Kees Cook, Tvrtko Ursulin, Ce Sun, Tao Zhou, Timur Kristof,
	Thadeu Lima de Souza Cascardo, Hawking Zhang

system_wq (per-CPU) and system_unbound_wq (unbound) are the older
workqueue name, replaced by system_{percpu|dfl}_wq.
The new workqueues have been introduced by:

  128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")

Usage of older workqueues will now trigger a pr_warn_once() because they are
marked as deprecated as per commit:

  64d8eae3f895 ("workqueue: Add warnings and fallback if system_{unbound}_wq is used")

So change the used workqueue with the newer, keeping the same behavior.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 53be764968e4..95cceed4e971 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -545,7 +545,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev,
 			 unsigned int num_dw)
 {
 	amdgpu_ih_ring_write(adev, &adev->irq.ih_soft, entry->iv_entry, num_dw);
-	queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
+	queue_work(system_dfl_wq, &adev->irq.ih_soft_work);
 }
 
 /**
-- 
2.54.0


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

* Re: [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq
  2026-07-07  9:38 [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq Marco Crivellari
@ 2026-07-07  9:52 ` sashiko-bot
  2026-07-07 11:02 ` Timur Kristóf
  1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-07-07  9:52 UTC (permalink / raw)
  To: Marco Crivellari; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing explicit cancellation of asynchronous interrupt work items (ih_soft_work, ih1_work, ih2_work) during device teardown, leading to a Use-After-Free.
--

--- Patch [1]: [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq ---
commit 65cddcba7474a0c152afd7f127fd2e2ad98c63ac
Author: Marco Crivellari <marco.crivellari@suse.com>

drm/amdgpu: Change system_unbound_wq with system_dfl_wq

This commit replaces the deprecated system_unbound_wq with the newer
system_dfl_wq to avoid deprecation warnings. The patch aims to keep the
existing workqueue behavior intact.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -547,7 +547,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev,
>  			 unsigned int num_dw)
>  {
>  	amdgpu_ih_ring_write(adev, &adev->irq.ih_soft, entry->iv_entry, num_dw);
> -	queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
> +	queue_work(system_dfl_wq, &adev->irq.ih_soft_work);

[Severity: High]
This is a pre-existing issue, but since we are modifying the workqueue
submission here, does the teardown path leave ih_soft_work pending?

If a hardware interrupt fires just before device unbind or module unload,
adev->irq.ih_soft_work can be queued onto the global system workqueue. When
the driver proceeds with teardown, it frees the interrupt handler and the
ring buffers:

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:amdgpu_irq_fini_hw() {
        if (adev->irq.installed) {
                free_irq(adev->irq.irq, adev_to_drm(adev));
        ...
        amdgpu_ih_ring_fini(adev, &adev->irq.ih_soft);
}

However, it doesn't appear to explicitly call cancel_work_sync() for the
pending work items before freeing the adev structure. Could this result
in a use-after-free if the global workqueue asynchronously executes the
amdgpu_irq_handle_ih_soft() work item after the device memory is freed?

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707093812.109176-1-marco.crivellari@suse.com?part=1

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

* Re: [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq
  2026-07-07  9:38 [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq Marco Crivellari
  2026-07-07  9:52 ` sashiko-bot
@ 2026-07-07 11:02 ` Timur Kristóf
  2026-07-07 18:12   ` Alex Deucher
  1 sibling, 1 reply; 5+ messages in thread
From: Timur Kristóf @ 2026-07-07 11:02 UTC (permalink / raw)
  To: linux-kernel, dri-devel, amd-gfx, Marco Crivellari
  Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
	Sebastian Andrzej Siewior, Marco Crivellari, Michal Hocko,
	Alex Deucher, Christian Konig, David Airlie, Simona Vetter,
	Kees Cook, Tvrtko Ursulin, Ce Sun, Tao Zhou,
	Thadeu Lima de Souza Cascardo, Hawking Zhang

On 2026. július 7., kedd 11:38:12 közép-európai nyári idő Marco Crivellari 
wrote:
> system_wq (per-CPU) and system_unbound_wq (unbound) are the older
> workqueue name, replaced by system_{percpu|dfl}_wq.
> The new workqueues have been introduced by:
> 
>   128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
> 
> Usage of older workqueues will now trigger a pr_warn_once() because they are
> marked as deprecated as per commit:
> 
>   64d8eae3f895 ("workqueue: Add warnings and fallback if system_{unbound}_wq
> is used")
> 
> So change the used workqueue with the newer, keeping the same behavior.
> 
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>

Nice catch, thank you Marco!

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 53be764968e4..95cceed4e971
> 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -545,7 +545,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev,
>  			 unsigned int num_dw)
>  {
>  	amdgpu_ih_ring_write(adev, &adev->irq.ih_soft, entry->iv_entry, 
num_dw);
> -	queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
> +	queue_work(system_dfl_wq, &adev->irq.ih_soft_work);
>  }
> 
>  /**





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

* Re: [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq
  2026-07-07 11:02 ` Timur Kristóf
@ 2026-07-07 18:12   ` Alex Deucher
  2026-07-08  6:23     ` Marco Crivellari
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2026-07-07 18:12 UTC (permalink / raw)
  To: Timur Kristóf
  Cc: linux-kernel, dri-devel, amd-gfx, Marco Crivellari, Tejun Heo,
	Lai Jiangshan, Frederic Weisbecker, Sebastian Andrzej Siewior,
	Michal Hocko, Alex Deucher, Christian Konig, David Airlie,
	Simona Vetter, Kees Cook, Tvrtko Ursulin, Ce Sun, Tao Zhou,
	Thadeu Lima de Souza Cascardo, Hawking Zhang

Applied.  Thanks!

Alex

On Tue, Jul 7, 2026 at 7:02 AM Timur Kristóf <timur.kristof@gmail.com> wrote:
>
> On 2026. július 7., kedd 11:38:12 közép-európai nyári idő Marco Crivellari
> wrote:
> > system_wq (per-CPU) and system_unbound_wq (unbound) are the older
> > workqueue name, replaced by system_{percpu|dfl}_wq.
> > The new workqueues have been introduced by:
> >
> >   128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
> >
> > Usage of older workqueues will now trigger a pr_warn_once() because they are
> > marked as deprecated as per commit:
> >
> >   64d8eae3f895 ("workqueue: Add warnings and fallback if system_{unbound}_wq
> > is used")
> >
> > So change the used workqueue with the newer, keeping the same behavior.
> >
> > Suggested-by: Tejun Heo <tj@kernel.org>
> > Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
>
> Nice catch, thank you Marco!
>
> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 53be764968e4..95cceed4e971
> > 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> > @@ -545,7 +545,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev,
> >                        unsigned int num_dw)
> >  {
> >       amdgpu_ih_ring_write(adev, &adev->irq.ih_soft, entry->iv_entry,
> num_dw);
> > -     queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
> > +     queue_work(system_dfl_wq, &adev->irq.ih_soft_work);
> >  }
> >
> >  /**
>
>
>
>

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

* Re: [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq
  2026-07-07 18:12   ` Alex Deucher
@ 2026-07-08  6:23     ` Marco Crivellari
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Crivellari @ 2026-07-08  6:23 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Timur Kristóf, linux-kernel, dri-devel, amd-gfx, Tejun Heo,
	Lai Jiangshan, Frederic Weisbecker, Sebastian Andrzej Siewior,
	Michal Hocko, Alex Deucher, Christian Konig, David Airlie,
	Simona Vetter, Kees Cook, Tvrtko Ursulin, Ce Sun, Tao Zhou,
	Thadeu Lima de Souza Cascardo, Hawking Zhang

On Tue, Jul 7, 2026 at 8:13 PM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> Applied.  Thanks!

Many thanks!

-- 

Marco Crivellari

SUSE Labs

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

end of thread, other threads:[~2026-07-08  6:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07  9:38 [PATCH] drm/amdgpu: Change system_unbound_wq with system_dfl_wq Marco Crivellari
2026-07-07  9:52 ` sashiko-bot
2026-07-07 11:02 ` Timur Kristóf
2026-07-07 18:12   ` Alex Deucher
2026-07-08  6:23     ` Marco Crivellari

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.