[PATCH] smp: align struct __call_single_node to 8 bytes

Brian Cain posted 1 patch 2 weeks, 5 days ago
There is a newer version of this series
include/linux/smp_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] smp: align struct __call_single_node to 8 bytes
Posted by Brian Cain 2 weeks, 5 days ago
Consumers walking call_single_queue cast each node to call_single_data_t
and, given that type's declared over-alignment, the compiler may load
llist.next and u_flags as one naturally aligned double word.  Embedders
such as task_struct::wake_entry only guarantee pointer alignment, which
faults on strict-alignment 32-bit architectures like hexagon.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-hexagon@vger.kernel.org
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
 include/linux/smp_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/smp_types.h b/include/linux/smp_types.h
index 2e8461af8df6..5773e1fb2660 100644
--- a/include/linux/smp_types.h
+++ b/include/linux/smp_types.h
@@ -64,6 +64,6 @@ struct __call_single_node {
 #ifdef CONFIG_64BIT
 	u16 src, dst;
 #endif
-};
+} __aligned(8);
 
 #endif /* __LINUX_SMP_TYPES_H */
-- 
2.34.1
Re: [PATCH] smp: align struct __call_single_node to 8 bytes
Posted by Philippe Mathieu-Daudé 2 days, 19 hours ago
On 2026-09-06 4:39, Brian Cain wrote:
> Consumers walking call_single_queue cast each node to call_single_data_t
> and, given that type's declared over-alignment, the compiler may load
> llist.next and u_flags as one naturally aligned double word.  Embedders

"Embedders" is not easy to understand for non-native English speaker,
is it a typo? Regardless:

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

> such as task_struct::wake_entry only guarantee pointer alignment, which
> faults on strict-alignment 32-bit architectures like hexagon.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: linux-hexagon@vger.kernel.org
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>   include/linux/smp_types.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)