Message ID | 20231228145416.GAZY2MGLY6THMkAZ2W@fat_crate.local |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2042369dyb; Thu, 28 Dec 2023 07:01:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9q8zYxVUogy3HWFZg5d6QapObbqJlqyO9ZlPrEu5ms2HwOS+eKSVbvTILPai7LJoGLGUf X-Received: by 2002:a17:90a:7e96:b0:28b:c10e:2f1e with SMTP id j22-20020a17090a7e9600b0028bc10e2f1emr3577633pjl.23.1703775665497; Thu, 28 Dec 2023 07:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703775665; cv=none; d=google.com; s=arc-20160816; b=nBShHk0JyfM+/swiibLfi9snq7ee9eUW6XE6Q7D6ol9/A/nc9nWVmh3e6eqDTB0Lt5 Xd6+ndDOx3eHhWs8AABfEeuCjqJoot0IXrA0cuE5O7fJEK8/lR3T1+quCHYV0IYi72gY eVTj3gj56YX2WRTaihlmekfq2rCA1Mxh8SL1Pnix3UlmXfyjs8rvNBha8sBXS86gX8T1 shx/WQ8csyR99kRAYw76qSazpexRL/1Rxu1xVpZ1Z7bbgiPswmwXZb13hs3DDnNk+9vm RdTGAeELZNTTsYeBK2IrvKGFmupx1OAwtEgvae3de3B/h/RC4W3vz1DkaJH13Ln5YhBd 5VhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=jcyDiPI487B6t/5OUI/W6GwQkhmDmtuv3TJj+zdWb2c=; fh=7S/cfKdmLfZl1UkZgvxFR+YQtHuap9QwQTItV92FqF4=; b=STt3SJ/rzTzn7id1OYDvrblmPZm5R5yeVW84Dw1sT4xpDPKwdgVEO7Ol1LRSa8ibKq za92mxk/gNwNQu88Gyb5HMDMjlOZWKopRgKJp7gTxCbih6hSeSxEhl3/r1tX6jX4IauC zeyCZmKHcVDw8ZG6nvQe2ysxY6Pg94HURzBTaodRgGI9FEkvxEUv5QWyl0NsMTJbJT3Z TO5n3z1X7PdP/4zzChcs+rw171jsA6hDNzQy23nn75cl6o6e0ZPZkg8EyO/y+XmIULhR yqWEYubQ+HTWO9/x+G7Q1swxb/m4jb7a8fk4pu35PvvE79pDLVDTjH+o7O39/1YTTEZJ 5Gcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=Spwhd9EY; spf=pass (google.com: domain of linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f2-20020a17090a654200b0028bc5439f1dsi13150069pjs.59.2023.12.28.07.01.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 07:01:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=Spwhd9EY; spf=pass (google.com: domain of linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12721-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 02F4A285BEF for <ouuuleilei@gmail.com>; Thu, 28 Dec 2023 15:01:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7627BE56D; Thu, 28 Dec 2023 15:00:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="Spwhd9EY" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D011D526; Thu, 28 Dec 2023 15:00:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 66BC140E01A1; Thu, 28 Dec 2023 14:54:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ng2B1LZRXrFL; Thu, 28 Dec 2023 14:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1703775268; bh=jcyDiPI487B6t/5OUI/W6GwQkhmDmtuv3TJj+zdWb2c=; h=Date:From:To:Cc:Subject:From; b=Spwhd9EYHOOjpPmVPBFMW1p7OvIGjZHMzE5re9j+NS083HAxWSuaULrkF2O/p96np g/+UB+yjwCCtM0ZRXfslJNnNYku5hUNRlfe/l0E+2ecZYw6t8ruvGyH3AwmMZAwmyF Jorqe8Jez7HaqToDpefqGR+VdgB9ZOfmhTFLWyYCb+EAmR30uCvyw0G9s9siOjWCqP Y/Cg1I9pkGldj9lOusmR+JY10kVg0qAH3li2Ib6B1Pnn1I0BnXKdP/f2SlcjDWv+UH 8EHI9iI7MdQZRmzvdu1aHBVoqyqY6+RC66XnHpT56suQ6fd+1rkkPCgJxvbvGcqQJI 7QFx7UAAqnPg9IBubEpjYejrPTlZKBDP2ahzWT2Z9PQ+9TVxbl0TTAUOMMhVYk2+xr 0ssAyea+WQQjLHDeXQh2IDCM4nH20A3evPBFYzLZPRApN5b6BpaL6VGtLHedZOs3Tg EnR4YAbF7X9/+5tiKVNDq1yeAYoka82tMVbZNub6KpN4bS03+zRjSz/9T6YEYGSG3s p1xxOQH2dUE4vPSoeRAYiW+G6Lc4gduGXHG4R8gcn24f6f3am7lPsAYNwTmfUb6ziM IdTFbeGpUFbmgVptQo2qezc78mGoU4j16SLzqnGpjGVQTNXlQ3vbKEE0SvSSJ7Dk8e XTPABiVW1FDiDcsYUFEzgkOw= Received: from zn.tnic (pd9530f8c.dip0.t-ipconnect.de [217.83.15.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 5BEEB40E00CB; Thu, 28 Dec 2023 14:54:23 +0000 (UTC) Date: Thu, 28 Dec 2023 15:54:16 +0100 From: "Borislav Petkov (AMD)" <bp@alien8.de> To: linux-pm@vger.kernel.org, forza@tnonline.net Cc: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, lkml <linux-kernel@vger.kernel.org> Subject: [PATCH] cpuidle: haltpoll: Do not enable interrupts when entering idle Message-ID: <20231228145416.GAZY2MGLY6THMkAZ2W@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786538272034671955 X-GMAIL-MSGID: 1786538272034671955 |
Series |
cpuidle: haltpoll: Do not enable interrupts when entering idle
|
|
Commit Message
Borislav Petkov
Dec. 28, 2023, 2:54 p.m. UTC
Hi, I think PeterZ's massaging from https://lore.kernel.org/all/20230112194314.845371875@infradead.org/ missed one. @Forza, if you want to have your real name in the patch tags below and thus be part of git history, lemme know. If you don't want them there, either. Thx. --- From: Borislav Petkov (AMD) <bp@alien8.de> The cpuidle governors' ->enter() methods are supposed to be IRQ invariant: 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") bb7b11258561 ("cpuidle: Move IRQ state validation") Do that in the haltpoll governor too. Fixes: 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218245 Reported-by: <forza@tnonline.net> Tested-by: <forza@tnonline.net> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> --- drivers/cpuidle/cpuidle-haltpoll.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Comments
On Thu, Dec 28, 2023 at 3:54 PM Borislav Petkov (AMD) <bp@alien8.de> wrote: > > Hi, > > I think PeterZ's massaging from > > https://lore.kernel.org/all/20230112194314.845371875@infradead.org/ > > missed one. > > @Forza, if you want to have your real name in the patch tags below and > thus be part of git history, lemme know. If you don't want them there, > either. > > Thx. > > --- > From: Borislav Petkov (AMD) <bp@alien8.de> I would have appreciated a Subject: line here. > > The cpuidle governors' ->enter() methods are supposed to be IRQ > invariant: cpuidle governors have no ->enter() callbacks, drivers do. And this particular haltpoll is a driver (there is a haltpoll governor too, confusingly enough). > > 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") > bb7b11258561 ("cpuidle: Move IRQ state validation") > > Do that in the haltpoll governor too. And so s/governor/driver/ here. > Fixes: 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218245 > Reported-by: <forza@tnonline.net> > Tested-by: <forza@tnonline.net> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Nevertheless, applied (with the changelog adjustments mentioned above). > --- > drivers/cpuidle/cpuidle-haltpoll.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c > index e66df22f9695..d8515d5c0853 100644 > --- a/drivers/cpuidle/cpuidle-haltpoll.c > +++ b/drivers/cpuidle/cpuidle-haltpoll.c > @@ -25,13 +25,12 @@ MODULE_PARM_DESC(force, "Load unconditionally"); > static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; > static enum cpuhp_state haltpoll_hp_state; > > -static int default_enter_idle(struct cpuidle_device *dev, > - struct cpuidle_driver *drv, int index) > +static __cpuidle int default_enter_idle(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > { > - if (current_clr_polling_and_test()) { > - local_irq_enable(); > + if (current_clr_polling_and_test()) > return index; > - } > + > arch_cpu_idle(); > return index; > } > -- > 2.42.0.rc0.25.ga82fb66fed25 > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette
On Fri, Dec 29, 2023 at 06:12:36PM +0100, Rafael J. Wysocki wrote: > I would have appreciated a Subject: line here. mutt uses it as the actual subject if I do mutt -H /path/to/patch-file since I want to type in stuff before sending. > cpuidle governors have no ->enter() callbacks, drivers do. And this > particular haltpoll is a driver (there is a haltpoll governor too, > confusingly enough). Fun. > Nevertheless, applied (with the changelog adjustments mentioned above). Thanks!
diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index e66df22f9695..d8515d5c0853 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -25,13 +25,12 @@ MODULE_PARM_DESC(force, "Load unconditionally"); static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; static enum cpuhp_state haltpoll_hp_state; -static int default_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static __cpuidle int default_enter_idle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) { - if (current_clr_polling_and_test()) { - local_irq_enable(); + if (current_clr_polling_and_test()) return index; - } + arch_cpu_idle(); return index; }