From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD1EC3F6B0 for ; Fri, 29 Jul 2022 15:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235101AbiG2PAI (ORCPT ); Fri, 29 Jul 2022 11:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232272AbiG2PAD (ORCPT ); Fri, 29 Jul 2022 11:00:03 -0400 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AABFD7FE53; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-322b5199358so51400627b3.6; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=so1as27GSlYxIJHKCYYB1YHUdOsIDuY1AH1GCXK3+P/C/ds8h1lUvdMDVKkeKOvRBw Q9uVdhVLxzr8JBjDNHyXgqgpk98ZnB/8W8le3Ywplb2zTSDhJ+58Cbzw+1FL7H6r/dW1 mv//iuG6JaggODIc7myWw0R+a+xMHzSkBp9MefJrG0pcuO/AdBvapme1s3r4WAJ6wZHB u85aGMJQYnAqQt4Cou+1PHEJB8yggDIgdt/zDuu6EpAwrzjhz/elFR5Re+UCSqghMqqd yLso4NrplwslgoHKLcpl3M9hmYlt24v8rQaWGf+ZA83K5bxOVeP8hTjpJfe7do18yIhM hhuA== X-Gm-Message-State: ACgBeo1PMUYA2AAyxbjXpNixHw4ZQHG/dssyGGo8E0lIFKYuSLJbewWn StuzTt1w9FzI+SQq54Rs1ixvEANzehbUG0ZmlJ8= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Cc: "Paul E. McKenney" , Peter Zijlstra , Richard Henderson , Ivan Kokshaysky , Matt Turner , vgupta@kernel.org, Russell King - ARM Linux , ulli.kroll@googlemail.com, Linus Walleij , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , dl-linux-imx , Tony Lindgren , Kevin Hilman , Catalin Marinas , Will Deacon , Guo Ren , bcain@quicinc.com, Huacai Chen , kernel@xen0n.name, Geert Uytterhoeven , sammy@sammy.net, Michal Simek , Thomas Bogendoerfer , dinguyen@kernel.org, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, Stafford Horne , James Bottomley , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , David Miller , Richard Weinberger , anton.ivanov@cambridgegreys.com, Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , acme@kernel.org, Mark Rutland , Alexander Shishkin , jolsa@kernel.org, namhyung@kernel.org, Juergen Gross , srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, Boris Ostrovsky , Chris Zankel , Max Filippov , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Michael Turquette , Stephen Boyd , Daniel Lezcano , Lorenzo Pieralisi , Sudeep Holla , Andy Gross , Bjorn Andersson , Anup Patel , Thierry Reding , Jon Hunter , Jacob Pan , Arnd Bergmann , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Steven Rostedt , Petr Mladek , senozhatsky@chromium.org, John Ogness , Frederic Weisbecker , quic_neeraju@quicinc.com, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , vschneid@redhat.com, jpoimboe@kernel.org, linux-alpha@vger.kernel.org, Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org, Linux ARM , Linux OMAP Mailing List , linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , "open list:BROADCOM NVRAM DRIVER" , openrisc@lists.librecores.org, Parisc List , linuxppc-dev , linux-riscv , linux-s390@vger.kernel.org, Linux-sh list , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-xtensa@linux-xtensa.org, ACPI Devel Maling List , Linux PM , linux-clk , linux-arm-msm , linux-tegra , linux-arch , rcu@vger.kernel.org, rh0@fb.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F27BC19F2C for ; Fri, 29 Jul 2022 15:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FpJhsHWTW+5YAkaWy80NaeSbMLMrbzJDmlFlHLKuU5Q=; b=wuv8C9F2WdE0O6 YwKgFbzTnNHMxwdW3jrgmkW99gjow/n5zq39GJxupPe96gFBNC/JPOd8hu40xDz3yZnioCPXTJ3Z/ haiHkbq1qQR9aJG7paS1vKhcuQdxGa6GhAhZbzzZur0JqTdB4vvfV3B6KmeYCHQlSo8+d341+ioNS XTCoHLpLtzLAkWaEn6TTrIX8/yc+ZmNyqSkHyA4HUfePQ1ecWpdpWTw26k024yrZoB94BIu2mgcFb f4SNsEbHdB5pQJhTz3eby0BPrfdGpkSpBC2xFlU1B6+5cGH2+tSTtsRl8ooPAyiey1WWL8Yd+q1ty lGQ4hOqpBL4SO1F4POEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHRTF-005hJu-Ly; Fri, 29 Jul 2022 15:00:09 +0000 Received: from mail-yw1-f178.google.com ([209.85.128.178]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHRTB-005hC5-48; Fri, 29 Jul 2022 15:00:07 +0000 Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-2ef5380669cso53732097b3.9; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=ji95wo7/9zVEy11bFeZSmHkPeY5ayrY540Vw1taTitSlCihyL6MV8jpI4awhbD7jmo 1cgg5poyjwNhfSnScWmu/8czzZOviiU+9Yf0aM+yzCWUApM6OGA4nRyMspY3SV5dT/E4 39s1iw7ygaSrKjTQDVrsREmDCiYw4U5gWNEkHtv/r5+YYHBWrJkTwC0903miAdy2IKab NkwTt+oD2eiQP7hsWACeB3tGMniB6kgKG/xeyyUI5sxHN5vOEsA8QJLAZZIbifG+5wFi dkYUXK5fWsZRwzIYpe1ONaTtf+AciTApj9ssLGhlIf/ERxYy2b59VJ09Wd76Npx4EK/2 O3FA== X-Gm-Message-State: ACgBeo0QIwn31eiMHz4XAUCyeKPTbeCE4f4EsEggztmrnZ3Rz0l9MQfL 8TKoRWHXNgJjzbG95Vo0tCBMEpSFfCo+tU4ywWc= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Cc: "Paul E. McKenney" , Peter Zijlstra , Richard Henderson , Ivan Kokshaysky , Matt Turner , vgupta@kernel.org, Russell King - ARM Linux , ulli.kroll@googlemail.com, Linus Walleij , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , dl-linux-imx , Tony Lindgren , Kevin Hilman , Catalin Marinas , Will Deacon , Guo Ren , bcain@quicinc.com, Huacai Chen , kernel@xen0n.name, Geert Uytterhoeven , sammy@sammy.net, Michal Simek , Thomas Bogendoerfer , dinguyen@kernel.org, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, Stafford Horne , James Bottomley , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , David Miller , Richard Weinberger , anton.ivanov@cambridgegreys.com, Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , acme@kernel.org, Mark Rutland , Alexander Shishkin , jolsa@kernel.org, namhyung@kernel.org, Juergen Gross , srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, Boris Ostrovsky , Chris Zankel , Max Filippov , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Michael Turquette , Stephen Boyd , Daniel Lezcano , Lorenzo Pieralisi , Sudeep Holla , Andy Gross , Bjorn Andersson , Anup Patel , Thierry Reding , Jon Hunter , Jacob Pan , Arnd Bergmann , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Steven Rostedt , Petr Mladek , senozhatsky@chromium.org, John Ogness , Frederic Weisbecker , quic_neeraju@quicinc.com, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , vschneid@redhat.com, jpoimboe@kernel.org, linux-alpha@vger.kernel.org, Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org, Linux ARM , Linux OMAP Mailing List , linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , "open list:BROADCOM NVRAM DRIVER" , openrisc@lists.librecores.org, Parisc List , linuxppc-dev , linux-riscv , linux-s390@vger.kernel.org, Linux-sh list , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-xtensa@linux-xtensa.org, ACPI Devel Maling List , Linux PM , linux-clk , linux-arm-msm , linux-tegra , linux-arch , rcu@vger.kernel.org, rh0@fb.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_080005_210954_8184630C X-CRM114-Status: GOOD ( 41.17 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FEC0C25B06 for ; Fri, 29 Jul 2022 15:00:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E521C40D7E; Fri, 29 Jul 2022 15:00:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E521C40D7E X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id josjQEdCiRXi; Fri, 29 Jul 2022 15:00:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 262C540C48; Fri, 29 Jul 2022 15:00:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 262C540C48 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F056AC0033; Fri, 29 Jul 2022 15:00:05 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 68899C002D for ; Fri, 29 Jul 2022 15:00:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 24DAE82F31 for ; Fri, 29 Jul 2022 15:00:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 24DAE82F31 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JFGITNDzTglD for ; Fri, 29 Jul 2022 15:00:03 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E5B2882F20 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by smtp1.osuosl.org (Postfix) with ESMTPS id E5B2882F20 for ; Fri, 29 Jul 2022 15:00:02 +0000 (UTC) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-31d85f82f0bso53790227b3.7 for ; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=wbzfIZCK4oqB4Jzup8xIDaleZIuqtJmWuSNbFHWONXuXZA1uLI+f8YtKPxwdHm6IZJ 3H/TBCGJk5icVneMD6684BDo1gWnwZ4O1aeGwtVZHQKT6axf/iaqb+NqHCEQadK5iBvd lOcb583KIEDnOLZzEA23MfJYvvXt35p2HkI6ddq+1E9yUdM42b+RK4RWEnbVWbLjszBJ CmtgOYOdiddQpU4WC8WPokjzSDUEewzpiqd4ZZN52mKkSeQVIh+mVopvR2TO0gbIx8nA 15E7F7nnLZAyWzLJBDlRx3eNPJR/UQ/fdaMK0qwHrBYW3CnMM7WGFlIzNzd5/m5sqrRA PmBw== X-Gm-Message-State: ACgBeo14qnfVEsMENGnfk02XVrYAr7xZxQyhay7SAxlvWegSfzdQ8Ne9 T1k2c+dmvRbjHn5IVAnphcTj6GMW7zJLgoOtsGg= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Cc: Juri Lelli , "Rafael J. Wysocki" , Benjamin Herrenschmidt , Linus Walleij , Benjamin Segall , Guo Ren , Pavel Machek , Alexander Gordeev , linux-arch , Vincent Guittot , Michael Ellerman , Huacai Chen , ACPI Devel Maling List , Andy Gross , Geert Uytterhoeven , dl-linux-imx , Catalin Marinas , xen-devel@lists.xenproject.org, Matt Turner , Michael Turquette , sammy@sammy.net, Petr Mladek , Linux PM , Lai Jiangshan , Sascha Hauer , linux-um@lists.infradead.org, acme@kernel.org, Thomas Gleixner , Linux OMAP Mailing List , Dietmar Eggemann , Richard Henderson , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-perf-users@vger.kernel.org, senozhatsky@chromium.org, Sven Schnelle , jolsa@kernel.org, Paul Mackerras , Mark Rutland , linux-ia64@vger.kernel.org, Dave Hansen , virtualization@lists.linux-foundation.org, James Bottomley , Max Filippov , Thierry Reding , kernel@xen0n.name, quic_neeraju@quicinc.com, linux-s390@vger.kernel.org, vschneid@redhat.com, John Ogness , Yoshinori Sato , Linux-sh list , Will Deacon , Helge Deller , Daniel Lezcano , Jon Hunter , Mathieu Desnoyers , Frederic Weisbecker , Len Brown , linux-xtensa@linux-xtensa.org, Sascha Hauer , Vasily Gorbik , linux-arm-msm , linux-alpha@vger.kernel.org, linux-m68k , Stafford Horne , Linux ARM , Chris Zankel , Stephen Boyd , rh0@fb.com, dinguyen@kernel.org, Daniel Bristot de Oliveira , Alexander Shishkin , Lorenzo Pieralisi , Rasmus Villemoes , Joel Fernandes , Fabio Estevam , Boris Ostrovsky , Josh Triplett , Kevin Hilman , linux-csky@vger.kernel.org, Tony Lindgren , linux-snps-arc@lists.infradead.org, Mel Gorman , Jacob Pan , Yury Norov , ulli.kroll@googlemail.com, vgupta@kernel.org, linux-clk , Michal Simek , Steven Rostedt , rcu@vger.kernel.org, Borislav Petkov , bcain@quicinc.com, Thomas Bogendoerfer , Parisc List , Sudeep Holla , Shawn Guo , David Miller , Rich Felker , Peter Zijlstra , amakhalov@vmware.com, Bjorn Andersson , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv , anton.ivanov@cambridgegreys.com, jonas@southpole.se, Arnd Bergmann , Richard Weinberger , the arch/x86 maintainers , Russell King - ARM Linux , Ingo Molnar , Albert Ou , "Paul E. McKenney" , Heiko Carstens , stefan.kristiansson@saunalahti.fi, openrisc@lists.librecores.org, Paul Walmsley , linux-tegra , namhyung@kernel.org, Andy Shevchenko , jpoimboe@kernel.org, Juergen Gross , pv-drivers@vmware.com, "open list:BROADCOM NVRAM DRIVER" , Palmer Dabbelt , Anup Patel , Ivan Kokshaysky , Johannes Berg , linuxppc-dev X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AF9BC00144 for ; Fri, 29 Jul 2022 16:31:06 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LvY150ZGzz3cFl for ; Sat, 30 Jul 2022 02:31:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.128.175; helo=mail-yw1-f175.google.com; envelope-from=rjwysocki@gmail.com; receiver=) Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LvW073T2jz2xHf for ; Sat, 30 Jul 2022 01:00:05 +1000 (AEST) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-322b5199358so51400607b3.6 for ; Fri, 29 Jul 2022 08:00:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=HQjoEdo8hK2IS6r7YB0Mh3UWaiXgQEz6r8A6b1RAoQZo1pq4mfK0fQd0dIcZ5HK95H feoakTAyHItyqh3lq5LHe7PQwfwxcsIS4bFmN5nIOnIAsDZk336g6De/28XZ3ee9UQ85 Sf8DxdiZg+8NMomp1xEwaZPAX4zxDCwReqF4rNusbGysbPvwTgyLJUuRoq/cUh4ffc5I T82TePzRXLY3gqCvpFiUzL8uXC7fJhnU1WWoYZXl8ND5/6N0gNa1pcyoexsCtrJssyMM uXPT0JJJWXjtOULUbMIXLIIsh+fYH5uYQVZGelUEJ51JZ/BT37nXE0nFBrwjJmep7ArK UUQw== X-Gm-Message-State: ACgBeo02OUuTNeUFml9db2JYYP4gAFOTZkc3Q+DS13PC6Worb9RnwHue 8gXszEdENIr/X9hQMgg70ReJXC01T5PdTtiFJtI= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Sat, 30 Jul 2022 02:30:06 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , "Rafael J. Wysocki" , Linus Walleij , Benjamin Segall , Guo Ren , Pavel Machek , Alexander Gordeev , srivatsa@csail.mit.edu, linux-arch , Vincent Guittot , Huacai Chen , ACPI Devel Maling List , Andy Gross , Geert Uytterhoeven , dl-linux-imx , Catalin Marinas , xen-devel@lists.xenproject.org, Matt Turner , Christian Borntraeger , Michael Turquette , sammy@sammy.net, Petr Mladek , Linux PM , Lai Jiangshan , Sascha Hauer , linux-um@lists.infradead.org, acme@kernel.org, Thomas G leixner , Linux OMAP Mailing List , Dietmar Eggemann , Richard Henderson , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-perf-users@vger.kernel.org, senozhatsky@chromium.org, Sven Schnelle , jolsa@kernel.org, Paul Mackerras , Mark Rutland , linux-ia64@vger.kernel.org, Dave Hansen , virtualization@lists.linux-foundation.org, James Bottomley , Max Filippov , Thierry Reding , kernel@xen0n.name, quic_neeraju@quicinc.com, linux-s390@vger.kernel.org, vschneid@redhat.com, John Ogness , Yoshinori Sato , Linux-sh list , Will Deacon , Helge Deller , Danie l Lezcano , Jon Hunter , Mathieu Desnoyers , Frederic Weisbecker , Len Brown , linux-xtensa@linux-xtensa.org, Sascha Hauer , Vasily Gorbik , linux-arm-msm , linux-alpha@vger.kernel.org, linux-m68k , Stafford Horne , Linux ARM , Chris Zankel , Stephen Boyd , rh0@fb.com, dinguyen@kernel.org, Daniel Bristot de Oliveira , Alexander Shishkin , Lorenzo Pieralisi , Rasmus Villemoes , Joel Fernandes , Fabio Estevam , Boris Ostrovsky , Josh Triplett , Kevin Hilman , linux-csky@vger.kernel.org, Tony Lindgren , linux-snps-arc@lists.infradead.org, Mel Gorman , Jacob Pan , Yury Norov , ulli.kroll@googlemail.com, vgupta@kernel.org, linux-clk , Michal Simek , Steven Rostedt , rcu@vger.kernel.org, Borislav Petkov , bcain@quicinc.com, Thomas Bogendoerfer , Parisc List , Sudeep Holla , Shawn Guo , David Miller , Rich Felker , Peter Zijlstra , amakhalov@vmware.com, Bjorn Andersson , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv , anton.ivanov@cambridgegreys.com, jonas@southpole.se, Arnd Bergmann , Richard Weinberger , the arch/x86 maintainers , Russell King - ARM Linux , Ingo Molnar , Albert Ou , "Paul E. McKenney" , Heiko Carstens , stefan.kristiansson@saunalahti.fi, openrisc@lists.librecores.org, Paul Walmsley , linux-tegra , namhyung@kernel.org, Andy Shevchenko , jpoimboe@kernel.org, Juergen Gross , pv-drivers@vmware.com, "open list:BROADCOM NVRAM DRIVER" , Palmer Dabbelt , Anup Patel , Ivan Kokshaysky , Johannes Berg , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21420C00144 for ; Fri, 29 Jul 2022 17:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AC1tYndy4JmVolZHTPdnWKppl64JlNOvI0sG0QpsKQY=; b=UPrVz0UVboErUV PYD26AklL536y+zAUvrvlbDmbFykj1+cpmESodTNn7VC58bE5rQ6iYIhDSwqs7alMpy733KuzAQZY ayraQsmnwwmp3tIpnNxvxXvQX+IqgIpLp/j0IN7/Rkod3cd7fn9fWhmOYB2KwIB1NhcdO7IrLAXHU uGkDnJUvylIsHWij5FZX7Dr1X/NOw/k+0JwYCGDKHMy4hMRTOZBGpZRIXkHiPFzOzvOhCqHJX++UP z+EPhHbqqAJkp3ZH8yEJH1iTiy5ukDPeYRLH9cJhpTPkZyiFnlJWktl6ofTiunoC3b4DRXPndSmEg X+50jxdOoXfUPYtlIZ4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHTqJ-008J9c-LG; Fri, 29 Jul 2022 17:32:07 +0000 Received: from mail-yw1-f178.google.com ([209.85.128.178]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHRTB-005hC5-48; Fri, 29 Jul 2022 15:00:07 +0000 Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-2ef5380669cso53732097b3.9; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=ji95wo7/9zVEy11bFeZSmHkPeY5ayrY540Vw1taTitSlCihyL6MV8jpI4awhbD7jmo 1cgg5poyjwNhfSnScWmu/8czzZOviiU+9Yf0aM+yzCWUApM6OGA4nRyMspY3SV5dT/E4 39s1iw7ygaSrKjTQDVrsREmDCiYw4U5gWNEkHtv/r5+YYHBWrJkTwC0903miAdy2IKab NkwTt+oD2eiQP7hsWACeB3tGMniB6kgKG/xeyyUI5sxHN5vOEsA8QJLAZZIbifG+5wFi dkYUXK5fWsZRwzIYpe1ONaTtf+AciTApj9ssLGhlIf/ERxYy2b59VJ09Wd76Npx4EK/2 O3FA== X-Gm-Message-State: ACgBeo0QIwn31eiMHz4XAUCyeKPTbeCE4f4EsEggztmrnZ3Rz0l9MQfL 8TKoRWHXNgJjzbG95Vo0tCBMEpSFfCo+tU4ywWc= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Cc: "Paul E. McKenney" , Peter Zijlstra , Richard Henderson , Ivan Kokshaysky , Matt Turner , vgupta@kernel.org, Russell King - ARM Linux , ulli.kroll@googlemail.com, Linus Walleij , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , dl-linux-imx , Tony Lindgren , Kevin Hilman , Catalin Marinas , Will Deacon , Guo Ren , bcain@quicinc.com, Huacai Chen , kernel@xen0n.name, Geert Uytterhoeven , sammy@sammy.net, Michal Simek , Thomas Bogendoerfer , dinguyen@kernel.org, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, Stafford Horne , James Bottomley , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , David Miller , Richard Weinberger , anton.ivanov@cambridgegreys.com, Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , acme@kernel.org, Mark Rutland , Alexander Shishkin , jolsa@kernel.org, namhyung@kernel.org, Juergen Gross , srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, Boris Ostrovsky , Chris Zankel , Max Filippov , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Michael Turquette , Stephen Boyd , Daniel Lezcano , Lorenzo Pieralisi , Sudeep Holla , Andy Gross , Bjorn Andersson , Anup Patel , Thierry Reding , Jon Hunter , Jacob Pan , Arnd Bergmann , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Steven Rostedt , Petr Mladek , senozhatsky@chromium.org, John Ogness , Frederic Weisbecker , quic_neeraju@quicinc.com, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , vschneid@redhat.com, jpoimboe@kernel.org, linux-alpha@vger.kernel.org, Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org, Linux ARM , Linux OMAP Mailing List , linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , "open list:BROADCOM NVRAM DRIVER" , openrisc@lists.librecores.org, Parisc List , linuxppc-dev , linux-riscv , linux-s390@vger.kernel.org, Linux-sh list , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-xtensa@linux-xtensa.org, ACPI Devel Maling List , Linux PM , linux-clk , linux-arm-msm , linux-tegra , linux-arch , rcu@vger.kernel.org, rh0@fb.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_080005_210954_8184630C X-CRM114-Status: GOOD ( 41.17 ) X-Mailman-Approved-At: Fri, 29 Jul 2022 10:19:48 -0700 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.librecores.org (lists.librecores.org [88.198.125.70]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BFC0C25B07 for ; Sun, 31 Jul 2022 22:07:42 +0000 (UTC) Received: from [172.31.1.100] (localhost.localdomain [127.0.0.1]) by mail.librecores.org (Postfix) with ESMTP id 39C2924786; Mon, 1 Aug 2022 00:07:41 +0200 (CEST) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by mail.librecores.org (Postfix) with ESMTPS id 048E624243 for ; Fri, 29 Jul 2022 17:00:03 +0200 (CEST) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-31e7ca45091so54001937b3.3 for ; Fri, 29 Jul 2022 08:00:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=S1YI+SR1sGADVizxFmy+lJ0FTmSOnUKcWTIA6mLx/E8=; b=hdacc/1AKp2L+oQeni8mgZLaty7/3wvbVPbewykHWqBEHm6mBVr4eMzoMszBqMqmrg IZX6xD2lt8bVuM9n6pDtVGNqo7RD9jmcG8xJzNGjBzJqOFyO1o+VpsURpYDrEpNWhGxS kD1AQ/oySx30pxYVz2usr3tXJvFADP+hp9hUlvu9eR7LAl/Vp5ALVsQA08916kNrFu0S JP7a56caE8dz2/d+iwo4pQcALn39jJp4kaPEYlH86M+htmLGqgRXqmM7w+LQNQeKw539 2stNuPQaGgCWNzc/jVBrNXBDHySErSws1ywORcm9tUrD79LclaCloMoYtIgGDeZNq/fG IVLA== X-Gm-Message-State: ACgBeo3un3PB+7oYjDMBSoaGJkLQoZBYid2rbkUTvfpbqjQw3AYi6Z4Z jtAV98b0x6z5n1MNPs23+YKVfNDf+YR6atonRfQ= X-Google-Smtp-Source: AA6agR5QQFhqUTEC/IGPMir7zUIdteVkQo93xHT0n5oUM+G+UQ5tpfdzHAC9fZE5clkaGoQ4WXKUt2zD7Q2S/JCn7tY= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr3338822ywb.326.1659106801810; Fri, 29 Jul 2022 08:00:01 -0700 (PDT) MIME-Version: 1.0 References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE To: Michel Lespinasse Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Mon, 01 Aug 2022 00:07:35 +0200 X-BeenThere: openrisc@lists.librecores.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussion around the OpenRISC processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , "Rafael J. Wysocki" , Benjamin Herrenschmidt , Linus Walleij , Benjamin Segall , Guo Ren , Pavel Machek , Alexander Gordeev , srivatsa@csail.mit.edu, linux-arch , Vincent Guittot , Michael Ellerman , Huacai Chen , ACPI Devel Maling List , Andy Gross , dl-linux-imx , Catalin Marinas , xen-devel@lists.xenproject.org, Matt Turner , Christian Borntraeger , Michael Turquette , sammy@sammy.net, Petr Mladek , Linux PM , Lai Jiangshan , Sascha Hauer , linux-um@lists.infradead.org, acme@kernel.org, Thomas Gleixner , Linux OMAP Mailing List , Dietmar Eggemann , Richard Henderson , Greg Kroah-Hartman , Linux Kernel Mailing List , linux-perf-users@vger.kernel.org, senozhatsky@chromium.org, Sven Schnelle , jolsa@kernel.org, Paul Mackerras , Mark Rutland , linux-ia64@vger.kernel.org, Dave Hansen , virtualization@lists.linux-foundation.org, James Bottomley , Max Filippov , Thierry Reding , kernel@xen0n.name, quic_neeraju@quicinc.com, linux-s390@vger.kernel.org, vschneid@redhat.com, John Ogness , Yoshinori Sato , Linux-sh list , Will Deacon , Helge Deller , Daniel Lezcano , Jon Hunter , Mathieu Desnoyers , Frederic Weisbecker , Len Brown , linux-xtensa@linux-xtensa.org, Sascha Hauer , Vasily Gorbik , linux-arm-msm , linux-alpha@vger.kernel.org, linux-m68k , Linux ARM , Chris Zankel , Stephen Boyd , rh0@fb.com, dinguyen@kernel.org, Daniel Bristot de Oliveira , Alexander Shishkin , Lorenzo Pieralisi , Rasmus Villemoes , Joel Fernandes , Fabio Estevam , Boris Ostrovsky , Josh Triplett , Kevin Hilman , linux-csky@vger.kernel.org, Tony Lindgren , linux-snps-arc@lists.infradead.org, Mel Gorman , Jacob Pan , Yury Norov , ulli.kroll@googlemail.com, vgupta@kernel.org, linux-clk , Michal Simek , Steven Rostedt , rcu@vger.kernel.org, Borislav Petkov , bcain@quicinc.com, Thomas Bogendoerfer , Parisc List , Sudeep Holla , Shawn Guo , David Miller , Rich Felker , Peter Zijlstra , amakhalov@vmware.com, Bjorn Andersson , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv , anton.ivanov@cambridgegreys.com, jonas@southpole.se, Arnd Bergmann , Richard Weinberger , the arch/x86 maintainers , Russell King - ARM Linux , Ingo Molnar , Albert Ou , "Paul E. McKenney" , Heiko Carstens , openrisc@lists.librecores.org, Paul Walmsley , linux-tegra , namhyung@kernel.org, Andy Shevchenko , jpoimboe@kernel.org, Juergen Gross , pv-drivers@vmware.com, "open list:BROADCOM NVRAM DRIVER" , Palmer Dabbelt , Anup Patel , Ivan Kokshaysky , Johannes Berg , linuxppc-dev Errors-To: openrisc-bounces@lists.librecores.org Sender: "OpenRISC" On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Date: Fri, 29 Jul 2022 14:59:50 +0000 Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE Message-Id: List-Id: References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> In-Reply-To: <20220729102458.GA1695@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michel Lespinasse Cc: "Paul E. McKenney" , Peter Zijlstra , Richard Henderson , Ivan Kokshaysky , Matt Turner , vgupta@kernel.org, Russell King - ARM Linux , ulli.kroll@googlemail.com, Linus Walleij , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , dl-linux-imx , Tony Lindgren , Kevin Hilman , Catalin Marinas , Will Deacon , Guo Ren , bcain@quicinc.com, Huacai Chen , kernel@xen0n.name, Geert Uytterhoeven , sammy@sammy.net, Michal Simek , Thomas Bogendoerfer , dinguyen@kernel.org, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, Stafford Horne , James Bottomley , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , David Miller , Richard Weinberger , anton.ivanov@cambridgegreys.com, Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , acme@kernel.org, Mark Rutland , Alexander Shishkin , jolsa@kernel.org, namhyung@kernel.org, Juergen Gross , srivatsa@csail.mit.edu, amakhalov@vmware.com, pv-drivers@vmware.com, Boris Ostrovsky , Chris Zankel , Max Filippov , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Michael Turquette , Stephen Boyd , Daniel Lezcano , Lorenzo Pieralisi , Sudeep Holla , Andy Gross , Bjorn Andersson , Anup Patel , Thierry Reding , Jon Hunter , Jacob Pan , Arnd Bergmann , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Steven Rostedt , Petr Mladek , senozhatsky@chromium.org, John Ogness , Frederic Weisbecker , quic_neeraju@quicinc.com, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , vschneid@redhat.com, jpoimboe@kernel.org, linux-alpha@vger.kernel.org, Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org, Linux ARM , Linux OMAP Mailing List , linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-m68k , "open list:BROADCOM NVRAM DRIVER" , openrisc@lists.librecores.org, Parisc List , linuxppc-dev , linux-riscv , linux-s390@vger.kernel.org, Linux-sh list , sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-xtensa@linux-xtensa.org, ACPI Devel Maling List , Linux PM , linux-clk , linux-arm-msm , linux-tegra , linux-arch , rcu@vger.kernel.org, rh0@fb.com On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ? From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH 04/36] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE Date: Fri, 29 Jul 2022 16:59:50 +0200 Message-ID: References: <20220608142723.103523089@infradead.org> <20220608144516.172460444@infradead.org> <20220725194306.GA14746@lespinasse.org> <20220728172053.GA3607379@paulmck-ThinkPad-P17-Gen-1> <20220729102458.GA1695@lespinasse.org> Mime-Version: 1.0 Return-path: In-Reply-To: <20220729102458.GA1695@lespinasse.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Michel Lespinasse Cc: "Paul E. McKenney" , Peter Zijlstra , Richard Henderson , Ivan Kokshaysky , Matt Turner , vgupta@kernel.org, Russell King - ARM Linux , ulli.kroll@googlemail.com, Linus Walleij , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , dl-linux-imx , Tony Lindgren , Kevin Hilman , Catalin Marinas , Will Deacon , Guo Ren , bcain@quicinc.com, Huacai Chen , kernel@xen0 On Fri, Jul 29, 2022 at 12:25 PM Michel Lespinasse wrote: > > On Thu, Jul 28, 2022 at 10:20:53AM -0700, Paul E. McKenney wrote: > > On Mon, Jul 25, 2022 at 12:43:06PM -0700, Michel Lespinasse wrote: > > > On Wed, Jun 08, 2022 at 04:27:27PM +0200, Peter Zijlstra wrote: > > > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > > > > Xeons") wrecked intel_idle in two ways: > > > > > > > > - must not have tracing in idle functions > > > > - must return with IRQs disabled > > > > > > > > Additionally, it added a branch for no good reason. > > > > > > > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > After this change was introduced, I am seeing "WARNING: suspicious RCU > > > usage" when booting a kernel with debug options compiled in. Please > > > see the attached dmesg output. The issue starts with commit 32d4fd5751ea > > > and is still present in v5.19-rc8. > > > > > > I'm not sure, is this too late to fix or revert in v5.19 final ? > > > > I finally got a chance to take a quick look at this. > > > > The rcu_eqs_exit() function is making a lockdep complaint about > > being invoked with interrupts enabled. This function is called from > > rcu_idle_exit(), which is an expected code path from cpuidle_enter_state() > > via its call to rcu_idle_exit(). Except that rcu_idle_exit() disables > > interrupts before invoking rcu_eqs_exit(). > > > > The only other call to rcu_idle_exit() does not disable interrupts, > > but it is via rcu_user_exit(), which would be a very odd choice for > > cpuidle_enter_state(). > > > > It seems unlikely, but it might be that it is the use of local_irq_save() > > instead of raw_local_irq_save() within rcu_idle_exit() that is causing > > the trouble. If this is the case, then the commit shown below would > > help. Note that this commit removes the warning from lockdep, so it > > is necessary to build the kernel with CONFIG_RCU_EQS_DEBUG=y to enable > > equivalent debugging. > > > > Could you please try your test with the -rce commit shown below applied? > > Thanks for looking into it. > > After checking out Peter's commit 32d4fd5751ea, > cherry picking your commit ed4ae5eff4b3, > and setting CONFIG_RCU_EQS_DEBUG=y in addition of my usual debug config, > I am now seeing this a few seconds into the boot: > > [ 3.010650] ------------[ cut here ]------------ > [ 3.010651] WARNING: CPU: 0 PID: 0 at kernel/sched/clock.c:397 sched_clock_tick+0x27/0x60 > [ 3.010657] Modules linked in: > [ 3.010660] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc1-test-00005-g1be22fea0611 #1 > [ 3.010662] Hardware name: LENOVO 30BFS44D00/1036, BIOS S03KT51A 01/17/2022 > [ 3.010663] RIP: 0010:sched_clock_tick+0x27/0x60 > [ 3.010665] Code: 1f 40 00 53 eb 02 5b c3 66 90 8b 05 2f c3 40 01 85 c0 74 18 65 8b 05 60 88 8f 4e 85 c0 75 0d 65 8b 05 a9 85 8f 4e 85 c0 74 02 <0f> 0b e8 e2 6c 89 00 48 c7 c3 40 d5 02 00 > 89 c0 48 03 1c c5 c0 98 > [ 3.010667] RSP: 0000:ffffffffb2803e28 EFLAGS: 00010002 > [ 3.010670] RAX: 0000000000000001 RBX: ffffc8ce7fa07060 RCX: 0000000000000001 > [ 3.010671] RDX: 0000000000000000 RSI: ffffffffb268dd21 RDI: ffffffffb269ab13 > [ 3.010673] RBP: 0000000000000001 R08: ffffffffffc300d5 R09: 000000000002be80 > [ 3.010674] R10: 000003625b53183a R11: ffffa012b802b7a4 R12: ffffffffb2aa9e80 > [ 3.010675] R13: ffffffffb2aa9e00 R14: 0000000000000001 R15: 0000000000000000 > [ 3.010677] FS: 0000000000000000(0000) GS:ffffa012b8000000(0000) knlGS:0000000000000000 > [ 3.010678] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 3.010680] CR2: ffffa012f81ff000 CR3: 0000000c99612001 CR4: 00000000003706f0 > [ 3.010681] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 3.010682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 3.010683] Call Trace: > [ 3.010685] > [ 3.010688] cpuidle_enter_state+0xb7/0x4b0 > [ 3.010694] cpuidle_enter+0x29/0x40 > [ 3.010697] do_idle+0x1d4/0x210 > [ 3.010702] cpu_startup_entry+0x19/0x20 > [ 3.010704] rest_init+0x117/0x1a0 > [ 3.010708] arch_call_rest_init+0xa/0x10 > [ 3.010711] start_kernel+0x6d8/0x6ff > [ 3.010716] secondary_startup_64_no_verify+0xce/0xdb > [ 3.010728] > [ 3.010729] irq event stamp: 44179 > [ 3.010730] hardirqs last enabled at (44179): [] asm_sysvec_apic_timer_interrupt+0x1b/0x20 > [ 3.010734] hardirqs last disabled at (44177): [] __do_softirq+0x3f0/0x498 > [ 3.010736] softirqs last enabled at (44178): [] __do_softirq+0x332/0x498 > [ 3.010738] softirqs last disabled at (44171): [] irq_exit_rcu+0xab/0xf0 > [ 3.010741] ---[ end trace 0000000000000000 ]--- Can you please give this patch a go: https://patchwork.kernel.org/project/linux-pm/patch/Yt/AxPFi88neW7W5@e126311.manchester.arm.com/ ?