Skip to contentSkip to conversation

drm/amdgpu: Change system_unbound_wq with system_dfl_wq

PATCH Applied Marco Crivellari 4 participants 5 messages Jul 7 – Jul 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Change system_unbound_wq with system_dfl_wq

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
index 53be764968e4..95cceed4e971 100644
@@ -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);
 }
 
 /**
Signature · 1 line
2.54.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

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 <[email protected]>

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.

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c void amdgpu_irq_delegate(struct amdgpu_device *adev, · line 550

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -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?

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0 -0
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Marco Crivellari
Quoted 9 lines · On 2026. július 7., kedd 11:38:12 közép-európai nyári idő Marco Crivellari…

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:

Quoted 7 lines

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

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

Nice catch, thank you Marco!

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c void amdgpu_irq_delegate(struct amdgpu_device *adev, · line 547

Quoted 13 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 53be764968e4..95cceed4e971 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0 -0
@@ -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);

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
-	queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
+	queue_work(system_dfl_wq, &adev->irq.ih_soft_work);
 }
 
 /**
Applied
#3 lore raw

Applied. Thanks!

Alex

Quoted 47 lines · Timur Kristóf
Quoted 9 lines · On 2026. július 7., kedd 11:38:12 közép-európai nyári idő Marco Crivellari…

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:

Quoted 7 lines

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

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

Nice catch, thank you Marco!

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c void amdgpu_irq_delegate(struct amdgpu_device *adev, · line 547

Quoted 13 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 53be764968e4..95cceed4e971 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0 -0
@@ -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);

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
-     queue_work(system_unbound_wq, &adev->irq.ih_soft_work);
+     queue_work(system_dfl_wq, &adev->irq.ih_soft_work);
 }
 
 /**
#4 lore raw
Quoted 2 lines · Alex Deucher

Applied. Thanks!

Many thanks!

Signature · 3 lines
Marco Crivellari

SUSE Labs