Re: [PATCH v3 1/9] s390/alternatives: Add new ALT_TYPE_PERCPU type
From: David Laight
Date: Wed May 20 2026 - 08:43:30 EST
On Wed, 20 May 2026 11:22:35 +0200
Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
> The upcoming percpu section code uses two mviy instructions to guard the
> beginning and end of a percpu code section.
>
> The first mviy instruction writes the register number, which contains the
> percpu address to lowcore. This indicates both the beginning of a percpu
> code section and which register contains the percpu address.
>
> During compile time the mviy instruction is generated in a way that its
> base register contains the percpu register, and the immediate field is
> zero. This needs to be patched so that the base register is zero, and the
> immediate field contains the register number. For example
>
> 101424: eb 00 23 c0 00 52 mviy 960(%r2),0
>
> needs to be patched to
>
> 101424: eb 20 03 c0 00 52 mviy 960(%r0),2
I'm sure it is possible get the preprocessor to extract the register number
for you.
The exception table logic almost certainly already does it.
(The x86 version certainly does - and that is far less trivial.)
-- David
>
> Provide a new ALT_TYPE_PERCPU alternative type which handles this specific
> instruction patching. In addition it also handles the relocated lowcore
> case, where the displacement of the mviy instruction has a different value.