Re: [PATCH v3 11/11] s390/percpu: Rework to simplify percpu_entry() and percpu_exit()

From: Heiko Carstens

Date: Mon Sep 21 2026 - 06:33:58 EST


On Mon, Sep 21, 2026 at 11:07:04AM +0100, Mark Rutland wrote:
> On Mon, Sep 21, 2026 at 10:55:18AM +0100, David Laight wrote:
> > On Mon, 21 Sep 2026 10:40:05 +0200
> > Heiko Carstens <hca@xxxxxxxxxxxxx> wrote:
>
> > > + regpcp = FIELD_GET(PCPU_REG_PCP, regval);
> > > + regoff = FIELD_GET(PCPU_REG_OFF, regval);
> > ...
> > > +#define PCPU_REG_PCP_SHIFT 0
> > > +#define PCPU_REG_PCP GENMASK(3, 0)
> > > +#define PCPU_REG_OFF_SHIFT 4
> > > +#define PCPU_REG_OFF GENMASK(7, 4)
> > ...
> > > +#define __PCPU_CALC_REGVAL(regpcp, regoff) \
> > > + "(" regpcp " << " __stringify(PCPU_REG_PCP_SHIFT) ") |" \
> > > + "(" regoff " << " __stringify(PCPU_REG_OFF_SHIFT) ")"
> >
> > I'm not a big fan of GENMASK() + FIELD_GET() and I'm not at all sure it
> > really helps here.
>
> It's the same pattern already used by the extable code.
>
> While _you_ don't like it, that's not a universal opinion (and FWIW, I
> prefer the FIELD_GET() approach).
>
> I'll leave it to Heiko and co to choose whatever style they prefer, as
> it's their architecture port...

As Mark said: it is already used, and in addition I would like to have s390
architecture code quite similar to other architectures whenever possible.

This simplifies cross architecture changes, even though it seems unlikely that
somebody would ever touch this particular code across architectures.