mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Brian Cain" <brian.cain@oss.qualcomm.com>,
	linux-kernel@vger.kernel.org, pierrick.bouvier@oss.qualcomm.com,
	paulmck@kernel.org, sid.manning@oss.qualcomm.com,
	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: Thu, 24 Sep 2026 12:04:19 +0100	[thread overview]
Message-ID: <20260924120419.6cefb60d@pumpkin> (raw)
In-Reply-To: <20260924093450.GN2009045@noisy.programming.kicks-ass.net>

On Thu, 24 Sep 2026 11:34:50 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> On Wed, Sep 23, 2026 at 08:43:07AM -0700, 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.  Fields using
> > this type, such as task_struct::wake_entry only guarantee pointer alignment,
> > which faults on strict-alignment 32-bit architectures like hexagon.  
> 
> Where exactly does this happen? I'm failing with grep.
> 

Here for one:

void __smp_call_single_queue(int cpu, struct llist_node *node)
{
	/*
	 * We have to check the type of the CSD before queueing it, because
	 * once queued it can have its flags cleared by
	 *   flush_smp_call_function_queue()
	 * even if we haven't sent the smp_call IPI yet (e.g. the stopper
	 * executes migration_cpu_stop() on the remote CPU).
	 */
	if (trace_csd_queue_cpu_enabled()) {
		call_single_data_t *csd;
		smp_call_func_t func;

		csd = container_of(node, call_single_data_t, node.llist);
		func = CSD_TYPE(csd) == CSD_TYPE_TTWU ?
			sched_ttwu_pending : csd->func;

		trace_call__csd_queue_cpu(cpu, _RET_IP_, func, csd);
	}

since the data item itself was probably created with:

#define CSD_INIT(_func, _info) \
	(struct __call_single_data){ .func = (_func), .info = (_info), }

I've not looked hard enough to see what the extra alignment was trying
to achieve.
But the above function needs to use the 'less aligned' struct __call_single_data
even if some places use call_single_data_t to get a 'more aligned' structure.

David

      reply	other threads:[~2026-09-24 11:04 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
2026-09-24  9:34 ` Peter Zijlstra
2026-09-24 11:04   ` David Laight [this message]

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=20260924120419.6cefb60d@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®