Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1105328rda; Mon, 23 Oct 2023 02:41:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhcZ4tEh+N7b3zfuKm4gWMR0L7Psd+Hlj+n6oeNaijhYU64xopEpbIACxVdKs5xMp1WLq9 X-Received: by 2002:a05:6359:1b93:b0:168:dedc:7db3 with SMTP id ur19-20020a0563591b9300b00168dedc7db3mr2132710rwb.24.1698054097017; Mon, 23 Oct 2023 02:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698054096; cv=none; d=google.com; s=arc-20160816; b=Az0Ff27qe+y5Rpj5QeEHyHeZaUb9SZcVCBDUDhMxukk7O7lkW722dXzHh4Yv42QsTP kHwRlhnBNRUolPosFXlb2KMLVRekfo509aUkyoPTCNw3BE51YvA6zKZkWJrejcejLcgP OYt7R+g1cjcCJ+4vHdGyMVrl9WBj7wdbzXzHJgXSCnxB+Dxpn8Uy97aHhhUewU6d1Pyr hnTigidDDtKRPX+TUukuuJm4f6PsQGInumhp957eEDu31p1eKgOsZA/YCUcunuevuZog XrrM4nCdvw4XCHuGaaXlUDoH3lAhGQIc3Ucmmhzq2u7vEpY8bclFi4rZF7Fg9ovrnD2J S+Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=2e6e3Lcqli+2alSmk+94dBX3KJpg6geqhFS7BprVkcU=; fh=hILHoxeFIkCqcHaUh6+K6AHAOVMnTkEN+MUzZhmRhzw=; b=ywCL20WfPf1nE68nMtdrBtGzVGoCm0M9V+LoF46rRUxL7SblS/zxYSygg+XStZz4df RHwlwvyD2Yipa1zqmyRbrcJmpAfHzgl7JrUTdR/NFkn1m9npbdgS/XQQfLE1zXdn45Dq j7TFGAbThL6yvRxHRUup4oCvkyu4s4szhzhPIHn8ztXbOsNaEdJynqdZo+0/UOmLVcmU 3PuIB5nGSAeCS42Hm6dZ5zPNUtkFiJ7wj0UYVdboI5IEoZ39qHxPLh+4FrILwg7dIOpv lXZdVn6Sjm9D/g/ZJLRIb4dyBX8dfBJc47ajMeP1xkcvPocEUM+skqN9+pFUP5al2m/K HJ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=GL7h0iFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s1-20020a63f041000000b00584b2a790absi6021336pgj.821.2023.10.23.02.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:41:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=GL7h0iFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B6AD6806E3D9; Mon, 23 Oct 2023 02:41:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjJWJlC (ORCPT + 99 others); Mon, 23 Oct 2023 05:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjJWJlA (ORCPT ); Mon, 23 Oct 2023 05:41:00 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF97DA4 for ; Mon, 23 Oct 2023 02:40:57 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-407da05f05aso22451325e9.3 for ; Mon, 23 Oct 2023 02:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1698054056; x=1698658856; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=2e6e3Lcqli+2alSmk+94dBX3KJpg6geqhFS7BprVkcU=; b=GL7h0iFse/gxCet0otgmb1uFRctB9gzKAtzvSyWHCnxPjEe8xM+DRZAyb/w4636jfY iXVZpu+M3AkHhMRlSIDGUt6KFJ7mBAviT5QfB+P4nFSJ5W8lj5KERW5jO0A4HdsCA8o0 +uLOH0qJeBktDMxxSYxa6IqT9jbLT0HTYxXow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698054056; x=1698658856; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2e6e3Lcqli+2alSmk+94dBX3KJpg6geqhFS7BprVkcU=; b=ZWe0FnmTqnh+5fE53NmQD5hQEul0ZqZ3Lj1tDGxA11T4JSfmmnbsPhE40TkVGauGJR eQn6WhxSOZ+LuefjFL2dI3yD2M8EM4xDWM1+Wba4x0Y5LMJbr2EqSlwPht1eqSSHpK6w j28dIYgJVhOXqdyIN6iIFvHMPSErWOBNbANWkeDN2S8aAAUcXD0JP4Vf3Rf+gmHvCqnk 2A0gZ87s7RfxGX7sjtHUVMa3wSPjW4Eqdh0Y0Orc46G/HHK1GOkgcBGsqu8Cz3oQlaKM cFT3CorcYjyl6KXvl8WL6dPEg+aOC3fQSByNknF1jnnpE06cWdhjtv5mMTos1MDsVD/R Qwgw== X-Gm-Message-State: AOJu0YyTa7UW0Moq/J8EuZiMDBNohEcqYU9vtgEUleaaOr/DRDJs0Uew ymd23aRKL7Q4WNSW/ErJn53M4g== X-Received: by 2002:a05:600c:3583:b0:401:eb0:a974 with SMTP id p3-20020a05600c358300b004010eb0a974mr6582584wmq.3.1698054055794; Mon, 23 Oct 2023 02:40:55 -0700 (PDT) Received: from ?IPv6:2001:8b0:aba:5f3c:3e73:a41c:6787:e5d4? ([2001:8b0:aba:5f3c:3e73:a41c:6787:e5d4]) by smtp.gmail.com with ESMTPSA id h15-20020a05600c350f00b003fe1fe56202sm9011512wmq.33.2023.10.23.02.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:40:55 -0700 (PDT) Message-ID: <5c49bc0f468e9fb5ae7ff7f53443fdb1fc3c77f2.camel@linuxfoundation.org> Subject: Re: [PATCH] serial: core: Fix runtime PM handling for pending tx From: Richard Purdie To: Tony Lindgren , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: Andy Shevchenko , Dhruva Gole , Ilpo =?ISO-8859-1?Q?J=E4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Bruce Ashfield , Mikko Rapeli , Paul Gortmaker , Randy MacLeod Date: Mon, 23 Oct 2023 10:40:54 +0100 In-Reply-To: <20231023074856.61896-1-tony@atomide.com> References: <20231023074856.61896-1-tony@atomide.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.1-0ubuntu1 MIME-Version: 1.0 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 02:41:13 -0700 (PDT) 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. >=20 > 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. >=20 > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to = enable runtime PM") > Reported-by: Richard Purdie Tested-by: Richard Purdie 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 > Cc: Mikko Rapeli > Cc: Paul Gortmaker > Cc: Randy MacLeod > Signed-off-by: Tony Lindgren > --- > drivers/tty/serial/serial_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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) > =20 > /* Increment the runtime PM usage count for the active check below */ > err =3D pm_runtime_get(&port_dev->dev); > - if (err < 0) { > + if (err < 0 && err !=3D -EINPROGRESS) { > pm_runtime_put_noidle(&port_dev->dev); > return; > }