Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp23611rdb; Thu, 5 Oct 2023 15:18:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ/AOHaX8TR70UYNPdjNNzG9S6iGHSBet2WTIe0LniBARXDoFmKJP1k/NuwAkpfg6/NYA7 X-Received: by 2002:a17:90a:bc8e:b0:26b:66f7:c9be with SMTP id x14-20020a17090abc8e00b0026b66f7c9bemr6157789pjr.10.1696544291418; Thu, 05 Oct 2023 15:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696544291; cv=none; d=google.com; s=arc-20160816; b=I/4ARRbDhB8DOvXPMsiwnzuA6jLN/80CO+WPXXjI1nqN8ovutecYGwvfF6FwFLqrU1 2NpqDNjUT4+0DvTisEq28fJ4cdunFI9i+oNQ8UhwCL3nU2UPraZWzVcWHO/gB26/BIWw 8NjC2FL4+N7NR4Cua7xsv4DE3caflgU48/djDzr2KVaUyNBDv/6Cp5GvNYGScXKtilL6 KUnxcXruJvF7U7yiN9WqoceS7mfvigTEuq2joyK2+IXdrWCLO0ucaHn9NESlmfBWnH7s MStK+TgejKxA3CFq0Qroet5d0S1V8anfzlCBN+KFlsssA7J4LeYk1v9D4TDvANEQu9dk WLFw== 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=CnCgi4qLiUMCR3TjGbpFsPLMSHS2+T4Oo/jTNlZnQ3o=; fh=K5Rx6u+GBdDwt//vASqArHuKaCrGQL62ySG+8Rdskjo=; b=gEQ63rSGuSozBT6wczaoHNbFpEnu+mgljl55OC8U8E4Tx40AXQEtVYqFl4rawiy8/p +dd7beql/iaEnpeWDNks8ej0Fyi5tNiyytLqieV9IEsh5gZQRZhoRcz+Z5MxHGafqDBW 15KDiaH96WqQqIHwg8xSAz4dx/vIMk6zj/kPWYY1tdHsg2U+wZxX+xTANSCntXJ16IN+ KK5HJim5NPEFF2K0fAjAERgLVIdAiWfB0XCQqcwSZy6RzoD0Y3Suax4cJIUl+vplI3lf YutlQZhl+B4sZiEC/5UYgcch6YCdJ7FaPZnUxNL6nAvjHC5AdlVtunEsWDJLnrBgyvu7 7oww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IiZ5F4yo; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id nv14-20020a17090b1b4e00b002680abd9398si2670262pjb.88.2023.10.05.15.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 15:18:11 -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=@gmail.com header.s=20230601 header.b=IiZ5F4yo; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9206984AB83C; Thu, 5 Oct 2023 15:18:08 -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 S231400AbjJEWR7 (ORCPT + 99 others); Thu, 5 Oct 2023 18:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbjJEWR6 (ORCPT ); Thu, 5 Oct 2023 18:17:58 -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 70FAFE8; Thu, 5 Oct 2023 15:17:56 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-406609df1a6so13967025e9.3; Thu, 05 Oct 2023 15:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696544275; x=1697149075; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=CnCgi4qLiUMCR3TjGbpFsPLMSHS2+T4Oo/jTNlZnQ3o=; b=IiZ5F4yo2z3Fh6jvxYpilk873aBPoRUtdqMEMfHpGtjCYgSbHJlKmfD7PDFGY7uWCc K38JG7IgGcCeqrqYQVuUJW0J0t6jxwV/yZqHybgJeAGlPgzJHuaOUxWhCcv97dRHTl+B Gdzr6mFcap4C/dIlPVjn/8IIC58DSb2vZDRzvXggFXcDkdhu6G8EQn0ErWE1uzp2tYGc 0RFqWQYeQPFDicm8k/IQv3jR7CpHY5u+LQ1zUjpAYedd1cQIc/lrzYrAq/K1gdMWy1XH YJbfYceABnND7zAP4odDsqfxeWLO5rMoSN7IUxYlPlk8Cq/KBdLJCltrfTptfVRA1NWk tGwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696544275; x=1697149075; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CnCgi4qLiUMCR3TjGbpFsPLMSHS2+T4Oo/jTNlZnQ3o=; b=SsxklInutjqCxUN7K1y7cnNrG8v3XJ1FS3gGbNCn9/AAvUr5+JqLwJjBCzv/1Y0PBp YZxxrdwjsYG5ZYwfpI4yvS49sA+d5N0dtZH4c8eC4Tjp/oOkyh3KSP9KlX6XHWQWmfQi Uz48UdJbzllVMhvBlxlQD4AXObPMCUSp1fcbqApiWaAKWQhn7cBgOenkKtJkGQ8LGbLp KIRD35AEXu7Ja0WcSLZs+1ru7OnQoxyV+sLcYqULXjKGwbBQHp1PaxSHL1kGRyGoaBe3 Ig2+DMzCEZLD5+5Jxd0Biq4F0v20focxaQ3RR7nLdHEOcjGbbTaeMrpFb2m8hjbf2VD6 S6VA== X-Gm-Message-State: AOJu0Yw/JZQpd57MItdrIIdzLT9Wdg6junRYRQLitN0llbHwSW9Vrvtl LqoR5gIDD72x0lA3KGFhE4Q= X-Received: by 2002:a05:600c:3657:b0:406:3f62:e583 with SMTP id y23-20020a05600c365700b004063f62e583mr5901565wmq.40.1696544274501; Thu, 05 Oct 2023 15:17:54 -0700 (PDT) Received: from ?IPV6:2a02:8071:b783:140:927c:82ba:d32d:99c1? ([2a02:8071:b783:140:927c:82ba:d32d:99c1]) by smtp.gmail.com with ESMTPSA id m7-20020a7bce07000000b003fc16ee2864sm2421978wmc.48.2023.10.05.15.17.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Oct 2023 15:17:54 -0700 (PDT) Message-ID: <83830504-770b-4781-868b-333a52044cea@gmail.com> Date: Fri, 6 Oct 2023 00:17:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] serial: core: Fix checks for tx runtime PM state Content-Language: en-US To: Tony Lindgren , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko 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 References: <20231005075644.25936-1-tony@atomide.com> From: Maximilian Luz In-Reply-To: <20231005075644.25936-1-tony@atomide.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 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]); Thu, 05 Oct 2023 15:18:08 -0700 (PDT) On 10/5/23 09:56, Tony Lindgren wrote: > Maximilian reported that surface_serial_hub serdev tx does not work during > system suspend. During system suspend, runtime PM gets disabled in > __device_suspend_late(), and tx is unable to wake-up the serial core port > device that we use to check if tx is safe to start. Johan summarized the > regression noting that serdev tx no longer always works as earlier when the > serdev device is runtime PM active. > > The serdev device and the serial core controller devices are siblings of > the serial port hardware device. The runtime PM usage count from serdev > device does not propagate to the serial core device siblings, it only > propagates to the parent. > > In addition to the tx issue for suspend, testing for the serial core port > device can cause an unnecessary delay in enabling tx while waiting for the > serial core port device to wake-up. The serial core port device wake-up is > only needed to flush pending tx when the serial port hardware device was > in runtime PM suspended state. > > To fix the regression, we need to check the runtime PM state of the parent > serial port hardware device for tx instead of the serial core port device. > > As the serial port device drivers may or may not implement runtime PM, we > need to also add a check for pm_runtime_enabled(). > > Reported-by: Maximilian Luz > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") > Signed-off-by: Tony Lindgren Thanks! Tested-by: Maximilian Luz > --- > 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 > @@ -156,7 +156,7 @@ static void __uart_start(struct uart_state *state) > * enabled, serial_port_runtime_resume() calls start_tx() again > * after enabling the device. > */ > - if (pm_runtime_active(&port_dev->dev)) > + if (!pm_runtime_enabled(port->dev) || pm_runtime_active(port->dev)) > port->ops->start_tx(port); > pm_runtime_mark_last_busy(&port_dev->dev); > pm_runtime_put_autosuspend(&port_dev->dev);