Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1752607rdh; Tue, 26 Sep 2023 02:25:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGV3iHTINcViM14zuUS7LLk6fPT7EpkWNnLhSZhtNmwVzb/87wjeXSyzdz3XnzrJVgiUmkg X-Received: by 2002:a05:6a21:819d:b0:11d:4c79:90ee with SMTP id pd29-20020a056a21819d00b0011d4c7990eemr8597593pzb.25.1695720328947; Tue, 26 Sep 2023 02:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695720328; cv=none; d=google.com; s=arc-20160816; b=m4ksCAAB2f/SNa0jQ6ZfW8eyi2Os7NTunvLyw+z4mt7vrYaP0xKlt5IJlD5JuOxNlG RjG2Sfiir3UPBRPIDEKr5d5/mcfI2huQhvhd9GumBgJYHUA0s6ZgU1gH4AGuTJuwmWYr PtfrwEV5Uxk0JzVvgOUDzg8JvEMsjajAzegeh5oqmbZoW6zKPX/GCNhPzceAzYeNPiPx vMc8CzEjqy0NZmrMsTeMnsEkFeBBDpqqErc+5JNX1LHQ77ocDxo7qiqQPqOJjl9LBJlh VXHiCyqtjASw2UfN7pLu992GEX7wPGSGyWyUODsYOPO2tLlzKXCQLZFZ9kLTww8VVDni y2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7a5K1aAKuIj2iEvxprQZUE+LucC50eyHmU2MT85uylA=; fh=oBpmBmrGBcP+GzA5et9SiorVx0EEwmdUMLat2Ce8mmQ=; b=jRgqdhJWrvIUNHfHAj/sIlTJER4j5D8W0YcwRfRjhqFubRsBNAquKMAE2fr0i+eHZ2 cIVT/xt0JpSNPKIpqmStMvpeJfVtpAIjUGj751Z3L8t9oIGjngFeJ5ZJsUaUwl61QKQl 1ZqBL6/sroXSDGsuMR48nx6xXIcurwaTh0DwLoLCv3ST/DnrNSoviPY+OBd0kzH40q9F kV89mg1JWfWL7DUEFWbqSEe0saY+yf9TM151avrTUBOUJlAkXm02ZC1mF/SRM/vSgB1J dpWgq7ctfrjGmmhj92mvzZpSNHP/+eMDRp7Bl6yNdVqTEOmutk8jE1C07BIxjAJQemVv 51rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CLGB9apB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id q22-20020a056a00151600b0068fbac77dd0si12768071pfu.226.2023.09.26.02.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:25:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CLGB9apB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 06D5180765C8; Tue, 26 Sep 2023 00:51:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233819AbjIZHvo (ORCPT + 99 others); Tue, 26 Sep 2023 03:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233816AbjIZHvm (ORCPT ); Tue, 26 Sep 2023 03:51:42 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E21C0DC; Tue, 26 Sep 2023 00:51:34 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2842A240008; Tue, 26 Sep 2023 07:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1695714693; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7a5K1aAKuIj2iEvxprQZUE+LucC50eyHmU2MT85uylA=; b=CLGB9apBwexIdVNECBBS9V0PnB4y8ocCvgQ4qFRIbu8UcFc7sir6TV0M3ws76qKGl/siSa psuC7TAJwEoNrX55Q5evdslyP+wSjOssom4UVXPNEbANZQotVuc33ajteUO925Yfx9VIVk LML9KPYSLVrKntr/wk5Vd0GHBbRMgz1RNiBb6ISY48qpuiNHLYRQf4W++QB/JsiT9r4w/8 9HNz95+c1GMD7CnFgYYsekmY/YKRbOSUqjrrOf5jcxY0vwSqvBn3rL3ofJBslsM4UZ8dYe hP2B62LTdH+WfPXlXUDJ7xEB4BO/0NxdOBJucRQxpWkaTdNvehw022yAq0f5MQ== Message-ID: <652eb018-8e67-5f4b-8329-0f52159a27b1@bootlin.com> Date: Tue, 26 Sep 2023 09:51:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] serial: 8250_omap: Fix errors with no_console_suspend Content-Language: en-US To: Tony Lindgren , Greg Kroah-Hartman , Jiri Slaby Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Udit Kumar References: <20230926061319.15140-1-tony@atomide.com> From: Thomas Richard In-Reply-To: <20230926061319.15140-1-tony@atomide.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: thomas.richard@bootlin.com X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 26 Sep 2023 00:51:54 -0700 (PDT) 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 > Signed-off-by: Tony Lindgren Tested-by: Thomas Richard > --- > 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; > + } > + > 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