* [PATCH] usb: xhci: replace use of system_wq with system_percpu_wq
@ 2025-11-06 14:54 Marco Crivellari
2025-11-12 12:00 ` Mathias Nyman
0 siblings, 1 reply; 3+ messages in thread
From: Marco Crivellari @ 2025-11-06 14:54 UTC (permalink / raw)
To: linux-kernel, linux-usb
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Marco Crivellari, Michal Hocko,
Mathias Nyman, Greg Kroah-Hartman
Currently if a user enqueues a work item using schedule_delayed_work() the
used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
schedule_work() that is using system_wq and queue_work(), that makes use
again of WORK_CPU_UNBOUND.
This lack of consistency cannot be addressed without refactoring the API.
This continues the effort to refactor workqueue APIs, which began with
the introduction of new workqueues and a new alloc_workqueue flag in:
commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
Switch to using system_percpu_wq because system_wq is going away as part of
a workqueue restructuring.
Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
---
drivers/usb/host/xhci-dbgcap.c | 8 ++++----
drivers/usb/host/xhci-ring.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index ecda964e018a..9da4f3b452cb 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -374,7 +374,7 @@ int dbc_ep_queue(struct dbc_request *req)
ret = dbc_ep_do_queue(req);
spin_unlock_irqrestore(&dbc->lock, flags);
- mod_delayed_work(system_wq, &dbc->event_work, 0);
+ mod_delayed_work(system_percpu_wq, &dbc->event_work, 0);
trace_xhci_dbc_queue_request(req);
@@ -677,7 +677,7 @@ static int xhci_dbc_start(struct xhci_dbc *dbc)
return ret;
}
- return mod_delayed_work(system_wq, &dbc->event_work,
+ return mod_delayed_work(system_percpu_wq, &dbc->event_work,
msecs_to_jiffies(dbc->poll_interval));
}
@@ -1023,7 +1023,7 @@ static void xhci_dbc_handle_events(struct work_struct *work)
return;
}
- mod_delayed_work(system_wq, &dbc->event_work,
+ mod_delayed_work(system_percpu_wq, &dbc->event_work,
msecs_to_jiffies(poll_interval));
}
@@ -1274,7 +1274,7 @@ static ssize_t dbc_poll_interval_ms_store(struct device *dev,
dbc->poll_interval = value;
- mod_delayed_work(system_wq, &dbc->event_work, 0);
+ mod_delayed_work(system_percpu_wq, &dbc->event_work, 0);
return size;
}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8e209aa33ea7..3d05734c8377 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -434,7 +434,7 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)
static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci)
{
- return mod_delayed_work(system_wq, &xhci->cmd_timer,
+ return mod_delayed_work(system_percpu_wq, &xhci->cmd_timer,
msecs_to_jiffies(xhci->current_cmd->timeout_ms));
}
--
2.51.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: xhci: replace use of system_wq with system_percpu_wq
2025-11-06 14:54 [PATCH] usb: xhci: replace use of system_wq with system_percpu_wq Marco Crivellari
@ 2025-11-12 12:00 ` Mathias Nyman
2025-11-12 12:03 ` Marco Crivellari
0 siblings, 1 reply; 3+ messages in thread
From: Mathias Nyman @ 2025-11-12 12:00 UTC (permalink / raw)
To: Marco Crivellari, linux-kernel, linux-usb
Cc: Tejun Heo, Lai Jiangshan, Frederic Weisbecker,
Sebastian Andrzej Siewior, Michal Hocko, Mathias Nyman,
Greg Kroah-Hartman
On 11/6/25 16:54, Marco Crivellari wrote:
> Currently if a user enqueues a work item using schedule_delayed_work() the
> used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use
> WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to
> schedule_work() that is using system_wq and queue_work(), that makes use
> again of WORK_CPU_UNBOUND.
>
> This lack of consistency cannot be addressed without refactoring the API.
>
> This continues the effort to refactor workqueue APIs, which began with
> the introduction of new workqueues and a new alloc_workqueue flag in:
>
> commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
> commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
>
> Switch to using system_percpu_wq because system_wq is going away as part of
> a workqueue restructuring.
>
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
> ---
Thanks, added to queue
-Mathias
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: xhci: replace use of system_wq with system_percpu_wq
2025-11-12 12:00 ` Mathias Nyman
@ 2025-11-12 12:03 ` Marco Crivellari
0 siblings, 0 replies; 3+ messages in thread
From: Marco Crivellari @ 2025-11-12 12:03 UTC (permalink / raw)
To: Mathias Nyman
Cc: linux-kernel, linux-usb, Tejun Heo, Lai Jiangshan,
Frederic Weisbecker, Sebastian Andrzej Siewior, Michal Hocko,
Mathias Nyman, Greg Kroah-Hartman
On Wed, Nov 12, 2025 at 1:00 PM Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
> [...]
> Thanks, added to queue
> -Mathias
>
Many thanks!
--
Marco Crivellari
L3 Support Engineer, Technology & Product
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-12 12:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-06 14:54 [PATCH] usb: xhci: replace use of system_wq with system_percpu_wq Marco Crivellari
2025-11-12 12:00 ` Mathias Nyman
2025-11-12 12:03 ` Marco Crivellari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®