Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2926397rdb; Tue, 6 Feb 2024 01:47:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEH3rHcbJDylGAyOGvkBAAE3wxw/ltMqpPD7PudGaFnSgHES4W2SJQTbWPqeNXgz+pMArCf X-Received: by 2002:a17:902:e541:b0:1d9:aa5d:a54 with SMTP id n1-20020a170902e54100b001d9aa5d0a54mr1671171plf.32.1707212861492; Tue, 06 Feb 2024 01:47:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707212861; cv=pass; d=google.com; s=arc-20160816; b=qkgEk5EbMYx2zHcIcDzsxvEkFAGJ3rxtcFNAzOZP4ZHWVQfhZQjuIgX72n1ubak3lt xwbNHtiXwrx6HlKUVuikVsmVK9bButdl298hF4Wfc/ilXiK6UvVtqlvZaSTj0B7Fteij mFse+mnS7Q5RYK/lxVVf9Hv8MygZ/fHRavFKhfMPPsRozLaf9kFkPswrLuSw+q7Uy9Cp ei8FcQl4rH5Bvq1bNmCrO/S46QYZ7UUqUmXQDzhsxSJ4sCp4qn6wi93FKx9j0ZC5RQ9S sjpsznd8corJpnEtj9Tpbv9aSPN5ST67GvPOF+H/4vge5kEXNLAsFMMk9Z6rE14W4Xcj nzPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q3gfonhNkg5w6b1TgLV6B/wtiCak4UJquF5kC82eTwo=; fh=xhZRI09C5yhEuTCLTxkCravkvO/3NNUSGHi3X7DTWfI=; b=eQb8j2gyhvjG3bkF/mQaSaTX8OCbezA30B369TzKU0efGXv+6qytfElemFHmObQv5w wPj1nTig4zN7zkSioUzaxA9l1oeHbKYv9AghsnshXMtBlb1hNw86ZKAeBhCypk3ilL1p XEdpsemqVjqV9KQG+Q64MjIKNjLJ7QvfzxL0Xy3qpb3OP3mAQWyvo9eeurLuhNt2uy4K swl9sNubRyDdTTCTeo5+wfInoUmcrPE9Ki2eFhB2MVXnLLIX+gApFx4rAndHsiRAHiSX mDMmEVoFq0gvahqvKC701F7LkWjoF0pyFgOCuJR0q1UESo2/bR8BZnT/h4qct7UfA/bO OHgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JO6Eluaq; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-54615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org X-Forwarded-Encrypted: i=1; AJvYcCU9h1SQs1P1nRJTe0V3qaQKCy4rAOkI2H2cH0WFhIqcCKz/3u0S0DlfYKd4HA5Ni3pgeLBX2B+1GFSzqQ1HTCsQNSMPQW69O8vbBmIMBg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l4-20020a170902d04400b001d95b0ffe27si1353896pll.438.2024.02.06.01.47.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:47:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JO6Eluaq; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-54615-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54615-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 108EEB23DDB for ; Tue, 6 Feb 2024 09:44:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ED8412D745; Tue, 6 Feb 2024 09:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JO6Eluaq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50F0E12D146; Tue, 6 Feb 2024 09:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707212674; cv=none; b=kYjW3RRmTCbR56TtRVKVNBDevJpTlKbUqC1HypGxlaefkttOlJTK4pJUMQD/vN5CXjIbtafnwEda1moSIZcijJMQL38VcoEGkFYPSIkdrv+kq+WmbLT51o3J5rGuDTrAWmv7JypG2vp2386VjziZhAPNseI+c6yIuRTt5XfYoSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707212674; c=relaxed/simple; bh=tg9pHfnMgYgL/Q/jdYJ/Y5q7DJviTwxBb9aNHAB6+1o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ecTbAgfXvbJ5Gf8OQzNTMZOcIHxvEWPmri18SszTdDrd4kRw1BrnuHGfkS/W8QOlOjWOZ9A2y1tbKJpskAc+1tL4jILv7xm5QBdmgrJp1b8sdl+gjZAW9jirUSnQ3l8G8+0JDDC+92C8vW1j2h1GSZO4r8XlQsOlvmzf48yu1tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JO6Eluaq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D799C433C7; Tue, 6 Feb 2024 09:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1707212673; bh=tg9pHfnMgYgL/Q/jdYJ/Y5q7DJviTwxBb9aNHAB6+1o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JO6EluaqjikBYJ17aVisH1Kw8Bz59GJOa5l880B3n3Vljz9Mc3hIDqBeHImTnC5HE cThoXmAfLV6WR9qqztBXWnZaeGOtKenm1tL19ROp28o8ziVVMJ5aEYDKJFJpe00HHE iaJzqQLoNqQg1VljCvnZAdtHl8xQcQNNaBz5z3ao= Date: Tue, 6 Feb 2024 09:44:30 +0000 From: Greg KH To: Yicong Yang Cc: jirislaby@kernel.org, tony@atomide.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, john.ogness@linutronix.de, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, yangyicong@hisilicon.com, linuxarm@huawei.com, prime.zeng@hisilicon.com, jonathan.cameron@huawei.com, fanghao11@huawei.com Subject: Re: [PATCH v2] serial: port: Don't suspend if the port is still busy Message-ID: <2024020600-attendant-verbally-6441@gregkh> References: <20240206073322.5560-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240206073322.5560-1-yangyicong@huawei.com> On Tue, Feb 06, 2024 at 03:33:22PM +0800, Yicong Yang wrote: > From: Yicong Yang > > We accidently met the issue that the bash prompt is not shown after the > previous command done and until the next input if there's only one CPU > (In our issue other CPUs are isolated by isolcpus=). Further analysis > shows it's because the port entering runtime suspend even if there's > still pending chars in the buffer and the pending chars will only be > processed in next device resuming. We are using amba-pl011 and the > problematic flow is like below: > > Bash                                         kworker > tty_write() >   file_tty_write() >     n_tty_write() >       uart_write() >         __uart_start() >           pm_runtime_get() // wakeup waker >             queue_work() >                                     pm_runtime_work() >                                                rpm_resume() >                                                 status = RPM_RESUMING >                                                 serial_port_runtime_resume() >                                                   port->ops->start_tx() >                                                     pl011_tx_chars() >                                                       uart_write_wakeup() >         […] >         __uart_start() >           pm_runtime_get() < 0 // because runtime status = RPM_RESUMING >                                // later data are not commit to the port driver >                                                 status = RPM_ACTIVE >                                                 rpm_idle() -> rpm_suspend() > > This patch tries to fix this by checking the port busy before entering > runtime suspending. A runtime_suspend callback is added for the port > driver. When entering runtime suspend the callback is invoked, if there's > still pending chars in the buffer then flush the buffer. > > Cc: Tony Lindgren > Signed-off-by: Yicong Yang Is this a regression that was caused by the port code? If so, what commit id does this fix? Should it be backported to older kernels? thanks, greg k-h