Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
@ 2026-05-30  8:10 Kuniyuki Iwashima
  2026-06-01  2:18 ` Chaitanya Kulkarni
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-05-30  8:10 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: Marco Crivellari, Tejun Heo, Kuniyuki Iwashima, Kuniyuki Iwashima,
	linux-nvme, syzbot+d078cba4418e65f61984

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@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6a1a9a86.323e8352.141b09.0001.GAE@google.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@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)
-- 
2.54.0.823.g6e5bcc1fc9-goog



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

* Re: [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
  2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
@ 2026-06-01  2:18 ` Chaitanya Kulkarni
  2026-06-01  7:11 ` Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2026-06-01  2:18 UTC (permalink / raw)
  To: Kuniyuki Iwashima, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg
  Cc: Marco Crivellari, Tejun Heo, Kuniyuki Iwashima,
	linux-nvme@lists.infradead.org,
	syzbot+d078cba4418e65f61984@syzkaller.appspotmail.com

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@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a1a9a86.323e8352.141b09.0001.GAE@google.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@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@nvidia.com>

-ck



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

* Re: [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
  2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
  2026-06-01  2:18 ` Chaitanya Kulkarni
@ 2026-06-01  7:11 ` Christoph Hellwig
  2026-06-01  7:14 ` Venkat
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2026-06-01  7:11 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Marco Crivellari, Tejun Heo, Kuniyuki Iwashima, linux-nvme,
	syzbot+d078cba4418e65f61984

Looks ok.  Although I would have much preferred we would not have
done these stupid changes to the workqueue interface to start with :(

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
  2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
  2026-06-01  2:18 ` Chaitanya Kulkarni
  2026-06-01  7:11 ` Christoph Hellwig
@ 2026-06-01  7:14 ` Venkat
  2026-06-01  7:26 ` Nilay Shroff
  2026-06-02 10:46 ` Keith Busch
  4 siblings, 0 replies; 6+ messages in thread
From: Venkat @ 2026-06-01  7:14 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Marco Crivellari, Tejun Heo, Kuniyuki Iwashima, linux-nvme,
	syzbot+d078cba4418e65f61984



> On 30 May 2026, at 1:40 PM, Kuniyuki Iwashima <kuniyu@google.com> 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@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a1a9a86.323e8352.141b09.0001.GAE@google.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---

This issue is seen on IBM Power server also [1].

And tested this patch, and it fixes reported issue. Please add below tag.

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>

[1]: https://lore.kernel.org/all/dab729b3-fa8e-4d17-894d-07f0c6845e01@linux.ibm.com/

Regards,
Venkat.
> 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)
> -- 
> 2.54.0.823.g6e5bcc1fc9-goog
> 
> 



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

* Re: [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
  2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
                   ` (2 preceding siblings ...)
  2026-06-01  7:14 ` Venkat
@ 2026-06-01  7:26 ` Nilay Shroff
  2026-06-02 10:46 ` Keith Busch
  4 siblings, 0 replies; 6+ messages in thread
From: Nilay Shroff @ 2026-06-01  7:26 UTC (permalink / raw)
  To: Kuniyuki Iwashima, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg
  Cc: Marco Crivellari, Tejun Heo, Kuniyuki Iwashima, linux-nvme,
	syzbot+d078cba4418e65f61984

On 5/30/26 1:40 PM, 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@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6a1a9a86.323e8352.141b09.0001.GAE@google.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@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)

Looks good to me.
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>


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

* Re: [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.
  2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
                   ` (3 preceding siblings ...)
  2026-06-01  7:26 ` Nilay Shroff
@ 2026-06-02 10:46 ` Keith Busch
  4 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2026-06-02 10:46 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Marco Crivellari,
	Tejun Heo, Kuniyuki Iwashima, linux-nvme,
	syzbot+d078cba4418e65f61984

On Sat, May 30, 2026 at 08:10:57AM +0000, 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.

Thanks, applied to nvme-7.2.


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

end of thread, other threads:[~2026-06-02 10:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-30  8:10 [PATCH] nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false Kuniyuki Iwashima
2026-06-01  2:18 ` Chaitanya Kulkarni
2026-06-01  7:11 ` Christoph Hellwig
2026-06-01  7:14 ` Venkat
2026-06-01  7:26 ` Nilay Shroff
2026-06-02 10:46 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox