[PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
Chaitanya Kulkarni
chaitanyak at nvidia.com
Sun May 31 19:18:22 PDT 2026
On 5/30/26 1:10 AM, Kuniyuki Iwashima wrote:
> Since commit 21c05ca88a54 ("workqueue: Add warnings and ensure
> one among WQ_PERCPU or WQ_UNBOUND is present"), we must explicitly
> set WQ_PERCPU or WQ_UNBOUND when creating workqueue.
>
> nvme_tcp_init_module() sets WQ_UNBOUND when the module param
> wq_unbound is set, but otherwise, WQ_PERCPU is missing, triggering
> the warning below:
>
> workqueue: nvme_tcp_wq is using neither WQ_PERCPU or WQ_UNBOUND. Setting WQ_PERCPU.
> WARNING: kernel/workqueue.c:5856 at __alloc_workqueue+0x1d02/0x2070 kernel/workqueue.c:5855, CPU#0: swapper/0/1
>
> Let's set WQ_PERCPU if wq_unbound is false.
>
> Reported-by: syzbot+d078cba4418e65f61984 at syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a1a9a86.323e8352.141b09.0001.GAE@google.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu at google.com>
> ---
> drivers/nvme/host/tcp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 22be0e0eee07..fcf54cc38c3c 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -3046,6 +3046,8 @@ static int __init nvme_tcp_init_module(void)
>
> if (wq_unbound)
> wq_flags |= WQ_UNBOUND;
> + else
> + wq_flags |= WQ_PERCPU;
>
> nvme_tcp_wq = alloc_workqueue("nvme_tcp_wq", wq_flags, 0);
> if (!nvme_tcp_wq)
Worth looking at blktests results with this.
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
-ck
More information about the Linux-nvme
mailing list