Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2405982rdh; Wed, 27 Sep 2023 01:18:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0JMen+uLQopBXmqEtP7cVjx8jQGDt1naeJZ+UM6i8jTuxjSofci9ARmdOhYt57wGFmz8g X-Received: by 2002:a05:6a21:32aa:b0:15c:cde5:fb02 with SMTP id yt42-20020a056a2132aa00b0015ccde5fb02mr1521122pzb.52.1695802688939; Wed, 27 Sep 2023 01:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695802688; cv=none; d=google.com; s=arc-20160816; b=rwECtiQ1OeYWgy6v5ZmKPVQABdNAg9c5AZxDfnmEF+J58UhcWhFlnIxT2R5FcEq5Aq fll957F0ElkVRX/Txh+OAyzz3eRwM99jRj8K3immeTKuUIErSTTYkM2ollVD116SP37k txnUGnvMNLg2/bCtf4v1ktwXxEd4Xf7Y7I47dJXQR9bnJ4FxLsKjWPTju+8Q0kYEdWzv 50g4nEyTbtZGGrOGx/CQFbO6g81gxvZ8CQTn/blkqqgKmosaSTslvaRWqJ+W4g9hV8eQ L+GK8CPXYuGDGGtvHCGsLK+tllMOnzyTyv9jLKYY5/h56FDp6gDbMoPwClMnWhzf9VWP ZdBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KlSQQh3u11EgpSDDbXEWrJRLshXYW6EsKo55WM7AJz8=; fh=2b0QyKFplLSVZWpi6tFa88/SPAI6Gnz2A75yE/76lpA=; b=mkeBwLQ8XAr4cGjL2NcJOaTyNZ6Nw4RUhN6hC18hnEk+qMgWnHRT+jLECXQQLb0oA9 awsGXZhASdNG6xQGkm48yKHSO+SYhEzb+2BubMpjoFBvR5mJjUOoopvifyZVhUgL3HXJ jEVlo5EJT+NEqljAw9V5uvI8TO89chZga8qB5g0oJ8BUc39xv/jeIVXEGTqKa8VpuPed Bll4+TH5QDn3tgHKJd9mewTi2FyRRRvJn7QpDyUbnpRHBWiEf+jxJnbG20aU/L/Tl3pT 0rWoYIxHmMHClO1ypI2O7SNWBpJ9cWqC4SI8HsG0AgrXlgrFO6QMnuK/dmLCC9JgeFYi VOcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tSj+Hw5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q1-20020a170902dac100b001c20db25108si9218075plx.41.2023.09.27.01.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 01:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tSj+Hw5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 28B2880D7547; Tue, 26 Sep 2023 04:33:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232696AbjIZLdQ (ORCPT + 99 others); Tue, 26 Sep 2023 07:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjIZLdP (ORCPT ); Tue, 26 Sep 2023 07:33:15 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69CEE9; Tue, 26 Sep 2023 04:33:07 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38QBWhw9043460; Tue, 26 Sep 2023 06:32:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1695727963; bh=KlSQQh3u11EgpSDDbXEWrJRLshXYW6EsKo55WM7AJz8=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=tSj+Hw5BATfgv84LpCnwE79TwBXvS4NbAKFfPstIsKcPTWNfhRAYo3KGXUdoQhNBC NSmtIv99ONltmsl0rPA7IJUjNtodgMj0HyAzlciWRIM/+yp3OkVLYbvlbgDJe6cRWV Bu1uSOXLlJgYGhSad1RLg4XBZnS/xGODUSdnGgSQ= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38QBWh5C064580 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Sep 2023 06:32:43 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 26 Sep 2023 06:32:43 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 26 Sep 2023 06:32:43 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38QBWfp9080419; Tue, 26 Sep 2023 06:32:42 -0500 Date: Tue, 26 Sep 2023 17:02:41 +0530 From: Dhruva Gole To: Thomas Richard CC: Tony Lindgren , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , , , Udit Kumar Subject: Re: [PATCH] serial: 8250_omap: Fix errors with no_console_suspend Message-ID: <20230926113241.ws2tco3poeixhupi@dhruva> References: <20230926061319.15140-1-tony@atomide.com> <652eb018-8e67-5f4b-8329-0f52159a27b1@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <652eb018-8e67-5f4b-8329-0f52159a27b1@bootlin.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 04:33:15 -0700 (PDT) On Sep 26, 2023 at 09:51:30 +0200, Thomas Richard wrote: > Hi Tony, > > Thanks for the fix. > > On 9/26/23 08:13, Tony Lindgren wrote: > > We now get errors on system suspend if no_console_suspend is set as > > reported by Thomas. The errors started with commit 20a41a62618d ("serial: > > 8250_omap: Use force_suspend and resume for system suspend"). > > > > Let's fix the issue by checking for console_suspend_enabled in the system > > suspend and resume path. > > > > Note that with this fix the checks for console_suspend_enabled in > > omap8250_runtime_suspend() become useless. We now keep runtime PM usage > > count for an attached kernel console starting with commit bedb404e91bb > > ("serial: 8250_port: Don't use power management for kernel console"). > > > > Fixes: 20a41a62618d ("serial: 8250_omap: Use force_suspend and resume for system suspend") > > Cc: Udit Kumar > > Reported-by: Thomas Richard Don't we want a closes: tag? > > Signed-off-by: Tony Lindgren > > Tested-by: Thomas Richard Thanks for testing Thomas > > > --- > > drivers/tty/serial/8250/8250_omap.c | 25 ++++++++++--------------- > > 1 file changed, 10 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c > > --- a/drivers/tty/serial/8250/8250_omap.c > > +++ b/drivers/tty/serial/8250/8250_omap.c > > @@ -1617,7 +1617,7 @@ static int omap8250_suspend(struct device *dev) > > { > > struct omap8250_priv *priv = dev_get_drvdata(dev); > > struct uart_8250_port *up = serial8250_get_port(priv->line); > > - int err; > > + int err = 0; > > > > serial8250_suspend_port(priv->line); > > > > @@ -1627,7 +1627,8 @@ static int omap8250_suspend(struct device *dev) > > if (!device_may_wakeup(dev)) > > priv->wer = 0; > > serial_out(up, UART_OMAP_WER, priv->wer); > > - err = pm_runtime_force_suspend(dev); > > + if (uart_console(&up->port) && console_suspend_enabled) > > + err = pm_runtime_force_suspend(dev); > > flush_work(&priv->qos_work); > > > > return err; > > @@ -1636,11 +1637,15 @@ static int omap8250_suspend(struct device *dev) > > static int omap8250_resume(struct device *dev) > > { > > struct omap8250_priv *priv = dev_get_drvdata(dev); > > + struct uart_8250_port *up = serial8250_get_port(priv->line); > > int err; > > > > - err = pm_runtime_force_resume(dev); > > - if (err) > > - return err; > > + if (uart_console(&up->port) && console_suspend_enabled) { > > + err = pm_runtime_force_resume(dev); > > + if (err) > > + return err; > > + } LGTM, thanks for the fix Tony. Reviewed-by: Dhruva Gole > > + > > serial8250_resume_port(priv->line); > > /* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */ > > pm_runtime_mark_last_busy(dev); > > @@ -1717,16 +1722,6 @@ static int omap8250_runtime_suspend(struct device *dev) > > > > if (priv->line >= 0) > > up = serial8250_get_port(priv->line); > > - /* > > - * When using 'no_console_suspend', the console UART must not be > > - * suspended. Since driver suspend is managed by runtime suspend, > > - * preventing runtime suspend (by returning error) will keep device > > - * active during suspend. > > - */ > > - if (priv->is_suspending && !console_suspend_enabled) { > > - if (up && uart_console(&up->port)) > > - return -EBUSY; > > - } > > > > if (priv->habit & UART_ERRATA_CLOCK_DISABLE) { > > int ret; > -- > Thomas Richard > -- Best regards, Dhruva Gole