Skip to contentSkip to conversation

nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.

PATCH Applied Kuniyuki Iwashima 6 participants 6 messages May 30 – Jun 2 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-tcp: Use WQ_PERCPU explicitly if wq_unbound is false.

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.

---
 drivers/nvme/host/tcp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvme/host/tcp.c +2 -0
index 22be0e0eee07..fcf54cc38c3c 100644
@@ -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)
Signature · 1 line
2.54.0.823.g6e5bcc1fc9-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Kuniyuki Iwashima

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.

---
  drivers/nvme/host/tcp.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/nvme/host/tcp.c +0 -0
index 22be0e0eee07..fcf54cc38c3c 100644

drivers/nvme/host/tcp.c static int __init nvme_tcp_init_module(void) · line 3053

Quoted 8 lines
drivers/nvme/host/tcp.c +2 -0
@@ -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.

-ck

Tested-by on v1 1/1
#3 lore raw
In reply to Kuniyuki Iwashima
Quoted 13 lines · Kuniyuki Iwashima

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.

Quoted 8 lines
 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.

---

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

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

[1]: https://lore.kernel.org/all/[email protected]/

Regards,
Venkat.

Quoted 20 lines

drivers/nvme/host/tcp.c | 2 ++

1 file changed, 2 insertions(+)
drivers/nvme/host/tcp.c +2 -0
index 22be0e0eee07..fcf54cc38c3c 100644
@@ -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)
Signature · 1 line
2.54.0.823.g6e5bcc1fc9-goog
Reviewed-by on v1 1/1
#4 lore raw
In reply to Kuniyuki Iwashima
Quoted 25 lines · Kuniyuki Iwashima

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.

---
  drivers/nvme/host/tcp.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/nvme/host/tcp.c +0 -0
index 22be0e0eee07..fcf54cc38c3c 100644

drivers/nvme/host/tcp.c static int __init nvme_tcp_init_module(void) · line 3053

Quoted 8 lines
drivers/nvme/host/tcp.c +2 -0
@@ -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.

maintainer Applied
#5 lore raw
In reply to Kuniyuki Iwashima
Quoted 3 lines · Kuniyuki Iwashima

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.