Skip to contentSkip to conversation

workqueue: Correct declaration of cpu_pwq in struct workqueue_struct

PATCH Applied Uros Bizjak 2 participants 2 messages Aug 5, 2024 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 workqueue: Correct declaration of cpu_pwq in struct workqueue_struct

cpu_pwq is used in various percpu functions that expect variable in __percpu address space. Correct the declaration of cpu_pwq to

struct pool_workqueue __rcu * __percpu *cpu_pwq

to declare the variable as __percpu pointer.

The patch also fixes following sparse errors:

workqueue.c:380:37: warning: duplicate [noderef]
workqueue.c:380:37: error: multiple address spaces given: __rcu & __percpu workqueue.c:2271:15: error: incompatible types in comparison expression (different address spaces):
workqueue.c:2271:15: struct pool_workqueue [noderef] __rcu *
workqueue.c:2271:15: struct pool_workqueue [noderef] __percpu *

and uncovers a couple of exisiting "incorrect type in assignment" warnings (from __rcu address space), which this patch does not address.

Found by GCC's named address space checks.

There were no changes in the resulting object files.

Cc Tejun Heo <[email protected]>
Cc Lai Jiangshan <[email protected]>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
index 1745ca788ede..32729a2e93af 100644
@@ -377,7 +377,7 @@ struct workqueue_struct {
 
 	/* hot fields used during command issue, aligned to cacheline */
 	unsigned int		flags ____cacheline_aligned; /* WQ: WQ_* flags */
-	struct pool_workqueue __percpu __rcu **cpu_pwq; /* I: per-cpu pwqs */
+	struct pool_workqueue __rcu * __percpu *cpu_pwq; /* I: per-cpu pwqs */
 	struct wq_node_nr_active *node_nr_active[]; /* I: per-node nr_active */
 };
 
Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 18 lines · Uros Bizjak

cpu_pwq is used in various percpu functions that expect variable in __percpu address space. Correct the declaration of cpu_pwq to

struct pool_workqueue __rcu * __percpu *cpu_pwq

to declare the variable as __percpu pointer.

The patch also fixes following sparse errors:

workqueue.c:380:37: warning: duplicate [noderef]
workqueue.c:380:37: error: multiple address spaces given: __rcu & __percpu workqueue.c:2271:15: error: incompatible types in comparison expression (different address spaces):
workqueue.c:2271:15: struct pool_workqueue [noderef] __rcu *
workqueue.c:2271:15: struct pool_workqueue [noderef] __percpu *

and uncovers a couple of exisiting "incorrect type in assignment" warnings (from __rcu address space), which this patch does not address.

Quoted 7 lines

Found by GCC's named address space checks.

There were no changes in the resulting object files.

Cc Tejun Heo <[email protected]>
Cc Lai Jiangshan <[email protected]>

Applied to wq/for-6.11-fixes.

Thanks.

Signature · 1 line
tejun