linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK
Date: Tue, 9 Oct 2018 20:54:30 +1000	[thread overview]
Message-ID: <20181009205430.351134eb@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <df8575fba80d19e6e58c16266350e9980c432ae1.camel@kernel.crashing.org>

On Mon, 08 Oct 2018 20:59:56 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> 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.
         */
#ifdef CONFIG_PPC_BOOK3E
        wrteei  0
#else
        /*
         * 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).
         */
        li      r11,0
        mtmsrd  r11,1
#endif /* CONFIG_PPC_BOOK3E */

        ld      r9,TI_FLAGS(r12)

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).

Thanks,
Nick

      reply	other threads:[~2018-10-09 10:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08  9:16 [PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 1/9] book3s/64: avoid circular header inclusion in mmu-hash.h Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 2/9] powerpc: Only use task_struct 'cpu' field on SMP Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 3/9] powerpc: Prepare for moving thread_info into task_struct Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 4/9] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 5/9] powerpc: regain entire stack space Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 6/9] powerpc: 'current_set' is now a table of task_struct pointers Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 7/9] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 8/9] powerpc/64: Remove CURRENT_THREAD_INFO Christophe Leroy
2018-10-08  9:16 ` [PATCH v6 9/9] powerpc: clean stack pointers naming Christophe Leroy
2018-10-08  9:59 ` [PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK Benjamin Herrenschmidt
2018-10-09 10:54   ` Nicholas Piggin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181009205430.351134eb@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).