Re: [External] Re: [PATCH v10 2/9] riscv: add infrastructure for preemptible this_cpu operations

From: yunhui cui

Date: Thu Dec 03 2026 - 07:37:40 EST


Hi David,

On Thu, Nov 12, 2026 at 8:03 PM David Laight
<david.laight.linux@xxxxxxxxx> wrote:
>
> On Thu, 12 Nov 2026 18:41:42 +0800
> Yunhui Cui <cuiyunhui@xxxxxxxxxxxxx> wrote:
>
> > +/*
> > + * Mark a region where the per-CPU offset and address registers may need to
> > + * be rewritten by exception return after migration. The three registers
> > + * must remain distinct for the whole region.
> > + */
> > +#define __PCPU_GPRS_BEGIN \
> > + __DEFINE_ASM_GPR_NUMS \
> > + __PCPU_GPRS_ASSERT_DISTINCT \
> > + "li %[off], " __PCPU_GPRS_VALUE "\n" \
> > + "sh %[off], %[gprs]\n" \
> > + REG_L " %[off], %[pcpu_offset]\n" \
> > + "add %[addr], %[pcp], %[off]\n"
> > +
> > +#define __PCPU_GPRS_END \
> > + "sh zero, %[gprs]\n"
>
> Those are quite nasty with all the hidden variable names.
> It wouldn't do any harm to pass the names though.

Thanks for the suggestion, David. I'll update this in the next revision.

Thanks,
Yunhui

>
> David