[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260127101334.352794d1@pumpkin>
Date: Tue, 27 Jan 2026 10:13:34 +0000
From: David Laight <david.laight.linux@...il.com>
To: Marco Elver <elver@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Will Deacon <will@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Boqun
Feng <boqun.feng@...il.com>, Waiman Long <longman@...hat.com>, Bart Van
Assche <bvanassche@....org>, llvm@...ts.linux.dev, Catalin Marinas
<catalin.marinas@....com>, Arnd Bergmann <arnd@...db.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] arm64: Optimize __READ_ONCE() with CONFIG_LTO=y
On Tue, 27 Jan 2026 00:15:38 +0100
Marco Elver <elver@...gle.com> wrote:
> On Mon, 26 Jan 2026 at 12:16, David Laight <david.laight.linux@...il.com> wrote:
> >
> > On Mon, 26 Jan 2026 01:25:11 +0100
> > Marco Elver <elver@...gle.com> wrote:
...
> > Also is the 'default' branch even needed?
> > READ_ONCE() rejects sizes other than 1, 2, 4 and 8.
> > A quick search only found one oversize read - for 'struct vcpu_runstate_info'
> > in arch/x86/kvm/xen.c
> > Requiring that code use a different define might make sense.
> >
> > I also did some x86-64 build timings with compiletime_assert_rwonce_type()
> > commented out.
> > Expanding and compiling that check seems to add just over 1% to the
> > build time.
> > So anything to shrink that define is likely to be noticeable.
>
> The compiletime_assert_rwonce_type() is for the benefit of the
> asm-generic variant, which is implemented like the 'default' case here
> by default.
True, but compiletime_assert_rwonce_type() stops you getting to the
'default' case in this version - unless code uses __READ_ONCE() and
I couldn't find any examples.
So the 'default' could probably just be a BUILD_BUG_ON().
Although part of the 'bloat' from compiletime_assert_rwonce_type() is
the repeated definition of the error function.
A few places define an 'error function' rather than using
compiletime_assert(), perhaps there should be:
#define compiletime_error_fn(name, msg) \
__noreturn extern void name __compiletime_error(msg)
for consistency.
If compiletime_assert_rwonce_type() used a named function this code
could just call the same one.
> This here is only the arm64 override of all that with LTO.
I keep missing that conditional (and that it means clang) ...
It also explains why only a few builds get a signedness error from min()
because the 'atomic ? x : y' causes integer promotion to happen.
David
Powered by blists - more mailing lists