Message ID | 20230112195539.760296658@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4080464wrt; Thu, 12 Jan 2023 12:07:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuwvBj7m7F5VFcFPV55ZJhANJmFHq31xPEJMm1mqE69UlZ+0eDQK5vj1o8huy17GnGw85e+ X-Received: by 2002:a17:902:e043:b0:194:5c63:364c with SMTP id x3-20020a170902e04300b001945c63364cmr3729478plx.62.1673554024130; Thu, 12 Jan 2023 12:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673554024; cv=none; d=google.com; s=arc-20160816; b=0BDAEUuCpk4SfopYKyadkcj5nkdTKfYP7btqjN02ZkNhurYAs+evl2ULqIdgt+9kPj +IiXNlDhIo4okL7ucFdMdVIMrsYuWkms97oVgRhqUbQuBwIWZJM7DAPUiWgC3RLSZ8Vk ytrJkP8ITFREecTw9lfXTBcjUCkQt/zigJVRwI3IVvWMBkBYzll3LV+4kzKWsxEYbuSM S+AZNSAR/NF9T2cn2QoL0me6Kgthu8mYVInTJIpAE5CU7RCdA2qzy8a3arhvOD/0KYNJ /JUDtNnsYX7LoiCvjWILgsci+K2M4WG2I1cCz5wm3oDXqlSIjvNJ+isoAvxa0bX45OMZ /Kkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=REiFsq8Cu55BI5UIL8KISCBnMH5PlDDv/02JyaHCfws=; b=knxmCakfr1LfypEr79v7enDp8ggdjnp85Lc347GQvPuOaDO2TNFR537NQ/4Sr6CWu7 Ft/0BU/kyWZPMbf8IMfvsJd0ckYpCFZ0ZpLjee6/W7ybt4VOZHwDTUT3VWWw6BPpOOuh eMLh5jgy7rGrAP6wP8laqY2ehM+EMu+ZsAZUJezDT0bSZO7yQNDPV8zO5lTWcQ++L950 QFKsIuPgUCoyXFhtZdFZeeHIKsMXi7zs1lOsbpRg3VSNHWTJ0QdmYMrZ1zeMxE4ycijt M2KRCjsd8zrJFtXOf5MUuUVv2yxpgqMHBOXCNPn2/q4CoEomCWtN8985Ju7/TntsDrF9 ZAuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ZubM8vIp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a17090332c500b0019303698a94si20389162plr.149.2023.01.12.12.06.50; Thu, 12 Jan 2023 12:07:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ZubM8vIp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242126AbjALUG0 (ORCPT <rfc822;zhuangel570@gmail.com> + 99 others); Thu, 12 Jan 2023 15:06:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233054AbjALT7P (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Jan 2023 14:59:15 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B42111A; Thu, 12 Jan 2023 11:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=REiFsq8Cu55BI5UIL8KISCBnMH5PlDDv/02JyaHCfws=; b=ZubM8vIp9Gjo7GwJsBdrYzbOzs QOVGmZ4bWo0Q6sv20x1XlcD9CRW8N4IP7OgbgESc5RJ6qK0XbpduvgLbtC0g+RocjgmzuC01nPkxn Nll1ch6FXB7zNPboeIh6WXrc2C5vVgpNXrYASNYw878FKX2W98ff9mJt7YcW2DLL4Kvaz6ApwZ2QZ 8LnFl7cnW88pgaQ3H98ktINkHpxIuRtLPTKQJumh2b6fK1BqXpPU1/rzjoyF4kcz0/Cm1ZTiiORYm cBN7GiCc0pPVS0TbTFnZfo5/yX1v5qFf5zifIEQjIZN7jBbFEein8h2c69qoGRQNBpnSSi3z9vbhr mBjy5WPQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pG3hC-0045o9-24; Thu, 12 Jan 2023 19:57:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0A1943033F4; Thu, 12 Jan 2023 20:57:13 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id A81F92CCF1F5A; Thu, 12 Jan 2023 20:57:07 +0100 (CET) Message-ID: <20230112195539.760296658@infradead.org> User-Agent: quilt/0.66 Date: Thu, 12 Jan 2023 20:43:21 +0100 From: Peter Zijlstra <peterz@infradead.org> To: peterz@infradead.org Cc: richard.henderson@linaro.org, ink@jurassic.park.msu.ru, mattst88@gmail.com, vgupta@kernel.org, linux@armlinux.org.uk, nsekhar@ti.com, brgl@bgdev.pl, ulli.kroll@googlemail.com, linus.walleij@linaro.org, shawnguo@kernel.org, Sascha Hauer <s.hauer@pengutronix.de>, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, tony@atomide.com, khilman@kernel.org, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, catalin.marinas@arm.com, will@kernel.org, guoren@kernel.org, bcain@quicinc.com, chenhuacai@kernel.org, kernel@xen0n.name, geert@linux-m68k.org, sammy@sammy.net, monstr@monstr.eu, tsbogend@alpha.franken.de, dinguyen@kernel.org, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com, James.Bottomley@HansenPartnership.com, deller@gmx.de, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, richard@nod.at, anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, jgross@suse.com, srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, boris.ostrovsky@oracle.com, chris@zankel.net, jcmvbkbc@gmail.com, rafael@kernel.org, lenb@kernel.org, pavel@ucw.cz, gregkh@linuxfoundation.org, mturquette@baylibre.com, sboyd@kernel.org, daniel.lezcano@linaro.org, lpieralisi@kernel.org, sudeep.holla@arm.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, anup@brainfault.org, thierry.reding@gmail.com, jonathanh@nvidia.com, jacob.jun.pan@linux.intel.com, atishp@atishpatra.org, Arnd Bergmann <arnd@arndb.de>, yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, dennis@kernel.org, tj@kernel.org, cl@linux.com, rostedt@goodmis.org, mhiramat@kernel.org, frederic@kernel.org, paulmck@kernel.org, pmladek@suse.com, senozhatsky@chromium.org, john.ogness@linutronix.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com, dvyukov@google.com, vincenzo.frascino@arm.com, Andrew Morton <akpm@linux-foundation.org>, jpoimboe@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-xtensa@linux-xtensa.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, kasan-dev@googlegroups.com, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Kajetan Puchalski <kajetan.puchalski@arm.com>, Ulf Hansson <ulf.hansson@linaro.org> Subject: [PATCH v3 07/51] cpuidle,psci: Push RCU-idle into driver References: <20230112194314.845371875@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754848584651084356?= X-GMAIL-MSGID: =?utf-8?q?1754848584651084356?= |
Series |
cpuidle,rcu: Clean up the mess
|
|
Commit Message
Peter Zijlstra
Jan. 12, 2023, 7:43 p.m. UTC
Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is daft. Notably once implicitly through the cpu_pm_*() calls and once explicitly doing ct_irq_*_irqon(). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Guo Ren <guoren@kernel.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com> Tested-by: Tony Lindgren <tony@atomide.com> Tested-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/cpuidle/cpuidle-psci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Comments
Hoi Peter, (reduced the insane CC list) On Thu, 12 Jan 2023, Peter Zijlstra wrote: > Doing RCU-idle outside the driver, only to then temporarily enable it > again, at least twice, before going idle is daft. > > Notably once implicitly through the cpu_pm_*() calls and once > explicitly doing ct_irq_*_irqon(). > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > Reviewed-by: Frederic Weisbecker <frederic@kernel.org> > Reviewed-by: Guo Ren <guoren@kernel.org> > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > Tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com> > Tested-by: Tony Lindgren <tony@atomide.com> > Tested-by: Ulf Hansson <ulf.hansson@linaro.org> Thanks for your patch, which is now commit e038f7b8028a1d1b ("cpuidle, psci: Push RCU-idle into driver") in v6.3-rc1. I have bisected a PSCI checker regression on Renesas R-Car Gen3/4 SoCs to commit a01353cf1896ea5b ("cpuidle: Fix ct_idle_*() usage") (the 7 commits before that do not compile): psci_checker: PSCI checker started using 2 CPUs psci_checker: Starting hotplug tests psci_checker: Trying to turn off and on again all CPUs psci: CPU0 killed (polled 0 ms) Detected PIPT I-cache on CPU0 CPU0: Booted secondary processor 0x0000000000 [0x411fd073] psci_checker: Trying to turn off and on again group 0 (CPUs 0-1) psci: CPU0 killed (polled 0 ms) Detected PIPT I-cache on CPU0 CPU0: Booted secondary processor 0x0000000000 [0x411fd073] psci_checker: Hotplug tests passed OK psci_checker: Starting suspend tests (10 cycles per state) psci_checker: CPU 0 entering suspend cycles, states 1 through 1 psci_checker: CPU 1 entering suspend cycles, states 1 through 1 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 177 at kernel/context_tracking.c:141 ct_kernel_exit.constprop.0+0xd8/0xf4 Modules linked in: CPU: 1 PID: 177 Comm: psci_suspend_te Not tainted 6.2.0-rc1-salvator-x-00052-ga01353cf1896 #1415 Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT) pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ct_kernel_exit.constprop.0+0xd8/0xf4 lr : ct_kernel_exit.constprop.0+0xc8/0xf4 sp : ffffffc00b73bd30 x29: ffffffc00b73bd30 x28: ffffff807fbadc90 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: ffffff800981e140 x22: 0000000000000001 x21: 0000000000010000 x20: ffffffc0086be1d8 x19: ffffff807fbac070 x18: 0000000000000000 x17: ffffff80083d1000 x16: ffffffc00841fff8 x15: ffffffc00b73b990 x14: ffffffc00895be78 x13: 0000000000000001 x12: 0000000000000000 x11: 00000000000001aa x10: 00000000ffffffea x9 : 000000000000000f x8 : ffffffc00b73bb68 x7 : ffffffc00b73be18 x6 : ffffffc00815ff34 x5 : ffffffc00a6a0c30 x4 : ffffffc00801ce00 x3 : 0000000000000000 x2 : ffffffc008dc3070 x1 : ffffffc008dc3078 x0 : 0000000004208040 Call trace: ct_kernel_exit.constprop.0+0xd8/0xf4 ct_idle_enter+0x18/0x20 psci_enter_idle_state+0xa4/0xfc suspend_test_thread+0x238/0x2f0 kthread+0xd8/0xe8 ret_from_fork+0x10/0x20 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc softirqs last enabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------ WARNING: CPU: 1 PID: 177 at kernel/context_tracking.c:186 ct_kernel_enter.constprop.0+0x78/0xa4 Modules linked in: CPU: 1 PID: 177 Comm: psci_suspend_te Tainted: G W 6.2.0-rc1-salvator-x-00052-ga01353cf1896 #1415 Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT) pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ct_kernel_enter.constprop.0+0x78/0xa4 lr : ct_kernel_enter.constprop.0+0x68/0xa4 sp : ffffffc00b73bd30 x29: ffffffc00b73bd30 x28: ffffff807fbadc90 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: ffffff800981e140 x22: 0000000000000001 x21: 00000000ffffffa1 x20: ffffffc0086be1d8 x19: 00000000000000c0 x18: 0000000000000000 x17: ffffff80083d1000 x16: ffffffc00841fff8 x15: ffffffc00b73b990 x14: ffffffc00895be78 x13: ffffff800e325180 x12: ffffffc076de9000 x11: 0000000034d4d91d x10: 0000000000000008 x9 : 0000000000001000 x8 : ffffffc008012800 x7 : 0000000000000000 x6 : ffffff807fbac070 x5 : ffffffc008dc3070 x4 : 0000000000000000 x3 : 000000000001a9fc x2 : 0000000000000003 x1 : ffffffc008dc3070 x0 : 0000000004208040 Call trace: ct_kernel_enter.constprop.0+0x78/0xa4 ct_idle_exit+0x18/0x38 psci_enter_idle_state+0xdc/0xfc suspend_test_thread+0x238/0x2f0 kthread+0xd8/0xe8 ret_from_fork+0x10/0x20 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc softirqs last enabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 0000000000000000 ]--- psci_checker: Failed to suspend CPU 1: error -1 (requested state 1, cycle 0) psci_checker: CPU 0 suspend test results: success 0, shallow states 10, errors 0 mmcblk0rpmb: mmc0:0001 BGSD3R 4.00 MiB, chardev (243:0) psci_checker: CPU 1 suspend test results: success 0, shallow states 9, errors 1 psci_checker: 1 error(s) encountered in suspend tests psci_checker: PSCI checker completed > --- > drivers/cpuidle/cpuidle-psci.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > --- a/drivers/cpuidle/cpuidle-psci.c > +++ b/drivers/cpuidle/cpuidle-psci.c > @@ -69,12 +69,12 @@ static int __psci_enter_domain_idle_stat > return -1; > > /* Do runtime PM to manage a hierarchical CPU toplogy. */ > - ct_irq_enter_irqson(); > if (s2idle) > dev_pm_genpd_suspend(pd_dev); > else > pm_runtime_put_sync_suspend(pd_dev); > - ct_irq_exit_irqson(); > + > + ct_idle_enter(); > > state = psci_get_domain_state(); > if (!state) > @@ -82,12 +82,12 @@ static int __psci_enter_domain_idle_stat > > ret = psci_cpu_suspend_enter(state) ? -1 : idx; > > - ct_irq_enter_irqson(); > + ct_idle_exit(); > + > if (s2idle) > dev_pm_genpd_resume(pd_dev); > else > pm_runtime_get_sync(pd_dev); > - ct_irq_exit_irqson(); > > cpu_pm_exit(); > > @@ -240,6 +240,7 @@ static int psci_dt_cpu_init_topology(str > * of a shared state for the domain, assumes the domain states are all > * deeper states. > */ > + drv->states[state_count - 1].flags |= CPUIDLE_FLAG_RCU_IDLE; > drv->states[state_count - 1].enter = psci_enter_domain_idle_state; > drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; > psci_cpuidle_use_cpuhp = true; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert, On Tue, Mar 07, 2023 at 05:40:08PM +0100, Geert Uytterhoeven wrote: > Hoi Peter, > > (reduced the insane CC list) Helpfully you dropped me from Cc, so I missed this until just now... > On Thu, 12 Jan 2023, Peter Zijlstra wrote: > > Doing RCU-idle outside the driver, only to then temporarily enable it > > again, at least twice, before going idle is daft. > > > > Notably once implicitly through the cpu_pm_*() calls and once > > explicitly doing ct_irq_*_irqon(). > > > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > > Reviewed-by: Frederic Weisbecker <frederic@kernel.org> > > Reviewed-by: Guo Ren <guoren@kernel.org> > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > Tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com> > > Tested-by: Tony Lindgren <tony@atomide.com> > > Tested-by: Ulf Hansson <ulf.hansson@linaro.org> > > Thanks for your patch, which is now commit e038f7b8028a1d1b ("cpuidle, > psci: Push RCU-idle into driver") in v6.3-rc1. > > I have bisected a PSCI checker regression on Renesas R-Car Gen3/4 SoCs > to commit a01353cf1896ea5b ("cpuidle: Fix ct_idle_*() usage") (the 7 > commits before that do not compile): > > psci_checker: PSCI checker started using 2 CPUs > psci_checker: Starting hotplug tests > psci_checker: Trying to turn off and on again all CPUs > psci: CPU0 killed (polled 0 ms) > Detected PIPT I-cache on CPU0 > CPU0: Booted secondary processor 0x0000000000 [0x411fd073] > psci_checker: Trying to turn off and on again group 0 (CPUs 0-1) > psci: CPU0 killed (polled 0 ms) > Detected PIPT I-cache on CPU0 > CPU0: Booted secondary processor 0x0000000000 [0x411fd073] > psci_checker: Hotplug tests passed OK > psci_checker: Starting suspend tests (10 cycles per state) > psci_checker: CPU 0 entering suspend cycles, states 1 through 1 > psci_checker: CPU 1 entering suspend cycles, states 1 through 1 > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 177 at kernel/context_tracking.c:141 ct_kernel_exit.constprop.0+0xd8/0xf4 So that's: WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && !user && !is_idle_task(current)); ... and the PSCI checker doens't run in the context of the idle thread, so the warning is correct, and we're violating the expectation of the context tracking code. The PSCI checker is very much a special case, and I'm not sure how we can fix this without removing the warning in the cases we want it. It'd be nicer if we could "queue" the idle into the relevant idle thread. :/ I'm very tempted to say we should just rip the checker code out, rather than contorting the rest of the code to make that work. Thanks, Mark. > Modules linked in: > CPU: 1 PID: 177 Comm: psci_suspend_te Not tainted 6.2.0-rc1-salvator-x-00052-ga01353cf1896 #1415 > Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT) > pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : ct_kernel_exit.constprop.0+0xd8/0xf4 > lr : ct_kernel_exit.constprop.0+0xc8/0xf4 > sp : ffffffc00b73bd30 > x29: ffffffc00b73bd30 x28: ffffff807fbadc90 x27: 0000000000000000 > x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 > x23: ffffff800981e140 x22: 0000000000000001 x21: 0000000000010000 > x20: ffffffc0086be1d8 x19: ffffff807fbac070 x18: 0000000000000000 > x17: ffffff80083d1000 x16: ffffffc00841fff8 x15: ffffffc00b73b990 > x14: ffffffc00895be78 x13: 0000000000000001 x12: 0000000000000000 > x11: 00000000000001aa x10: 00000000ffffffea x9 : 000000000000000f > x8 : ffffffc00b73bb68 x7 : ffffffc00b73be18 x6 : ffffffc00815ff34 > x5 : ffffffc00a6a0c30 x4 : ffffffc00801ce00 x3 : 0000000000000000 > x2 : ffffffc008dc3070 x1 : ffffffc008dc3078 x0 : 0000000004208040 > Call trace: > ct_kernel_exit.constprop.0+0xd8/0xf4 > ct_idle_enter+0x18/0x20 > psci_enter_idle_state+0xa4/0xfc > suspend_test_thread+0x238/0x2f0 > kthread+0xd8/0xe8 > ret_from_fork+0x10/0x20 > irq event stamp: 0 > hardirqs last enabled at (0): [<0000000000000000>] 0x0 > hardirqs last disabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc > softirqs last enabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc > softirqs last disabled at (0): [<0000000000000000>] 0x0 > ---[ end trace 0000000000000000 ]--- > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 177 at kernel/context_tracking.c:186 ct_kernel_enter.constprop.0+0x78/0xa4 > Modules linked in: > CPU: 1 PID: 177 Comm: psci_suspend_te Tainted: G W 6.2.0-rc1-salvator-x-00052-ga01353cf1896 #1415 > Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT) > pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : ct_kernel_enter.constprop.0+0x78/0xa4 > lr : ct_kernel_enter.constprop.0+0x68/0xa4 > sp : ffffffc00b73bd30 > x29: ffffffc00b73bd30 x28: ffffff807fbadc90 x27: 0000000000000000 > x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 > x23: ffffff800981e140 x22: 0000000000000001 x21: 00000000ffffffa1 > x20: ffffffc0086be1d8 x19: 00000000000000c0 x18: 0000000000000000 > x17: ffffff80083d1000 x16: ffffffc00841fff8 x15: ffffffc00b73b990 > x14: ffffffc00895be78 x13: ffffff800e325180 x12: ffffffc076de9000 > x11: 0000000034d4d91d x10: 0000000000000008 x9 : 0000000000001000 > x8 : ffffffc008012800 x7 : 0000000000000000 x6 : ffffff807fbac070 > x5 : ffffffc008dc3070 x4 : 0000000000000000 x3 : 000000000001a9fc > x2 : 0000000000000003 x1 : ffffffc008dc3070 x0 : 0000000004208040 > Call trace: > ct_kernel_enter.constprop.0+0x78/0xa4 > ct_idle_exit+0x18/0x38 > psci_enter_idle_state+0xdc/0xfc > suspend_test_thread+0x238/0x2f0 > kthread+0xd8/0xe8 > ret_from_fork+0x10/0x20 > irq event stamp: 0 > hardirqs last enabled at (0): [<0000000000000000>] 0x0 > hardirqs last disabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc > softirqs last enabled at (0): [<ffffffc0080798b0>] copy_process+0x608/0x13dc > softirqs last disabled at (0): [<0000000000000000>] 0x0 > ---[ end trace 0000000000000000 ]--- > psci_checker: Failed to suspend CPU 1: error -1 (requested state 1, cycle 0) > psci_checker: CPU 0 suspend test results: success 0, shallow states 10, errors 0 > mmcblk0rpmb: mmc0:0001 BGSD3R 4.00 MiB, chardev (243:0) > psci_checker: CPU 1 suspend test results: success 0, shallow states 9, errors 1 > psci_checker: 1 error(s) encountered in suspend tests > psci_checker: PSCI checker completed > > > --- > > drivers/cpuidle/cpuidle-psci.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > --- a/drivers/cpuidle/cpuidle-psci.c > > +++ b/drivers/cpuidle/cpuidle-psci.c > > @@ -69,12 +69,12 @@ static int __psci_enter_domain_idle_stat > > return -1; > > > > /* Do runtime PM to manage a hierarchical CPU toplogy. */ > > - ct_irq_enter_irqson(); > > if (s2idle) > > dev_pm_genpd_suspend(pd_dev); > > else > > pm_runtime_put_sync_suspend(pd_dev); > > - ct_irq_exit_irqson(); > > + > > + ct_idle_enter(); > > > > state = psci_get_domain_state(); > > if (!state) > > @@ -82,12 +82,12 @@ static int __psci_enter_domain_idle_stat > > > > ret = psci_cpu_suspend_enter(state) ? -1 : idx; > > > > - ct_irq_enter_irqson(); > > + ct_idle_exit(); > > + > > if (s2idle) > > dev_pm_genpd_resume(pd_dev); > > else > > pm_runtime_get_sync(pd_dev); > > - ct_irq_exit_irqson(); > > > > cpu_pm_exit(); > > > > @@ -240,6 +240,7 @@ static int psci_dt_cpu_init_topology(str > > * of a shared state for the domain, assumes the domain states are all > > * deeper states. > > */ > > + drv->states[state_count - 1].flags |= CPUIDLE_FLAG_RCU_IDLE; > > drv->states[state_count - 1].enter = psci_enter_domain_idle_state; > > drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; > > psci_cpuidle_use_cpuhp = true; > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds >
--- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -69,12 +69,12 @@ static int __psci_enter_domain_idle_stat return -1; /* Do runtime PM to manage a hierarchical CPU toplogy. */ - ct_irq_enter_irqson(); if (s2idle) dev_pm_genpd_suspend(pd_dev); else pm_runtime_put_sync_suspend(pd_dev); - ct_irq_exit_irqson(); + + ct_idle_enter(); state = psci_get_domain_state(); if (!state) @@ -82,12 +82,12 @@ static int __psci_enter_domain_idle_stat ret = psci_cpu_suspend_enter(state) ? -1 : idx; - ct_irq_enter_irqson(); + ct_idle_exit(); + if (s2idle) dev_pm_genpd_resume(pd_dev); else pm_runtime_get_sync(pd_dev); - ct_irq_exit_irqson(); cpu_pm_exit(); @@ -240,6 +240,7 @@ static int psci_dt_cpu_init_topology(str * of a shared state for the domain, assumes the domain states are all * deeper states. */ + drv->states[state_count - 1].flags |= CPUIDLE_FLAG_RCU_IDLE; drv->states[state_count - 1].enter = psci_enter_domain_idle_state; drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; psci_cpuidle_use_cpuhp = true;