On Mon, 22 May 2017 08:09:19 +1000 Benjamin Herrenschmidt <b...@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. It's easy to drop the fixed r14 in future if we can. None of the incidental asm users of r14 were complicating them by moving them to another register. Thanks, Nick