[RFC][PATCH] powerpc/64s: stop using r14 register

Michael Ellerman mpe at ellerman.id.au
Mon May 22 14:02:09 AEST 2017


Nicholas Piggin <npiggin at gmail.com> writes:

> On Mon, 22 May 2017 08:09:19 +1000
> Benjamin Herrenschmidt <benh at au1.ibm.com> wrote:
>
>> On Mon, 2017-05-22 at 00:00 +1000, Nicholas Piggin wrote:
>> > I'd like to take over the r14 register for use as a per-cpu kernel
>> > register similar to the way r13 is used for the paca.  
>> 
>> Why not use r13 instead ? We don't need to access the PACA that often
>> from C code, I thought we could flip them...
>
> It ended up being a bit too tricky to do it that way. We can't get
> directly to per-CPU data from the per-cpu data offset in exception
> entry code for a number of reasons. So we end up having to load the
> paca first.
>
> I looked at swapping r13 from paca to per-cpu offset at the same
> time the stack is set up, so paca is used for early save areas then
> per-cpu is used in C code. In practice it ended up getting too
> tricky and fragile dealing with nested interrupts, machine checks,
> etc.
>
> I think it's something we might slowly work towards (consolidating
> back to one fixed register), but as things are it didn't work well.

Yep, agree 100%.

We've talked about flipping r13 for 10 years, rather than spending
another 10 this is a good way to evolve things in the right direction.

cheers


More information about the Linuxppc-dev mailing list