[{"id":1758958,"web_url":"http://patchwork.ozlabs.org/comment/1758958/","msgid":"<20170829002048.GG12629@fergus.ozlabs.ibm.com>","date":"2017-08-29T00:20:48","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":67079,"url":"http://patchwork.ozlabs.org/api/people/67079/","name":"Paul Mackerras","email":"paulus@ozlabs.org"},"content":"On Fri, Aug 25, 2017 at 02:30:36PM +1000, Nicholas Piggin wrote:\n> When stop is executed with EC=ESL=0, it appears to execute like a\n> normal instruction (resuming from NIP when woken by interrupt).\n> So all the save/restore handling can be avoided completely. In\n> particular NV GPRs do not have to be saved, and MSR does not have\n> to be switched back to kernel MSR.\n> \n> So move the test for \"lite\" sleep states out to power9_idle_stop.\n> \n> Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n> ---\n>  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n>  1 file changed, 24 insertions(+), 11 deletions(-)\n> \n> diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S\n> index 32d65ee323a0..fa56120bd0bc 100644\n> --- a/arch/powerpc/kernel/idle_book3s.S\n> +++ b/arch/powerpc/kernel/idle_book3s.S\n> @@ -315,9 +315,6 @@ enter_winkle:\n>  \n>  \tARCH207_IDLE_STATE_ENTER_SEQ_NORET(PPC_WINKLE)\n>  \n> -/*\n> - * r3 - PSSCR value corresponding to the requested stop state.\n> - */\n>  #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n>  power_enter_stop_kvm_rm:\n>  \t/*\n> @@ -330,14 +327,11 @@ power_enter_stop_kvm_rm:\n>  \tli\tr4,KVM_HWTHREAD_IN_IDLE\n>  \t/* DO THIS IN REAL MODE!  See comment above. */\n>  \tstb\tr4,HSTATE_HWTHREAD_STATE(r13)\n> -#endif\n> -power_enter_stop:\n>  /*\n>   * Check if we are executing the lite variant with ESL=EC=0\n>   */\n> -\tandis.   r4,r3,PSSCR_EC_ESL_MASK_SHIFTED\n> -\tclrldi   r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */\n> -\tbne\t .Lhandle_esl_ec_set\n> +\tandis.\tr4,r3,PSSCR_EC_ESL_MASK_SHIFTED\n> +\tbne\tpower_enter_stop_esl\n>  \tPPC_STOP\n>  \tli\tr3,0  /* Since we didn't lose state, return 0 */\n>  \n> @@ -354,8 +348,13 @@ power_enter_stop:\n>  \t */\n>  \tli\tr12, 0\n>  \tb \tpnv_wakeup_noloss\n> +#endif\n>  \n> -.Lhandle_esl_ec_set:\n> +/*\n> + * r3 - PSSCR value corresponding to the requested stop state.\n> + */\n> +power_enter_stop_esl:\n> +\tclrldi   r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */\n>  \t/*\n>  \t * POWER9 DD2 can incorrectly set PMAO when waking up after a\n>  \t * state-loss idle. Saving and restoring MMCR0 over idle is a\n> @@ -428,9 +427,23 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66);\t\t\\\n>   * r3 contains desired PSSCR register value.\n>   */\n>  _GLOBAL(power9_idle_stop)\n> -\tstd\tr3, PACA_REQ_PSSCR(r13)\n>  \tmtspr \tSPRN_PSSCR,r3\n> -\tLOAD_REG_ADDR(r4,power_enter_stop)\n> +\n> +\t/*\n> +\t * Check if we are executing the lite variant with ESL=EC=0\n> +\t * This case resumes execution after the stop instruction without\n> +\t * losing any state, so nothing has to be saved. The following\n> +\t * instructions up to the blr must be skipped if we want to\n> +\t * use power_enter_stop_kvm_rm.\n> +\t */\n> +\tandis.\tr4,r3,PSSCR_EC_ESL_MASK_SHIFTED\n\nI realize you're just moving existing code, but I think this would be\nclearer (to me, anyway) as\n\n\tandis.\tr4, r3, (PSSCR_EC | PSSCR_ESL)@h\n\nApart from that very minor nit,\n\nReviewed-by: Paul Mackerras <paulus@ozlabs.org>","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xh8d0091Lz9s65\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 10:28:36 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xh8cz5lSfzDqHt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 10:28:35 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xh8S41dt1zDqGX\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 10:20:52 +1000 (AEST)","by ozlabs.org (Postfix, from userid 1003)\n\tid 3xh8S40YsWz9sNr; Tue, 29 Aug 2017 10:20:51 +1000 (AEST)"],"Authentication-Results":["ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"R2GXSlan\";\n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"R2GXSlan\";\n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"R2GXSlan\"; \n\tdkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; \n\tt=1503966052; bh=iYV1bQfT0LJy8PzjEOfCU0T0J5wFo7GyLqDKL+JDKVY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=R2GXSlanMreSep2m4qzmSmu1iJmjls48DRkKiYOTtO6x9YaJ28KR/g2JClGN75pfe\n\tSEaJpSPTY226O+JolgMeVYw0h3vrZ4bQTWheUko7ahCHywblPB9rjKuBj9SfCSPCoV\n\tTG+QXlBXk1F6kzp6QZ6QCRhkeeixffwgzVusGVkHQzxuhCW+Ebu6J+I9Mvrvy3WmqE\n\t8Pk3AHeK9fH3WRfvVUKfy2kryX8QpvybMHKn0iVXi94bK1TFQvixXQ/ODeasx+JmeS\n\tfUa46R0UPkpYjyX8NISSTy4lyYDtFk0CedAtMKw1Ji8U7otn9GlDtwQreo8PP7DRDz\n\tqB6/E7klOg2oA==","Date":"Tue, 29 Aug 2017 10:20:48 +1000","From":"Paul Mackerras <paulus@ozlabs.org>","To":"Nicholas Piggin <npiggin@gmail.com>","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","Message-ID":"<20170829002048.GG12629@fergus.ozlabs.ibm.com>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170825043036.18236-5-npiggin@gmail.com>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1758977,"web_url":"http://patchwork.ozlabs.org/comment/1758977/","msgid":"<20170829113937.11ccc94b@roar.ozlabs.ibm.com>","date":"2017-08-29T01:39:37","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/people/69518/","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"content":"On Tue, 29 Aug 2017 10:20:48 +1000\nPaul Mackerras <paulus@ozlabs.org> wrote:\n\n> On Fri, Aug 25, 2017 at 02:30:36PM +1000, Nicholas Piggin wrote:\n> > When stop is executed with EC=ESL=0, it appears to execute like a\n> > normal instruction (resuming from NIP when woken by interrupt).\n> > So all the save/restore handling can be avoided completely. In\n> > particular NV GPRs do not have to be saved, and MSR does not have\n> > to be switched back to kernel MSR.\n> > \n> > So move the test for \"lite\" sleep states out to power9_idle_stop.\n> > \n> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n> > ---\n> >  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n> >  1 file changed, 24 insertions(+), 11 deletions(-)\n> > \n> > diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S\n> > index 32d65ee323a0..fa56120bd0bc 100644\n> > --- a/arch/powerpc/kernel/idle_book3s.S\n> > +++ b/arch/powerpc/kernel/idle_book3s.S\n> > @@ -315,9 +315,6 @@ enter_winkle:\n> >  \n> >  \tARCH207_IDLE_STATE_ENTER_SEQ_NORET(PPC_WINKLE)\n> >  \n> > -/*\n> > - * r3 - PSSCR value corresponding to the requested stop state.\n> > - */\n> >  #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE\n> >  power_enter_stop_kvm_rm:\n> >  \t/*\n> > @@ -330,14 +327,11 @@ power_enter_stop_kvm_rm:\n> >  \tli\tr4,KVM_HWTHREAD_IN_IDLE\n> >  \t/* DO THIS IN REAL MODE!  See comment above. */\n> >  \tstb\tr4,HSTATE_HWTHREAD_STATE(r13)\n> > -#endif\n> > -power_enter_stop:\n> >  /*\n> >   * Check if we are executing the lite variant with ESL=EC=0\n> >   */\n> > -\tandis.   r4,r3,PSSCR_EC_ESL_MASK_SHIFTED\n> > -\tclrldi   r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */\n> > -\tbne\t .Lhandle_esl_ec_set\n> > +\tandis.\tr4,r3,PSSCR_EC_ESL_MASK_SHIFTED\n> > +\tbne\tpower_enter_stop_esl\n> >  \tPPC_STOP\n> >  \tli\tr3,0  /* Since we didn't lose state, return 0 */\n> >  \n> > @@ -354,8 +348,13 @@ power_enter_stop:\n> >  \t */\n> >  \tli\tr12, 0\n> >  \tb \tpnv_wakeup_noloss\n> > +#endif\n> >  \n> > -.Lhandle_esl_ec_set:\n> > +/*\n> > + * r3 - PSSCR value corresponding to the requested stop state.\n> > + */\n> > +power_enter_stop_esl:\n> > +\tclrldi   r3,r3,60 /* r3 = Bits[60:63] = Requested Level (RL) */\n> >  \t/*\n> >  \t * POWER9 DD2 can incorrectly set PMAO when waking up after a\n> >  \t * state-loss idle. Saving and restoring MMCR0 over idle is a\n> > @@ -428,9 +427,23 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66);\t\t\\\n> >   * r3 contains desired PSSCR register value.\n> >   */\n> >  _GLOBAL(power9_idle_stop)\n> > -\tstd\tr3, PACA_REQ_PSSCR(r13)\n> >  \tmtspr \tSPRN_PSSCR,r3\n> > -\tLOAD_REG_ADDR(r4,power_enter_stop)\n> > +\n> > +\t/*\n> > +\t * Check if we are executing the lite variant with ESL=EC=0\n> > +\t * This case resumes execution after the stop instruction without\n> > +\t * losing any state, so nothing has to be saved. The following\n> > +\t * instructions up to the blr must be skipped if we want to\n> > +\t * use power_enter_stop_kvm_rm.\n> > +\t */\n> > +\tandis.\tr4,r3,PSSCR_EC_ESL_MASK_SHIFTED  \n> \n> I realize you're just moving existing code, but I think this would be\n> clearer (to me, anyway) as\n> \n> \tandis.\tr4, r3, (PSSCR_EC | PSSCR_ESL)@h\n\nAgreed, it's not a very helpful extra indirection. Perhaps we could\ndo a cleanup patch to fix that (and your other points like the 206/207\nconfusion).\n\nThanks for the reviews.\n\n> Apart from that very minor nit,\n> \n> Reviewed-by: Paul Mackerras <paulus@ozlabs.org>","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhBFG60LLz9sNr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 11:41:38 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhBFG4RmNzDqMV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 11:41:38 +1000 (AEST)","from mail-pf0-x244.google.com (mail-pf0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c00::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xhBCK1RMfzDqK7\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 11:39:57 +1000 (AEST)","by mail-pf0-x244.google.com with SMTP id c28so1353879pfe.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 18:39:57 -0700 (PDT)","from roar.ozlabs.ibm.com (203-219-56-202.tpgi.com.au.\n\t[203.219.56.202]) by smtp.gmail.com with ESMTPSA id\n\td196sm2384271pfd.95.2017.08.28.18.39.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 28 Aug 2017 18:39:53 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"uuO+HKIU\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"uuO+HKIU\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"uuO+HKIU\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:organization:mime-version:content-transfer-encoding;\n\tbh=Y85QA2z2Ad/o63R5HM0PL991BExP+o8wxaBHr5PvLX8=;\n\tb=uuO+HKIURLqeI2iY9dTX1fo/mPYL3tbhg2n2UoZQ9aow6acXwRLddzKAZtFGNnnfyC\n\tM5TCg/oPO3LazonKqlyL6zOE0lJCL1B8IMaMTW0ha0xHlGd0nuzHrnPPJ17o8cK4gKOH\n\tTo3ju3/YpknmHSSCdzewje8aJi4zQQ9B/Ei6NWZaBTn0lFqm3w+nR8g2t9Xqfcix1whP\n\tGoM28G0xflNtixxJbcJoVaSwEJi3EIN17IJnwRPn9P5vLWBTKoZENMD1rJSGB4Gk2nE5\n\tyXnzKd1QsXdd48jL5QcW0awkaDIYs3H+CWXuX4ESmU3qD9eiR0XnoCa0HppvchY+/Sbl\n\tBFzA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:organization:mime-version:content-transfer-encoding;\n\tbh=Y85QA2z2Ad/o63R5HM0PL991BExP+o8wxaBHr5PvLX8=;\n\tb=aCl3pHALXuDtAqtXHfU9sZYJ6efhUmsp2tZO0UO8rdTV3QTb2Sssdkte5hf3J/9eF1\n\tuILbhY9fY3doox+/9atTn1yySPBoYPcs2axZH5VDK3zihZ7LxLLPoHeIsNps5bKrtj1d\n\tbF6p5gih3UXu06IEVlWNPzkRbVw2JuRGcet3T/1FDkSE+cMGh3xpZBqxlBY2nFzmFMJH\n\t7jV7MUz21ah7XIkeiRsDbmXSWqqluOXWAufkEbnYYe5dZbIZ4nXHfnTvfE2zBVExRr5G\n\tvQLuEbnSWL9wDQB9D/fBHVC31GCs9KuIXa0qWrWiT9aiv/Yu6Cl7e0YAGDPPJiwYfC/r\n\tNgxQ==","X-Gm-Message-State":"AHYfb5jBFDcgplrxuMgevwlOjzx7IEf96JciEw1K8U8yonIlcQnSJaBF\n\tcWan4c88G6tY0g==","X-Received":"by 10.84.213.8 with SMTP id f8mr3108085pli.164.1503970795066;\n\tMon, 28 Aug 2017 18:39:55 -0700 (PDT)","Date":"Tue, 29 Aug 2017 11:39:37 +1000","From":"Nicholas Piggin <npiggin@gmail.com>","To":"Paul Mackerras <paulus@ozlabs.org>","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","Message-ID":"<20170829113937.11ccc94b@roar.ozlabs.ibm.com>","In-Reply-To":"<20170829002048.GG12629@fergus.ozlabs.ibm.com>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>\n\t<20170829002048.GG12629@fergus.ozlabs.ibm.com>","Organization":"IBM","X-Mailer":"Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"\"Gautham R.\n\tShenoy\" <ego@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org,\n\tkvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1760076,"web_url":"http://patchwork.ozlabs.org/comment/1760076/","msgid":"<87pobd1em0.fsf@concordia.ellerman.id.au>","date":"2017-08-30T11:25:59","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":46580,"url":"http://patchwork.ozlabs.org/api/people/46580/","name":"Michael Ellerman","email":"mpe@ellerman.id.au"},"content":"Nicholas Piggin <npiggin@gmail.com> writes:\n\n> When stop is executed with EC=ESL=0, it appears to execute like a\n> normal instruction (resuming from NIP when woken by interrupt).\n> So all the save/restore handling can be avoided completely. In\n> particular NV GPRs do not have to be saved, and MSR does not have\n> to be switched back to kernel MSR.\n>\n> So move the test for \"lite\" sleep states out to power9_idle_stop.\n>\n> Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n> ---\n>  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n>  1 file changed, 24 insertions(+), 11 deletions(-)\n\nThis is blowing up for me on mambo:\n\n  usbcore: registered new interface driver usb-storage\n  Disabling lock debugging due to kernel taint\n  Severe Machine check interrupt [Not recovered]\n    NIP [c0000000002a0c04]: kmem_cache_free+0x64/0x2c0\n    Initiator: CPU\n    Error type: Real address [Load/Store (foreign)]\n  opal: Hardware platform error: Unrecoverable Machine Check exception\n  CPU: 0 PID: 0 Comm: swapper/0 Tainted: G   M            4.13.0-rc2-gcc-6.3.1-00257-g26268bb39bff #543\n  task: c0000000016b1200 task.stack: c00000000175c000\n  NIP:  c0000000002a0c04 LR: c0000000001128ec CTR: c000000000112800\n  REGS: c00000003fff7d80 TRAP: 0200   Tainted: G   M             (4.13.0-rc2-gcc-6.3.1-00257-g26268bb39bff)\n  MSR:  9000000000209003 <SF,HV,EE,ME,RI,LE>  CR: 28002828  XER: 20000000\n  CFAR: c0000000001128e8 DAR: c00a0000003c3ce0 DSISR: 00000008 SOFTE: 1 \n  GPR00: c0000000001128ec c00000000175f7b0 c000000001760500 c0000000f001a000 \n  GPR04: c0000000f0f37f00 0000000000000003 00000000000220c3 0000000000000000 \n  GPR08: 0000000000000000 00000000003c3cc0 c0000000017e7758 0000000000000000 \n  GPR12: c000000000112800 c00000000fff0000 c000000000112800 c0000000f0f37f90 \n  GPR16: c00000000175c000 c00000000175c000 0000000000000001 c0000000016d7900 \n  GPR20: c00000000179ba98 7fffffffffffffff c00000000175c000 0000000000000000 \n  GPR24: c00000000017a8c0 000000000000000a c0000000016d8a00 c00000000175f8d0 \n  GPR28: c0000000001128ec c0000000f0f37f00 c00a0000003c3cc0 c0000000f001a000 \n  NIP [c0000000002a0c04] kmem_cache_free+0x64/0x2c0\n  LR [c0000000001128ec] put_cred_rcu+0xec/0x140\n  Call Trace:\n  [c00000000175f7b0] [c00000000175f800] init_thread_union+0x3800/0x4000 (unreliable)\n  [c00000000175f840] [c0000000001128ec] put_cred_rcu+0xec/0x140\n  [c00000000175f8b0] [c00000000017a908] rcu_process_callbacks+0x438/0x6a0\n  [c00000000175f980] [c0000000000e5e28] __do_softirq+0x198/0x310\n  [c00000000175fa70] [c0000000000e6248] irq_exit+0xf8/0x140\n  [c00000000175fa90] [c000000000023710] timer_interrupt+0xa0/0xe0\n  [c00000000175fac0] [c000000000008fcc] decrementer_common+0x11c/0x120\n  --- interrupt: 901 at replay_interrupt_return+0x0/0x4\n      LR = arch_local_irq_restore.part.1+0x84/0xb0\n  [c00000000175fdb0] [c00000000175c000] init_thread_union+0x0/0x4000 (unreliable)\n  [c00000000175fdd0] [c00000000001cde0] arch_cpu_idle+0xe0/0x140\n  [c00000000175fe00] [c0000000007f4f44] default_idle_call+0x44/0x84\n  [c00000000175fe20] [c000000000142e54] do_idle+0x254/0x320\n  [c00000000175fe90] [c000000000143280] cpu_startup_entry+0x30/0x40\n  [c00000000175fec0] [c00000000000d2d8] rest_init+0x2f8/0x320\n  [c00000000175ff00] [c000000001000d74] start_kernel+0x510/0x52c\n  [c00000000175ff90] [c00000000000ab70] start_here_common+0x1c/0x4ac\n  Instruction dump:\n  60000000 e9230008 71280100 40820170 2fbf0000 419e013c 3d420008 394a7258 \n  7bbe8502 7bc93664 ebca0000 7fde4a14 <e93e0020> 712a0001 40820234 e93f0008 \n  [    1.217346467,0] OPAL: Reboot requested due to Platform error.\n  [    1.217351582,3] OPAL: failed to log an error\n  [    1.217358188,5] OPAL: Reboot request...\n\n\nI'll just drop it for now.\n\ncheers","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj3BQ2y1cz9sNn\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 21:27:10 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xj3BQ20SYzDqZs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 21:27:10 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xj3941zclzDqMY\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 30 Aug 2017 21:26:00 +1000 (AEST)","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3xj3936Tw3z9sP5;\n\tWed, 30 Aug 2017 21:25:59 +1000 (AEST)"],"From":"Michael Ellerman <mpe@ellerman.id.au>","To":"Nicholas Piggin <npiggin@gmail.com>, linuxppc-dev@lists.ozlabs.org","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","In-Reply-To":"<20170825043036.18236-5-npiggin@gmail.com>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>","User-Agent":"Notmuch/0.21 (https://notmuchmail.org)","Date":"Wed, 30 Aug 2017 21:25:59 +1000","Message-ID":"<87pobd1em0.fsf@concordia.ellerman.id.au>","MIME-Version":"1.0","Content-Type":"text/plain","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Nicholas Piggin <npiggin@gmail.com>, kvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1760101,"web_url":"http://patchwork.ozlabs.org/comment/1760101/","msgid":"<20170830221045.6fd10787@roar.ozlabs.ibm.com>","date":"2017-08-30T12:10:45","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/people/69518/","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"content":"On Wed, 30 Aug 2017 21:25:59 +1000\nMichael Ellerman <mpe@ellerman.id.au> wrote:\n\n> Nicholas Piggin <npiggin@gmail.com> writes:\n> \n> > When stop is executed with EC=ESL=0, it appears to execute like a\n> > normal instruction (resuming from NIP when woken by interrupt).\n> > So all the save/restore handling can be avoided completely. In\n> > particular NV GPRs do not have to be saved, and MSR does not have\n> > to be switched back to kernel MSR.\n> >\n> > So move the test for \"lite\" sleep states out to power9_idle_stop.\n> >\n> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n> > ---\n> >  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n> >  1 file changed, 24 insertions(+), 11 deletions(-)  \n> \n> This is blowing up for me on mambo:\n\nOh this is a known bug in mambo that does not match the hardware.\n\nYou need >= Mambo.7.8.21, or this firmware patch to work around\nthe issue for old mambos.\n\nmambo.git 58d3162f4d6204fc077ff4a6ba47e4d1e19d5120\n\nhttps://lists.ozlabs.org/pipermail/skiboot/2017-August/008768.html\n\nThanks,\nNick","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj4C60t2Nz9sQl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 22:12:50 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xj4C567WrzDqMc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 22:12:49 +1000 (AEST)","from mail-pg0-x243.google.com (mail-pg0-x243.google.com\n\t[IPv6:2607:f8b0:400e:c05::243])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xj4952FbqzDqMY\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 30 Aug 2017 22:11:05 +1000 (AEST)","by mail-pg0-x243.google.com with SMTP id t3so4926247pgt.5\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 30 Aug 2017 05:11:05 -0700 (PDT)","from roar.ozlabs.ibm.com (203-219-56-202.tpgi.com.au.\n\t[203.219.56.202]) by smtp.gmail.com with ESMTPSA id\n\ts186sm9272154pfb.110.2017.08.30.05.11.00\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 30 Aug 2017 05:11:02 -0700 (PDT)"],"Authentication-Results":["ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GFdBihdJ\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GFdBihdJ\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GFdBihdJ\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:organization:mime-version:content-transfer-encoding;\n\tbh=FlbvY27sA6PoelayIqE0FFrJcKsoNoxgiy2yZcKZ6HQ=;\n\tb=GFdBihdJ6++iNaIIWx3BwkzYXSVvRVN2/NAjn+eSM7kVMiNwlIMX2On/KOK8/ILWUH\n\tmEGuCHN2boA4pXgNO1u7aXQ83ZOTCvzs9JXCaYR6dqLRvP4/PGYUXb5NqwYDfZ+zlumY\n\tJHrVhHEzno56BHd1sPGunFrq4NJpxZ6eKe96YLnZ2CWqwoXZfEzwvEJWxI2EzuwSIk5X\n\tUK1S/cS1hOdwR7lp49jB/IPVmce3EjtioZskiv3R64Ywe9vds2VOF12vIyWSHY8UIm4o\n\tQ33xTEFu6PnJv+j3lkojVtaqdSSO+V0gqKES1ogqsDOtebFIQSRvRrbLfKEqR2SyH5G7\n\tKytQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:organization:mime-version:content-transfer-encoding;\n\tbh=FlbvY27sA6PoelayIqE0FFrJcKsoNoxgiy2yZcKZ6HQ=;\n\tb=Ud6MTi9899r3XCbkCFMSnH1uWEqtZW+RUTN/k3d1P5xCPJ83j2Z88Ijzpt8+TCY0lQ\n\tyN70pTBHiMQZoZOpe5lhAgySN3aaInqzhc0w8rbQalurKJDykc5RfAo4VU3rBQGnXsk8\n\tZtSf3M4oSljkK/YSv8oHY1pREL9DUVPtS9NZPrddV+2Yo8l5K8l3CIfSAijfF357BkGv\n\t6mDhNoqiDuTf+rSrEzR1iTvN2/fjxzcUDgygoOrUzmh6hwYlmknY58O5AoIKaej0OI+b\n\tp/jmejBkIbmC79isiw4CeOz9BsF8jaFcEmhxgkYJPDwfJvV2OM9lTXFQcjj4xDrhgAXk\n\tUwbg==","X-Gm-Message-State":"AHYfb5hreeJ1xhglFIe0inoxROPDXTAcFaSHr/KGchVGxXtP0oaWVwe6\n\t2iMBWrA0df5dLg==","X-Received":"by 10.84.194.195 with SMTP id h61mr1647474pld.361.1504095063079; \n\tWed, 30 Aug 2017 05:11:03 -0700 (PDT)","Date":"Wed, 30 Aug 2017 22:10:45 +1000","From":"Nicholas Piggin <npiggin@gmail.com>","To":"Michael Ellerman <mpe@ellerman.id.au>","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","Message-ID":"<20170830221045.6fd10787@roar.ozlabs.ibm.com>","In-Reply-To":"<87pobd1em0.fsf@concordia.ellerman.id.au>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>\n\t<87pobd1em0.fsf@concordia.ellerman.id.au>","Organization":"IBM","X-Mailer":"Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1761551,"web_url":"http://patchwork.ozlabs.org/comment/1761551/","msgid":"<87k21i69lu.fsf@concordia.ellerman.id.au>","date":"2017-09-01T09:39:41","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":46580,"url":"http://patchwork.ozlabs.org/api/people/46580/","name":"Michael Ellerman","email":"mpe@ellerman.id.au"},"content":"Nicholas Piggin <npiggin@gmail.com> writes:\n\n> On Wed, 30 Aug 2017 21:25:59 +1000\n> Michael Ellerman <mpe@ellerman.id.au> wrote:\n>\n>> Nicholas Piggin <npiggin@gmail.com> writes:\n>> \n>> > When stop is executed with EC=ESL=0, it appears to execute like a\n>> > normal instruction (resuming from NIP when woken by interrupt).\n>> > So all the save/restore handling can be avoided completely. In\n>> > particular NV GPRs do not have to be saved, and MSR does not have\n>> > to be switched back to kernel MSR.\n>> >\n>> > So move the test for \"lite\" sleep states out to power9_idle_stop.\n>> >\n>> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n>> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n>> > ---\n>> >  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n>> >  1 file changed, 24 insertions(+), 11 deletions(-)  \n>> \n>> This is blowing up for me on mambo:\n>\n> Oh this is a known bug in mambo that does not match the hardware.\n>\n> You need >= Mambo.7.8.21, or this firmware patch to work around\n> the issue for old mambos.\n\nAs discussed elsewhere this still breaks on new mambo with more than one\nCPU. So I've dropped it for now.\n\ncheers","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkDl11CpLz9sPk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 19:41:01 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xkDl104chzDqn6\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 19:41:01 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xkDjW4B00zDqZ0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri,  1 Sep 2017 19:39:43 +1000 (AEST)","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3xkDjW22Wmz9sPk;\n\tFri,  1 Sep 2017 19:39:43 +1000 (AEST)"],"From":"Michael Ellerman <mpe@ellerman.id.au>","To":"Nicholas Piggin <npiggin@gmail.com>","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","In-Reply-To":"<20170830221045.6fd10787@roar.ozlabs.ibm.com>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>\n\t<87pobd1em0.fsf@concordia.ellerman.id.au>\n\t<20170830221045.6fd10787@roar.ozlabs.ibm.com>","User-Agent":"Notmuch/0.21 (https://notmuchmail.org)","Date":"Fri, 01 Sep 2017 19:39:41 +1000","Message-ID":"<87k21i69lu.fsf@concordia.ellerman.id.au>","MIME-Version":"1.0","Content-Type":"text/plain","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1771884,"web_url":"http://patchwork.ozlabs.org/comment/1771884/","msgid":"<20170920235627.3413797f@roar.ozlabs.ibm.com>","date":"2017-09-20T13:56:27","subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","submitter":{"id":69518,"url":"http://patchwork.ozlabs.org/api/people/69518/","name":"Nicholas Piggin","email":"npiggin@gmail.com"},"content":"On Fri, 01 Sep 2017 19:39:41 +1000\nMichael Ellerman <mpe@ellerman.id.au> wrote:\n\n> Nicholas Piggin <npiggin@gmail.com> writes:\n> \n> > On Wed, 30 Aug 2017 21:25:59 +1000\n> > Michael Ellerman <mpe@ellerman.id.au> wrote:\n> >  \n> >> Nicholas Piggin <npiggin@gmail.com> writes:\n> >>   \n> >> > When stop is executed with EC=ESL=0, it appears to execute like a\n> >> > normal instruction (resuming from NIP when woken by interrupt).\n> >> > So all the save/restore handling can be avoided completely. In\n> >> > particular NV GPRs do not have to be saved, and MSR does not have\n> >> > to be switched back to kernel MSR.\n> >> >\n> >> > So move the test for \"lite\" sleep states out to power9_idle_stop.\n> >> >\n> >> > Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\n> >> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>\n> >> > ---\n> >> >  arch/powerpc/kernel/idle_book3s.S | 35 ++++++++++++++++++++++++-----------\n> >> >  1 file changed, 24 insertions(+), 11 deletions(-)    \n> >> \n> >> This is blowing up for me on mambo:  \n> >\n> > Oh this is a known bug in mambo that does not match the hardware.\n> >\n> > You need >= Mambo.7.8.21, or this firmware patch to work around\n> > the issue for old mambos.  \n> \n> As discussed elsewhere this still breaks on new mambo with more than one\n> CPU. So I've dropped it for now.\n\nThis now seems to be properly fixed in mambo with commit 11783550ee11.\n\nSkiboot also has a patch merged which disables the problematic state on\nmambo so older versions won't crash.\n\nd2a24406a49 (\"idle: disable stop*_lite POWER9 idle states for Mambo platform\")\n\nSo this could be re-applied now.\n\nThanks,\nNick","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy1Y86pK7z9sP1\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 23:58:20 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xy1Y82C9SzDqXy\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 23:58:20 +1000 (AEST)","from mail-pf0-x244.google.com (mail-pf0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c00::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xy1WL5l1YzDqBd\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 20 Sep 2017 23:56:46 +1000 (AEST)","by mail-pf0-x244.google.com with SMTP id i23so1227243pfi.2\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 20 Sep 2017 06:56:46 -0700 (PDT)","from roar.ozlabs.ibm.com ([202.53.36.46])\n\tby smtp.gmail.com with ESMTPSA id\n\tr138sm6768523pgr.12.2017.09.20.06.56.39\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 20 Sep 2017 06:56:42 -0700 (PDT)"],"Authentication-Results":["ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"P87nhz74\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"P87nhz74\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com;\n\tenvelope-from=npiggin@gmail.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"P87nhz74\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:organization:mime-version:content-transfer-encoding;\n\tbh=eQ9rjJbrGMfOBMzQaua3VmO7klHqN28BThzOImaAnFw=;\n\tb=P87nhz74sdLWjRlXec3ZoP5FzNS7De+wEthkIbunP8FQZAlo7vWQtLOzsbS2zcQ1Rq\n\tmR65d38W7Sza8FpkHRpWs2mAYEWy7gWc0Kdr+VUx6uD8ZGD/FuKBhklH5FEPJpXGUCfL\n\tKsBjYc8dpyZBYtCJjs4QosvmMHzwB/ibJrtydsjrcsU9/GOjb5YpKRpJD4Lk4+0rtfXx\n\t93JDB4RhHfFipS3qjGw6XFaQ9IYyUk+2ZAmsS9jauOmxJT1MSJ08teByac6zxEuIzKV3\n\tOx6iJISo/Vs0kbGhSqkeqvq1wLZ5tMoTlcLCySX3cSIC1By2RGX5hzPdeVuvTnLq1z81\n\td8pw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:organization:mime-version:content-transfer-encoding;\n\tbh=eQ9rjJbrGMfOBMzQaua3VmO7klHqN28BThzOImaAnFw=;\n\tb=jhzli7vK8YETAIYpOIdulSF7qfbvIenGfT/s+AwqgYB0paISb1Rs+4qXkPGmOe64aL\n\t1BcmoH4TXefD8VqeciBZf+SD0QPTpI/KCNrziSG/zZloEEKLDHyrAJd+yBSaurVtdTvu\n\tLLSyGSWaOANH7gjoQS5g+K7y/vuxCTK8OZn3tLYXYkdEOw1lYUzOSXNKA+qC9cFekAop\n\tCc39LueMcVuyPDwSyQMSqlRbH2VprKvMMvbak3dnpVA5P0fBweWznv4E1P8kh2XZK3jK\n\tkeAV7oVpQl/2mlRD3gn2g7DzmZ8CXBi9uJUeKHMLs3+t7d0UeYLSkCQVGiXcxwHmieyY\n\t9s3g==","X-Gm-Message-State":"AHPjjUjunu2mrT0/HV6DwHwY17bn9bSzgx1r4TdQ4WmHYJJifWgeuwwO\n\tevBOhCu4KBgIbGsjMkkB00k=","X-Google-Smtp-Source":"AOwi7QBBN+Izs3GbYxPwqLuumyNn3IzR1nm0qt74GzuP7sliJj2hsntwu/0yUXYflI5Y9tv4JvN0rw==","X-Received":"by 10.99.38.7 with SMTP id m7mr2250366pgm.53.1505915803961;\n\tWed, 20 Sep 2017 06:56:43 -0700 (PDT)","Date":"Wed, 20 Sep 2017 23:56:27 +1000","From":"Nicholas Piggin <npiggin@gmail.com>","To":"Michael Ellerman <mpe@ellerman.id.au>","Subject":"Re: [PATCH v3 4/4] powerpc/64s: idle ESL=0 stop can avoid MSR and\n\tsave/restore overhead","Message-ID":"<20170920235627.3413797f@roar.ozlabs.ibm.com>","In-Reply-To":"<87k21i69lu.fsf@concordia.ellerman.id.au>","References":"<20170825043036.18236-1-npiggin@gmail.com>\n\t<20170825043036.18236-5-npiggin@gmail.com>\n\t<87pobd1em0.fsf@concordia.ellerman.id.au>\n\t<20170830221045.6fd10787@roar.ozlabs.ibm.com>\n\t<87k21i69lu.fsf@concordia.ellerman.id.au>","Organization":"IBM","X-Mailer":"Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}}]