From patchwork Thu Jan 12 19:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13098752 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 448D8C61DB3 for ; Thu, 12 Jan 2023 19:57:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECF928E0001; Thu, 12 Jan 2023 14:57:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8020900002; Thu, 12 Jan 2023 14:57:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99E388E0001; Thu, 12 Jan 2023 14:57:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 818F18E0007 for ; Thu, 12 Jan 2023 14:57:25 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3F7EB120DD2 for ; Thu, 12 Jan 2023 19:57:25 +0000 (UTC) X-FDA: 80347206450.15.7F6521E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id E8221C0004 for ; Thu, 12 Jan 2023 19:57:22 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XY7SfD4J; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673553443; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:references:dkim-signature; bh=zetob5Egrh+4xSqY+h3U8eHRaaU6Xv/VYHG/8LvUn9U=; b=y9mMxuicn+DF5027PaiO1n/QJ9jn+zc3urwmc89eBRZwVlBYCguxnir97puip/En5gz4Mx B9JRvqZxvRLR7cjY8jUVj+jvUckhpYKLi+OBkhpdFkw9nDOrSjUC089Rwe/BtoaC9Z4YZI snmbx2Wo7RGtxVGUHciKPwIjoxg9U0M= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=XY7SfD4J; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673553443; a=rsa-sha256; cv=none; b=OQpvq+YONlTL3g9KKSvpMalmfnhOFx2YS03Izha187rY2ejg5fkT14p/i3tuMTp5tUumZr TqkQez0GRiqlWcqf+9I7ElhffCIxTsk2sbY2FOxD8Z59MdrO+XjjwbU8kVmChuGmWgixeF skVXK9uVTHLYGHf40kCkwhe+5ElazkY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=zetob5Egrh+4xSqY+h3U8eHRaaU6Xv/VYHG/8LvUn9U=; b=XY7SfD4JzAJJbveELIvdat/cbW E+yFFn4aNWAgBawJ26SoENVk9HjgjCyHK9vtm0DJHnuC5VDdB61ndo4h4/i7Q5MSw1rkqiTic4+xR 3Y4D5MUptZ7ITQwdJ+rd2ao7vl1gTwOWK6Sx7WR4lsMotsDZ0CjhwtIvhpsU+NDMSFoT0g5aNyvGa iMi4QJBO85DnX+Mw7tQFfzfNeRIKSpTPmFw5CM4c/Zo+olx5lzudeaiJOWa1G7jKsVRtgbLWqFUp2 QH+tfhDjHvNHMqws27xY0eX//Ypm8qtyiO7rXUI4Q4fOaQ8sTUtjWWcBaaRXjx9gG6YdwAkHM+oGP 31LcvOtQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pG3hW-005OcC-5Z; Thu, 12 Jan 2023 19:57:26 +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 9F135302D60; Thu, 12 Jan 2023 20:57:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 956222CCF1F48; Thu, 12 Jan 2023 20:57:07 +0100 (CET) Message-ID: <20230112195539.515253662@infradead.org> User-Agent: quilt/0.66 Date: Thu, 12 Jan 2023 20:43:17 +0100 From: Peter Zijlstra 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 , 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 , 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 , 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" , Ulf Hansson Subject: [PATCH v3 03/51] cpuidle/poll: Ensure IRQ state is invariant References: <20230112194314.845371875@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E8221C0004 X-Stat-Signature: cq5yimk8bgyjaf7y1re31uqri9eekfqx X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1673553442-916715 X-HE-Meta: U2FsdGVkX18BGsxyWAbbtiYiAjXFglwieh8RIlAJzvnaqcotBkQqZaSRxIPzvveKsT755gIxtzwfPyFlC3uvDmljh0ExkzAzgk/zVeJGGEu9H2HKoMexNCYlHdUwvGdejlbTwhsDr0qZL9BNnPV3bUQQeHFbk1FI1D6KhMuMgN552aeFjfURH4MlaTMVtvDkkpu3ngmLNDiPHPRb3d2X4Z5ZJAgfBJWwAybEgkCPa1IQZ1EsjBsB7ljOma9vlER47u9S2eRD8Os+wU/EyAsUNpHivnCA/elMzLeEJfslEatiUGnLsWTh12tIKHWvpJJ1XmzQ3tz8r//1qON3PaOotaD4eAJT3VUWDqx2wANNT5d6MUN5fGin62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gy/p9yC46I/cUZS5Iv62qUSq21NAGY6aqsExn4xBHd1Ryf1ISY4dNcI1Keae2CSW7gSOWvMfKDaNnnfTh2kQ1F7yqXdziOphm9ND3d4ZEadLXJqPUSlAwsAXKvzWwqAY8QmfipW4fGAmphCcCgg8zgnSrfUSkb3Ic5laqWu39+Y22zEgpfQAq/t9nZA/Hj2xQLF1kx90m3g7pYFtWBK/z7cptZzwrsp18EneaCINUNnyYWAHFpHDCshjaBdZI4+0EarLmLBhWpKehFFCvP3a4lU3zeG0o9QTFhU/n6VH/cKMU5o0U9X2Y341ucAWPB/WRkZRpCj3qVbAGSGYLXNTrYq8adlpdM2+ajFgokzqdJkZM0yZ+1F6D351+p+Z30 EnEhN1wt rVrmnTovWylIGfGdMLfBNqAxPpvvsFURLoT4nZ5ZUFzZcJazljOPDW6bPtJHsovkXa/hTebu14ZZxIJPYmE1hl8wYmSDG5RPE1uPv5PNAy+w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: cpuidle_state::enter() methods should be IRQ invariant. Additionally make sure to use raw_local_irq_*() methods since this cpuidle callback will be called with RCU already disabled. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Rafael J. Wysocki Reviewed-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/cpuidle/poll_state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c @@ -17,7 +17,7 @@ static int __cpuidle poll_idle(struct cp dev->poll_time_limit = false; - local_irq_enable(); + raw_local_irq_enable(); if (!current_set_polling_and_test()) { unsigned int loop_count = 0; u64 limit; @@ -36,6 +36,8 @@ static int __cpuidle poll_idle(struct cp } } } + raw_local_irq_disable(); + current_clr_polling(); return index;