[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aH9NFffW6L2TpDVW@e129823.arm.com>
Date: Tue, 22 Jul 2025 09:34:29 +0100
From: Yeoreum Yun <yeoreum.yun@....com>
To: Mark Rutland <mark.rutland@....com>
Cc: catalin.marinas@....com, will@...nel.org, broonie@...nel.org,
oliver.upton@...ux.dev, ardb@...nel.org, frederic@...nel.org,
james.morse@....com, joey.gouly@....com,
scott@...amperecomputing.com, maz@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 5/7] arm64/futex: add futex atomic operation with
FEAT_LSUI
Hi Mark,
> > Current futex atomic operations are implemented with ll/sc instructions and
> > clearing PSTATE.PAN.
> >
> > Since Armv9.6, FEAT_LSUI supplies not only load/store instructions but
> > also atomic operation for user memory access in kernel it doesn't need
> > to clear PSTATE.PAN bit anymore.
> >
> > With theses instructions some of futex atomic operations don't need to
> > be implmented with ldxr/stlxr pair instead can be implmented with
> > one atomic operation supplied by FEAT_LSUI.
> >
> > However, some of futex atomic operations still need to use ll/sc way
> > via ldtxr/stltxr supplied by FEAT_LSUI since there is no correspondant
> > atomic instruction or doesn't support word size operation
> > (i.e) eor, cas{mb}t But It's good to work without clearing PSTATE.PAN bit.
>
> That's unfortunate; have we fed back to Arm's architecture folks that we
> care about those cases?
I haven’t done so yet. If you don’t mind,
could you let me know the appropriate person to give the feedback to?
>
> > Signed-off-by: Yeoreum Yun <yeoreum.yun@....com>
> > ---
> > arch/arm64/include/asm/futex_lsui.h | 132 ++++++++++++++++++++++++++++
> > 1 file changed, 132 insertions(+)
> > create mode 100644 arch/arm64/include/asm/futex_lsui.h
>
> This logic is introduced unused, and TBH I don't think this needs to be
> in a separate header.
>
> I reckon it's be better to keep all of this in <asm/futex.h> and rework
> the series to:
>
> (1) Factor out the existing LL/SC logic into separate LL/SC helpers in
> <asm/futex.h>, with an __llsc_ prefix, called by the existing
> functions.
>
> (2) Add the new __lsui_ futex operations to <asm/futex.h>, along with
> code to select between the __llsc_ and __lsui_ versions.
>
> We split the regular atomics different becuase there are *many* generic
> atomic operations, but I don't think it's worthwhile to split the futex
> logic over several headers.
>
> Maybe it's worth having <asm/lsui.h>, but for now I reckon it's best to
> also fold that into <asm/futex.h>, and we can split it out later if we
> need it for something else.
Thanks for your suggestion.
I’ll rework it while keeping this implementation.
Thanks!
--
Sincerely,
Yeoreum Yun
Powered by blists - more mailing lists