Re: [RFC PATCH 06/13] arm64: percpu: Add infrastructure for preemptible this_cpu_*() ops

From: Heiko Carstens

Date: Wed Jul 29 2026 - 04:25:56 EST


On Tue, Jul 28, 2026 at 06:51:29PM +0200, Heiko Carstens wrote:
> > If an exception is taken from within the critical section, the exception
> > return code will adjust <off> to be the current CPU's offset, and will
> > adjust <addr> to be (<pcp> + <off>). Distinct registers are used for
> > <pcp>, <off>, and <addr>, so that the fixup can be applied safely at any
> > point during the critical section.
>
> This looks indeed better than that what I came up with for s390.
>
> It works without comparing instruction pointers, also works out-of-the-box
> with kprobes, and hence the fixup is much simpler. I guess I'll try to change
> s390 to a similar mechanism and see what the result will look like. It will
> use one more instruction to the current version, as far as I can tell now, but
> the simplicity is probably worth it.

Hm.. unfortunately the required instructions (like an add that adds two
registers and puts the result in a third register), are not available on all
supported architecture levels on s390. But there are also other short comings
with the available instructions - so I don't think your approach will fly on
s390. Too bad.