Message ID | 20221105212909.6526-1-samuel@sholland.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1182228wru; Sat, 5 Nov 2022 14:35:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BfCYPSA2xMBbw/U5Ja/lCCes2YX1HPerf2ffCuVKbtuVmkM2EFYb+V5VQu3Sd4m5hLIIm X-Received: by 2002:a17:90a:24b:b0:213:9da2:5c98 with SMTP id t11-20020a17090a024b00b002139da25c98mr43570160pje.123.1667684144402; Sat, 05 Nov 2022 14:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667684144; cv=none; d=google.com; s=arc-20160816; b=pVXY2tBosHNctrI8IU3P9MzIg0JrWrB55J6CiN6XAxmMr87zppAjQY5a49GcdvcXk3 4GCQRgQLhU/aVfnlohAHwRtiyQniTSR02/lUETcfrleKEwd9+lo5cCdqPA4PklAxr0Aw pzg1n7K371bvk2A2Kksd57NrM2HbMqP7sk/tj1X9T1DwAI9j375xAPHq4BCPxRy9OwB1 DSPHleabIpe/nHEZrRZIp/qi6Mxwsv8Rc6yxrRPw2XeGrp/zA1nLLtY9cAqQjKWefiso U1xbjBHmZQcipkuy8lWTIO8zlBGdGQ2icuL3I7kLPeBssKPcil98MDowqVLuCr3elkUt z+vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=1YxFOzKLb6PepEnje/cpfRYVJj5s6XwpPGi9iTAPYdA=; b=aaYW+LyYIFuBy2LYuVqsB7kJRus09sA0s/B4zF0EuOV5NvreatOjicYPJJ9Zg2LNWS CnUNueZN4S3tmU8Gzu/JmvYS+OsWJcP2zjv1KK/x+494VKX2IvLZmC6uATw1VmekZXZC sHTs8JoUUSYSv5EbJDz4l1/G7xrZ5BP29z8Qd3N2WnSP70e0pqhzxaKJRdVa69cmLSJe /cTvHVmifpAVpf07ljxti9HaLvqzKfBl8IojIeaeNqUWCF8F4MyteKsDRRBVtlViyZ/8 ik7Q4i2ibxrXON2wWACm+tnDd9TsneWBqmRHtlfqUGr5aqfbTr180zeMDxxEPC8yEzb9 +XhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=CAGtbpfM; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=shtJ+RRf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170903244a00b00187204b35besi5095796pls.203.2022.11.05.14.35.21; Sat, 05 Nov 2022 14:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm1 header.b=CAGtbpfM; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=shtJ+RRf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229694AbiKEV3S (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Sat, 5 Nov 2022 17:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbiKEV3R (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 5 Nov 2022 17:29:17 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E43FB9FE7 for <linux-kernel@vger.kernel.org>; Sat, 5 Nov 2022 14:29:15 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 4FB0532002E2; Sat, 5 Nov 2022 17:29:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 05 Nov 2022 17:29:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t=1667683751; x=1667770151; bh=1YxFOzKLb6PepEnje/cpfRYVJ j5s6XwpPGi9iTAPYdA=; b=CAGtbpfMa3ugNCnmNOq0OWGFMJzHOE+lVZ+A1Awxa EvXKKdKXjZ5X9F1WHzw7rBjFo55TJWON1syXXAz8lvEJ9un+YiTQO9IBEUOBwVvL 5nrTrpSfXLXbo04Q4cLPETofWnHkGokp+CC8jvlvzi3X3AJmbeiVowOZ5Fujtb2/ YOKzzOoltrbox4ECOrD9mVfFmEI9D6kW/PCxbeueyv18cyPdxgkfWtx9cyoQcv2O 6V4xixQoxMNRmnQMyWHJ+BThwaxOmHSqkM85rEpDKDl0ViV3e8KOsOgbZRRMekec m6bsRs3KytT6oC28YfQH6ubgzwKOk8B9gP+FQrnzBzo+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1667683751; x=1667770151; bh=1YxFOzKLb6PepEnje/cpfRYVJj5s6XwpPGi 9iTAPYdA=; b=shtJ+RRfCOZ4O8r1bhHrbDAOVM7IHZaZGuxr7XGdYcDWfL29dop py17gE7b7uk0VGNf2m3iEKIl3z9Axb4e9G5BMG1X7gJwWbG5SNR2uGzbix5cOMSA hMqqBjHcsszoLDSvI+mhc2xaI8MeOxcVyginL3l43yS+CsOCbHNZtflFzhgeffOJ rc4zdqKinjlQGw+CCI63rwhzXk9g/zmQ/rsiNNOMDhG9gH6WzCaMuZee/QliywjB cUrUzxz+rYFcN6JuljDDm22Z+MzaSPfNEIm0laYm26m0mhNp/BVL7AWP2etjuezd huBupQLel7xRCzuMSf1D4pEO6I49Xsn3TmQ== X-ME-Sender: <xms:ptVmYwvnDFTNsviSvJGWazvOlJnX3nXHjPuUouL2fGdV73911n2Z7w> <xme:ptVmY9ddLDEK_yWHyE2aksH0wklDnx_dFioxH61Qh-dcd6lGdk6JTj-s8g8T7obv1 XZG3VAopehhNWnI2A> X-ME-Received: <xmr:ptVmY7x2x7eWUwac7ac7GDNNmBxtkM0HsvAgUemZUCpU6Ql-x212G6_5r-HI5S1bMi3oB7R2cFvY0gEygBh7iX15MIy0bQxjn1oLjwtM987YCbyYzjr2L7glsyyalzE6Y2Tvsg> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdeggdefgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeekveelhfejueelleetvdejvdeffeetgeelheeujeffhefgffefkeehhffh keekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: <xmx:ptVmYzPizTbotWpF6P-ieL2iVLyVLknwNrFeR_o4QFvBXXqDciL5XA> <xmx:ptVmYw_mKky9rKuKW11G-54pV7VNiSArPWndi2nc10wpvIIfzTx8jw> <xmx:ptVmY7UKsJGxwNN0xQta00Y2eq8Xc4_SEhSxN6HkmhAj1o7u-qQUIg> <xmx:p9VmYwwlfu2eVe4VU3Ll4nycOCt07pteB995zRDBXh8ZUUMI6F_mfA> Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Nov 2022 17:29:10 -0400 (EDT) From: Samuel Holland <samuel@sholland.org> To: Chen-Yu Tsai <wens@csie.org>, Lee Jones <lee@kernel.org> Cc: Samuel Holland <samuel@sholland.org>, Dmitry Osipenko <dmitry.osipenko@collabora.com>, =?utf-8?b?TWljaGHFgiBNaXJv?= =?utf-8?b?c8WCYXc=?= <mirq-linux@rere.qmqm.pl>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>, linux-kernel@vger.kernel.org Subject: [PATCH] mfd: axp20x: Do not sleep in the power off handler Date: Sat, 5 Nov 2022 16:29:09 -0500 Message-Id: <20221105212909.6526-1-samuel@sholland.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748693569614704630?= X-GMAIL-MSGID: =?utf-8?q?1748693569614704630?= |
Series |
mfd: axp20x: Do not sleep in the power off handler
|
|
Commit Message
Samuel Holland
Nov. 5, 2022, 9:29 p.m. UTC
Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the
function axp20x_power_off() now runs inside a RCU read-side critical
section, so it is not allowed to call msleep(). Use mdelay() instead.
Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/mfd/axp20x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/6/22 00:29, Samuel Holland wrote: > Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the > function axp20x_power_off() now runs inside a RCU read-side critical > section, so it is not allowed to call msleep(). Use mdelay() instead. > > Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") > Signed-off-by: Samuel Holland <samuel@sholland.org> > --- > > drivers/mfd/axp20x.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c > index 88a212a8168c..880c41fa7021 100644 > --- a/drivers/mfd/axp20x.c > +++ b/drivers/mfd/axp20x.c > @@ -842,7 +842,7 @@ static void axp20x_power_off(void) > AXP20X_OFF); > > /* Give capacitors etc. time to drain to avoid kernel panic msg. */ > - msleep(500); > + mdelay(500); > } > > int axp20x_match_device(struct axp20x_dev *axp20x) ARM was doing local_irq_disable() on power-off before do_kernel_power_off() was introduced, so this should've been incorrect for a couple years at least. If I'm not missing anything.
On Sat, 05 Nov 2022, Samuel Holland wrote: > Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the > function axp20x_power_off() now runs inside a RCU read-side critical > section, so it is not allowed to call msleep(). Use mdelay() instead. > > Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") > Signed-off-by: Samuel Holland <samuel@sholland.org> > --- > > drivers/mfd/axp20x.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks.
On Mon, 07 Nov 2022, Dmitry Osipenko wrote: > On 11/6/22 00:29, Samuel Holland wrote: > > Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the > > function axp20x_power_off() now runs inside a RCU read-side critical > > section, so it is not allowed to call msleep(). Use mdelay() instead. > > > > Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") > > Signed-off-by: Samuel Holland <samuel@sholland.org> > > --- > > > > drivers/mfd/axp20x.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c > > index 88a212a8168c..880c41fa7021 100644 > > --- a/drivers/mfd/axp20x.c > > +++ b/drivers/mfd/axp20x.c > > @@ -842,7 +842,7 @@ static void axp20x_power_off(void) > > AXP20X_OFF); > > > > /* Give capacitors etc. time to drain to avoid kernel panic msg. */ > > - msleep(500); > > + mdelay(500); > > } > > > > int axp20x_match_device(struct axp20x_dev *axp20x) > > ARM was doing local_irq_disable() on power-off before > do_kernel_power_off() was introduced, so this should've been incorrect > for a couple years at least. If I'm not missing anything. Is that a review? Care to provide a tag?
On 11/7/22 12:39, Lee Jones wrote: > On Mon, 07 Nov 2022, Dmitry Osipenko wrote: > >> On 11/6/22 00:29, Samuel Holland wrote: >>> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the >>> function axp20x_power_off() now runs inside a RCU read-side critical >>> section, so it is not allowed to call msleep(). Use mdelay() instead. >>> >>> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") >>> Signed-off-by: Samuel Holland <samuel@sholland.org> >>> --- >>> >>> drivers/mfd/axp20x.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c >>> index 88a212a8168c..880c41fa7021 100644 >>> --- a/drivers/mfd/axp20x.c >>> +++ b/drivers/mfd/axp20x.c >>> @@ -842,7 +842,7 @@ static void axp20x_power_off(void) >>> AXP20X_OFF); >>> >>> /* Give capacitors etc. time to drain to avoid kernel panic msg. */ >>> - msleep(500); >>> + mdelay(500); >>> } >>> >>> int axp20x_match_device(struct axp20x_dev *axp20x) >> >> ARM was doing local_irq_disable() on power-off before >> do_kernel_power_off() was introduced, so this should've been incorrect >> for a couple years at least. If I'm not missing anything. > > Is that a review? Care to provide a tag? It's a review and my point was that the "Fixes" tag in this patch doesn't look correct. But this is minor comment, otherwise patch looks okay. Hope that the relevant I2C controller driver supports atomic transfer that are required for power-off to work. Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
On 11/6/22 16:40, Dmitry Osipenko wrote: > On 11/6/22 00:29, Samuel Holland wrote: >> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the >> function axp20x_power_off() now runs inside a RCU read-side critical >> section, so it is not allowed to call msleep(). Use mdelay() instead. >> >> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") >> Signed-off-by: Samuel Holland <samuel@sholland.org> >> --- >> >> drivers/mfd/axp20x.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c >> index 88a212a8168c..880c41fa7021 100644 >> --- a/drivers/mfd/axp20x.c >> +++ b/drivers/mfd/axp20x.c >> @@ -842,7 +842,7 @@ static void axp20x_power_off(void) >> AXP20X_OFF); >> >> /* Give capacitors etc. time to drain to avoid kernel panic msg. */ >> - msleep(500); >> + mdelay(500); >> } >> >> int axp20x_match_device(struct axp20x_dev *axp20x) > > ARM was doing local_irq_disable() on power-off before > do_kernel_power_off() was introduced, so this should've been incorrect > for a couple years at least. If I'm not missing anything. Yes, you're right. Then the correct tag is Fixes: 179dc63d06c5 ("mfd: axp20x: Add a 500ms delay at the end of axp20x_power_off") Regards, Samuel
On Mon, 07 Nov 2022, Dmitry Osipenko wrote: > On 11/7/22 12:39, Lee Jones wrote: > > On Mon, 07 Nov 2022, Dmitry Osipenko wrote: > > > >> On 11/6/22 00:29, Samuel Holland wrote: > >>> Since commit 856c288b0039 ("ARM: Use do_kernel_power_off()"), the > >>> function axp20x_power_off() now runs inside a RCU read-side critical > >>> section, so it is not allowed to call msleep(). Use mdelay() instead. > >>> > >>> Fixes: 856c288b0039 ("ARM: Use do_kernel_power_off()") > >>> Signed-off-by: Samuel Holland <samuel@sholland.org> > >>> --- > >>> > >>> drivers/mfd/axp20x.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c > >>> index 88a212a8168c..880c41fa7021 100644 > >>> --- a/drivers/mfd/axp20x.c > >>> +++ b/drivers/mfd/axp20x.c > >>> @@ -842,7 +842,7 @@ static void axp20x_power_off(void) > >>> AXP20X_OFF); > >>> > >>> /* Give capacitors etc. time to drain to avoid kernel panic msg. */ > >>> - msleep(500); > >>> + mdelay(500); > >>> } > >>> > >>> int axp20x_match_device(struct axp20x_dev *axp20x) > >> > >> ARM was doing local_irq_disable() on power-off before > >> do_kernel_power_off() was introduced, so this should've been incorrect > >> for a couple years at least. If I'm not missing anything. > > > > Is that a review? Care to provide a tag? > > It's a review and my point was that the "Fixes" tag in this patch > doesn't look correct. But this is minor comment, otherwise patch looks > okay. Hope that the relevant I2C controller driver supports atomic > transfer that are required for power-off to work. > > Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Thanks.
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 88a212a8168c..880c41fa7021 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -842,7 +842,7 @@ static void axp20x_power_off(void) AXP20X_OFF); /* Give capacitors etc. time to drain to avoid kernel panic msg. */ - msleep(500); + mdelay(500); } int axp20x_match_device(struct axp20x_dev *axp20x)