From: David Laight <david.laight.linux@gmail.com>
To: Brian Cain <brian.cain@oss.qualcomm.com>
Cc: linux-kernel@vger.kernel.org, pierrick.bouvier@oss.qualcomm.com,
paulmck@kernel.org, sid.manning@oss.qualcomm.com,
peterz@infradead.org, linux-hexagon@vger.kernel.org,
"Ingo Molnar" <mingo@kernel.org>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: Re: [PATCH v2] smp: align struct __call_single_node to 8 bytes
Date: Wed, 23 Sep 2026 23:09:51 +0100 [thread overview]
Message-ID: <20260923230951.29231158@pumpkin> (raw)
In-Reply-To: <20260923154307.3625611-1-brian.cain@oss.qualcomm.com>
On Wed, 23 Sep 2026 08:43:07 -0700
Brian Cain <brian.cain@oss.qualcomm.com> 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. Fields using
> this type, such as task_struct::wake_entry only guarantee pointer alignment,
> which faults on strict-alignment 32-bit architectures like hexagon.
I think the same could happen on arm64.
The compiler is being told the alignment is 4*sizeof(long)), but I doubt it
can ever matter that it is more than 2*sizeof(long).
The other option is to only ever use call_single_data_t to get an aligned
version of the structure and use the struct everywhere else.
The compiler won't be able to use the 'load two register' instruction, but
I doubt that will be measurable.
David
>
> 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
> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> 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 */
next prev parent reply other threads:[~2026-09-23 22:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 15:43 Brian Cain
2026-09-23 22:09 ` David Laight [this message]
2026-09-24 9:34 ` Peter Zijlstra
2026-09-24 11:04 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923230951.29231158@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=brian.cain@oss.qualcomm.com \
--cc=frederic@kernel.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=sid.manning@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®