[PATCH v11 9/9] arm64: armv8_deprecated: apply FEAT_LSUI for swpX emulation.

Yeoreum Yun yeoreum.yun at arm.com
Fri Nov 7 06:19:11 PST 2025


Hi Arnd.

> On Thu, Nov 6, 2025, at 10:40, Yeoreum Yun wrote:
> > apply FEAT_LSUI instruction to emulate deprecated swpX instruction.
>
> Can you explain in the changrelog why you do this?
>
> In particular, is this a performance optimization or is this required
> for correctness in some scenario?

I think the main purpose using for this is to "remove the toggling the
PSTATE.PAN" bit. so that remove some *potential* problem which can
happen when PAN bit is cleared.

also, though swpb might add some complexity, but swp can get
a little bit of benifit by removing the ll/sc way and reduce
the amount of instructions.

> I would have expected that there is very little benefit in
> changing the swp/swpb emulation here if the existing code
> has to remain compiled into the kernel and the overhead of
> the trap is so much larger than the uaccess_enable_privileged()
> overhead.

Yeap. since the *trap* overhead is much larger than the
uaccess_enable_privileged() in the performnace perspecitve,
It would has a little effect. However, as I mention above,
the main purpose of this is to remove toggling the PSTATE.PAN
if possible. there would be a little bit of additional commplexity
for swpb but it seems affordable.

Thanks.

[...]

--
Sincerely,
Yeoreum Yun



More information about the linux-arm-kernel mailing list