Re: [PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK
From: Nicholas Piggin
Date: Tue Oct 09 2018 - 06:54:41 EST
On Mon, 08 Oct 2018 20:59:56 +1100
Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 2018-10-08 at 09:16 +0000, Christophe Leroy wrote:
> > The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which
> > moves the thread_info into task_struct.
> We need to make sure we don't have code that assumes that we don't take
> faults on TI access.
> On ppc64, the stack SLB entries are bolted, which means the TI is too.
> We might have code that assumes that we don't get SLB faults when
> accessing TI. If not, we're fine but that needs a close look.
Oh, we do. I think the entry side might be okay, but on exit we have
at least one (in syscall and interrupt exit both):
* Disable interrupts so current_thread_info()->flags can't change,
* and so that we don't get interrupted after loading SRR0/1.
* For performance reasons we clear RI the same time that we
* clear EE. We only need to clear RI just before we restore r13
* below, but batching it with EE saves us one expensive mtmsrd call.
* We have to be careful to restore RI if we branch anywhere from
* here (eg syscall_exit_work).
#endif /* CONFIG_PPC_BOOK3E */
So taking an SLB there will cause an unrecoverable.
I think we can probably get rid of that optimization for now. I've found
for non-trivial syscalls it's often a loss if FP was used. I have a
couple of different options I'm working on to get rid of the mtmsrd
entirely we can go with instead (but I don't think those have to come
before Christophe's patch).