Message ID | 20231023074856.61896-1-tony@atomide.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1135638vqx; Mon, 23 Oct 2023 00:49:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmZdPmYppYXALYmQa5TvNeda7HXZIVryyzQCJ4nIgRBzt8FlP4GaUpDqmD7d2v0YSBcgOw X-Received: by 2002:a17:902:ec87:b0:1bd:e258:a256 with SMTP id x7-20020a170902ec8700b001bde258a256mr11396874plg.32.1698047359062; Mon, 23 Oct 2023 00:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698047359; cv=none; d=google.com; s=arc-20160816; b=jhzHr6jrLFG1AGfsJePgvkbDmILa/n/VpX9l1ceABea3QxUBwH5rEm2AqmSQYrSzpv Y5z/Tr+Dpn0T2/dz5I+s8BUpQNKFz+NJC+FInCA07Y5Sq3l6495ZwzsZFOaOIvFVZW89 G8lyzLe7lYKmcTPVkU19TNCAX0J/FTxkqKIh+pcD/oGFax6r06rwJFgPK37Y7gV4yA0D hJ112dnsNVt7Hmdy2ixWARvjL6YeMSzcqIu6IgZiOQoAZR4EVtJCIkvy8c3hvD1dxjHW zYwY1my9wQZc/P0IJ0IFGmuFfUv2GQMxCjhPFysR5APzAMU8+wuU/EOaA+mBnC4xy0in Kgow== 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; bh=r+AuavFRjcbgjMQBUkmAqd7LvGO4d3X4p09yK136U3o=; fh=F0FXFConMhJt7PftR7TWZaugQI0e8RDObg6aU8mCZoU=; b=YVEshu2HGc/OMewIOE+GiNQthYgphpfbuhFeYttLkXbqal+A907EbQXJTqV0HcqfgW aDgqe5SC4mDFQWO79wakSRGElHsHWhaRdIqYx3QZFKAgFGRErFdK1Ld6sPVnInMa2aSH OdiWRC7TvO84J3mwPSvlxLSF84KyRa/C14kvl6FuwaEhAQtfT8GiEqkr6XwnbxPuUqb0 H/99AoPQkPfaBLBLlx/+1cp+nH1JzBHSfVoYLWQd39C9D+1apS8Z9ro0nmZpTInibwCE NafGSox4DYwqbUyLz0ld91YL6h5YBsRMthSilP7dszpsVwdZWfwpPAljbRxhDlI4DGoK vYvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y19-20020a170902ed5300b001c60c5726absi5955836plb.39.2023.10.23.00.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F1B84804C494; Mon, 23 Oct 2023 00:49:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233516AbjJWHtO (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Mon, 23 Oct 2023 03:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbjJWHtG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 03:49:06 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E2DED7F; Mon, 23 Oct 2023 00:49:05 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 17C5880BB; Mon, 23 Oct 2023 07:49:01 +0000 (UTC) From: Tony Lindgren <tony@atomide.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Andy Shevchenko <andriy.shevchenko@intel.com>, Dhruva Gole <d-gole@ti.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, John Ogness <john.ogness@linutronix.de>, Johan Hovold <johan@kernel.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Vignesh Raghavendra <vigneshr@ti.com>, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Richard Purdie <richard.purdie@linuxfoundation.org>, Bruce Ashfield <bruce.ashfield@gmail.com>, Mikko Rapeli <mikko.rapeli@linaro.org>, Paul Gortmaker <paul.gortmaker@windriver.com>, Randy MacLeod <randy.macleod@windriver.com> Subject: [PATCH] serial: core: Fix runtime PM handling for pending tx Date: Mon, 23 Oct 2023 10:48:54 +0300 Message-ID: <20231023074856.61896-1-tony@atomide.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 00:49:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780531707702213360 X-GMAIL-MSGID: 1780531707702213360 |
Series |
serial: core: Fix runtime PM handling for pending tx
|
|
Commit Message
Tony Lindgren
Oct. 23, 2023, 7:48 a.m. UTC
Richard reported that a serial port may end up sometimes with tx data
pending in the buffer for long periods of time.
Turns out we bail out early on any errors from pm_runtime_get(),
including -EINPROGRESS. To fix the issue, we need to ignore -EINPROGRESS
as we only care about the runtime PM usage count at this point. We check
for an active runtime PM state later on for tx.
Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
Cc: Mikko Rapeli <mikko.rapeli@linaro.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Randy MacLeod <randy.macleod@windriver.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/tty/serial/serial_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, 2023-10-23 at 10:48 +0300, Tony Lindgren wrote: > Richard reported that a serial port may end up sometimes with tx data > pending in the buffer for long periods of time. > > Turns out we bail out early on any errors from pm_runtime_get(), > including -EINPROGRESS. To fix the issue, we need to ignore -EINPROGRESS > as we only care about the runtime PM usage count at this point. We check > for an active runtime PM state later on for tx. > > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") > Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org> Tested-by: Richard Purdie <richard.purdie@linuxfoundation.org> Thanks, I can confirm that since we added this into our builds/tests we've not seen the serial data go missing. Cheers, Richard > Cc: Bruce Ashfield <bruce.ashfield@gmail.com> > Cc: Mikko Rapeli <mikko.rapeli@linaro.org> > Cc: Paul Gortmaker <paul.gortmaker@windriver.com> > Cc: Randy MacLeod <randy.macleod@windriver.com> > Signed-off-by: Tony Lindgren <tony@atomide.com> > --- > drivers/tty/serial/serial_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > --- a/drivers/tty/serial/serial_core.c > +++ b/drivers/tty/serial/serial_core.c > @@ -146,7 +146,7 @@ static void __uart_start(struct uart_state *state) > > /* Increment the runtime PM usage count for the active check below */ > err = pm_runtime_get(&port_dev->dev); > - if (err < 0) { > + if (err < 0 && err != -EINPROGRESS) { > pm_runtime_put_noidle(&port_dev->dev); > return; > }
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -146,7 +146,7 @@ static void __uart_start(struct uart_state *state) /* Increment the runtime PM usage count for the active check below */ err = pm_runtime_get(&port_dev->dev); - if (err < 0) { + if (err < 0 && err != -EINPROGRESS) { pm_runtime_put_noidle(&port_dev->dev); return; }