Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2940717rdb; Tue, 6 Feb 2024 02:21:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJn1MHRq61nNBqUJ1F8288BnHxJvlFXU2k4ZstSfqunzqM/IjkHdFnx3KyVsvOLLz/g0tq X-Received: by 2002:a05:6830:2707:b0:6e2:902f:b55 with SMTP id j7-20020a056830270700b006e2902f0b55mr2284025otu.7.1707214861897; Tue, 06 Feb 2024 02:21:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707214861; cv=pass; d=google.com; s=arc-20160816; b=eZ3NYATHcTBFDgpbJILSwsBpBBrm/7GLqioGBP825Z3F03Rcioq3gTzNEq5sNCmUeQ G6SjYWWJNTo2+DMUTkIE47J3kxlGQEwnqdW4F8vrffPhTOjB8K2bnVIuuebMBMvO5xns /19//StYpFmq7c0sBrjLJZFd8TG6HzIu0FtD8Fih7gqnvvbSMDaAcZe2xp1omDWjGC4q Qsb29ArmZcQnBWv+CLijAULkhbu1JZ4pUUVN/FzZaLhfo6j5Yx/1cCyuVgi9tHnOh8Dn 8ucC4m/Ag71aUF7Dj8GLbfzc9RdvuxvU51ba88svvLcWrYtGE4vuVtCKtyT7+hm+Dz05 uM+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:to:subject:cc; bh=RaFIgAqngJtYdSzlcREfp8JnJQqj2kmDpbqoBXxhZwY=; fh=Snq7MofRgCxwYXOrIUIrpGNIR//ZOgugtapZeI/lG40=; b=Pq8Mf1H9L4HFReneIZHnMh3u8t3DyUzjCTtLVZXDp4SuAw2ti8a8Bcn208LVkg9uw3 le8TfduHwCRenGs7iXsEldPwXU9FWWMBdS3+YTK27i5bTSX04u4VW2MOWz+kPwwrNCdg azLiyhQnV+tcEtry6Vi0Huayt5Ns4m3MgG7zWQfnOdlvHDUFcCqLpkcLsvXXhjT8kuk3 y2wvqVnIETR3nVDFoo4kKpIodpOWfK95LibzG+8rRJV+I2Q+hm+NmsmmTRxqOsXP2bVa t4ylb74/X9Dcr6ehv2h68aObvAYEjWUslxZggqaK44gtJ44Y4MQ8ufMjKeLvnU5KtLlh zZcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-54681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54681-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCWqXqMlU+/Fs+hQLTC2xUpy2dDOEPjWIBLbO6TfwjuaBJkbv4Nv5r383AWAJvDPt0MaoLDhoZOdqkWG3lSyLogEPN9cCQtm2BndtZvBRQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n8-20020a6543c8000000b005cd90b47495si1432994pgp.264.2024.02.06.02.21.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 02:21:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-54681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54681-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 89EF328C6FD for ; Tue, 6 Feb 2024 10:21:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E105712E1E3; Tue, 6 Feb 2024 10:20:56 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 4A61112E1CA; Tue, 6 Feb 2024 10:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707214856; cv=none; b=gZrnK+9G5EtwHBbL1SZ07b014g5tUd0s7XtHEpDpMI1NA9dHy3hysOKuMpMh9JZm4EZLmlvab+Mp/apAykQqtXdvTlMOjjji7EAZPuGdb+vKT2UxSkI9K1PB+SvBc8xgriWjpFr32O566leuLFZmZ/UOmWlJgb9jKmHXL+w3wb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707214856; c=relaxed/simple; bh=AT61w8PtLBkTuamoC6D2og3lYMvQu4th7vGPt3i0Pt8=; h=CC:Subject:To:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=B5VOWBKS7IXTe1KlM8t5UfCJYHxiyQADp41BNiRT1KbHm7QEjnJy0df58z9S8UmZvKttOxU88ufY6qK3ju3mRi/QMu6PbDthjPQDU8/6GU1ANpy9Z5CzR9oNsI6XmAsQjkZqXaazoCjliTxNLpPvr1ZP8obtyRm6Dhft79HrzOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TTfNS6FHlz1gyft; Tue, 6 Feb 2024 18:18:48 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 64F2E140390; Tue, 6 Feb 2024 18:20:44 +0800 (CST) Received: from [10.67.121.177] (10.67.121.177) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 6 Feb 2024 18:20:44 +0800 CC: , , , , , , , , , , , Subject: Re: [PATCH v2] serial: port: Don't suspend if the port is still busy To: Greg KH References: <20240206073322.5560-1-yangyicong@huawei.com> <2024020600-attendant-verbally-6441@gregkh> From: Yicong Yang Message-ID: <3512fe60-15ce-878c-8444-6dfa806921c9@huawei.com> Date: Tue, 6 Feb 2024 18:20:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <2024020600-attendant-verbally-6441@gregkh> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500009.china.huawei.com (7.192.105.203) On 2024/2/6 17:44, Greg KH wrote: > 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? > Sorry for missing it. The fix tag should be: Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") Thanks.