mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] workqueue: Correct declaration of cpu_pwq in struct workqueue_struct
@ 2024-08-05  7:30 Uros Bizjak
  2024-08-05 20:31 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2024-08-05  7:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Uros Bizjak, Tejun Heo, Lai Jiangshan

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.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1745ca788ede..32729a2e93af 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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 */
 };
 
-- 
2.45.2


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

* Re: [PATCH] workqueue: Correct declaration of cpu_pwq in struct workqueue_struct
  2024-08-05  7:30 [PATCH] workqueue: Correct declaration of cpu_pwq in struct workqueue_struct Uros Bizjak
@ 2024-08-05 20:31 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2024-08-05 20:31 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: linux-kernel, Lai Jiangshan

On Mon, Aug 05, 2024 at 09:30:29AM +0200, Uros Bizjak wrote:
> 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.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>

Applied to wq/for-6.11-fixes.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2024-08-05 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-05  7:30 [PATCH] workqueue: Correct declaration of cpu_pwq in struct workqueue_struct Uros Bizjak
2024-08-05 20:31 ` Tejun Heo

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®