[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68bd3bbd-66cd-8acc-1e17-c677193172a5@linux-m68k.org>
Date: Mon, 6 Oct 2025 20:25:59 +1100 (AEDT)
From: Finn Thain <fthain@...ux-m68k.org>
To: Arnd Bergmann <arnd@...db.de>
cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Peter Zijlstra <peterz@...radead.org>, Will Deacon <will@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Boqun Feng <boqun.feng@...il.com>, Jonathan Corbet <corbet@....net>,
Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>, linux-m68k@...r.kernel.org,
Lance Yang <lance.yang@...ux.dev>
Subject: Re: [RFC v2 2/3] atomic: Specify alignment for atomic_t and
atomic64_t
On Wed, 1 Oct 2025, Arnd Bergmann wrote:
> >> Since there is nothing telling the compiler that the 'old' argument
> >> to atomic*_try_cmpcxchg() needs to be naturally aligned, maybe that
> >> check should be changed to only test for the ABI-guaranteed
> >> alignment? I think that would still be needed on x86-32.
> >>
> >
> > I don't know why we would check the alignment of the 'old' quantity.
> > It's going to be loaded into a register before being used, right?
>
> I was wondering about that as well, but checking for alignof(*old)
> probably can't hurt. The only architectures that actually have a custom
> arch_try_cmpxchg*() are s390 and x86 and those don't care about
> alignmnent of 'old', but it's possible that another architecture that
> can't handle unaligned load/store would add an inline asm implementation
> in the future and break if an alignment fixup happens in the middle of
> an ll/sc loop.
>
That hypothetical future requirement seems improbable to me. Moreover,
would such an architecture have a need for CONFIG_DEBUG_ATOMIC?
Powered by blists - more mailing lists