mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] sched/topology: Avoid unsequenced accesses to jiffies in sd_init()
Date: Thu, 26 Nov 2026 13:27:52 +0100	[thread overview]
Message-ID: <20261126122752.GB83911@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261126120809.GA83911@noisy.programming.kicks-ass.net>

On Thu, Nov 26, 2026 at 01:08:09PM +0100, Peter Zijlstra wrote:
> On Thu, Nov 26, 2026 at 12:50:32PM +0100, Peter Zijlstra wrote:

> > I just don't understand any of this. Perhaps I'm being super dense, but
> > calling this UB is utterly stupid IMO. It is trivial to define what
> > should happen here and make the compiler do it, although perhaps it is
> > not what people expect -- but at that point you can have a warning about
> > performance, rather than it being UB.
> > 
> > Most all of this is me being distrustful towards the C committee about
> > volatile; they hate it while we live by it.
> > 
> > But I really don't see the difference between two jiffie reads in an
> > initializer vs two jiffie reads in random code. Its just two reads that
> > cannot be fused, big deal.
> > 
> > So they're making a big deal out of the unsequenced thing; but at the
> > same time they're eroding actual sequence points; I mean WTF ?!
> > 
> > So function calls used to be a sequence point; but then they allowed
> > auto inlining (without the use of the inline keyword), and guess what?
> > An inlined function is explicitly not a sequence point.
> > 
> > So they cannot be both concerned about sequence *and* erode sequence.
> > 
> > All of this just sounds like a whole pile of wankery without actual
> > merit.
> > 
> > Also; the purported justification of UB has always been room for
> > optimization, but volatile is the anti-thesis of that, it explicitly
> > does not allow optimization. Marking something with volatile as UB is
> > just batshit.
> > 
> > I mean, I suppose I can apply the patch, but I'm not buying any of it.
> > This is not an improvement, it actively makes clang worse!
> 
> So, if we hide this evil volatile in an external function call; then the
> C frontend will not see this most evil of UB. If we then LTO these
> objects together, the optimizer will happily merge it all back together
> again.
> 
> There is no spoon^WUB.

Further idiocy; the only case where it would actually matter is with
MMIO; and there the multi register case is far more interesting than the
single register case. However, the C language is very specific about
only declaring the single object multiple times UB.

The more I look at this; the less sense it makes.

      reply	other threads:[~2026-11-26 12:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  7:23 Nathan Chancellor
2026-11-25  9:46 ` Peter Zijlstra
2026-11-25 19:32   ` Nick Desaulniers
2026-11-25 20:03     ` Nathan Chancellor
2026-11-26 11:50       ` Peter Zijlstra
2026-11-26 12:08         ` Peter Zijlstra
2026-11-26 12:27           ` Peter Zijlstra [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=20261126122752.GB83911@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=justinstitt@google.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®