Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6918328rwd; Tue, 6 Jun 2023 04:02:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Dv3gXQrQRZXfdsYwBoH0qIS7DYpCJ4Exbz/66Bz21hf1hkpH9I2oLHjb0CfbLcoRm81y3 X-Received: by 2002:a05:620a:b08:b0:75b:23a1:3646 with SMTP id t8-20020a05620a0b0800b0075b23a13646mr1417318qkg.7.1686049353831; Tue, 06 Jun 2023 04:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686049353; cv=none; d=google.com; s=arc-20160816; b=Mdl9OFGGPGuYUtvLp61yQum5QKv/dLL1FB/+UR+J3HgJ44JbCvX9zEbzRypD5RfRTP YahajPhj7og8Z++78w9HnM9wfrv7TIQD7CAmJERseLL8DIynvILjGT1V+piKbOLHIw3z itT0+0xOIm8yqHHabpkbrsh7OkGpdvgP5Ba3OZWT98yM6tNQGhIKroIdnD1BQQNIYn9R yBS2mEK5wMCj3S/ZI4k/P9VRjYU3ca0YY9pJe9w+Tp6aOQqO6GF1nO/FLSI8KgCdJrdu q8JRQsWI48cxt88PXyudFznY/lu3XSI3mbhUtig63A/Cxz4mMH1sFX4udrD2hHdQfLvA zj0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=G1QZMMsEjqdxzUJpx/ogVbjqk4e3HctuYYQivx6kTxI=; b=QWV4728PJfzX+SXf+RSamLfCUxNsu2Ru4uJjaWYJRKp3uOOilRC3awNoO7eKfvXYjH XsDwGEUQH8MqP7AHAcT7PgjhnAw4e2AVsV2ZJYrjfdTMvyjrYC6QR39RYdLNSfT5Ja2Y Eu+BGCYlZ3/DJis78Md/ZAQ1ffb9xdkRAjLZgvn/ZJeSTikpfFyb994XM+x/kvhv3l2G rhio286iqy8qbYA/0pTKLmtdmneJi3Xqy9NMI2YJ6nWTKtsplK2tnYbWxKlmBiyKlwgH 6Ns9H7MLaIAVgQDSxXTe9eyQlAda+IDI+F7Jua4brN5lLSZf74dfOn6j1Z5VGxt3I1H4 pDbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KMKqMMXZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020ae9e214000000b0074e06b1d50esi5654294qkc.253.2023.06.06.04.02.19; Tue, 06 Jun 2023 04:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KMKqMMXZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236594AbjFFKbr (ORCPT + 99 others); Tue, 6 Jun 2023 06:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236753AbjFFKbg (ORCPT ); Tue, 6 Jun 2023 06:31:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEE55E42; Tue, 6 Jun 2023 03:31:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7610861E17; Tue, 6 Jun 2023 10:31:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E981C433D2; Tue, 6 Jun 2023 10:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686047493; bh=EPV8QB8xKvak9x+4BKf5dw6FlILFq7gexapXHtjTEMw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KMKqMMXZ/uDhv0tZZbuGYuyMQ7fF4KqPOTHnJuSB+O1L+f6eECg0UsRkGLmNvzPob qENu7c8ftPu1ja3nXJM3x182p1pfIdGw6dTIfTQJfrtrCxB8w/o7yE26h2el94CfqV C+dfZg6pWx3DiSgTbQbvYwuLyfKZKc1TkgaBRBxw= Date: Tue, 6 Jun 2023 12:31:31 +0200 From: Greg Kroah-Hartman To: Ilpo =?iso-8859-1?Q?J=E4rvinen?= Cc: Chen-Yu Tsai , AngeloGioacchino Del Regno , Jiri Slaby , Matthias Brugger , John Ogness , linux-serial , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, LKML , Tony Lindgren Subject: Re: [PATCH] serial: 8250_mtk: Simplify clock sequencing and runtime PM Message-ID: <2023060608-bucket-footsore-9e43@gregkh> References: <20230606091747.2031168-1-wenst@chromium.org> <58949bbd-1506-90a0-7154-e6e57d8ddf70@collabora.com> <61ec34d0-6cc2-951e-c990-fdfd57381d7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <61ec34d0-6cc2-951e-c990-fdfd57381d7@linux.intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 06, 2023 at 01:21:55PM +0300, Ilpo Järvinen wrote: > On Tue, 6 Jun 2023, Chen-Yu Tsai wrote: > > > On Tue, Jun 6, 2023 at 5:36 PM AngeloGioacchino Del Regno > > wrote: > > > > > > Il 06/06/23 11:17, Chen-Yu Tsai ha scritto: > > > > The 8250_mtk driver's runtime PM support has some issues: > > > > > > > > - The bus clock is enabled (through runtime PM callback) later than a > > > > register write > > > > - runtime PM resume callback directly called in probe, but no > > > > pm_runtime_set_active() call is present > > > > - UART PM function calls the callbacks directly, _and_ calls runtime > > > > PM API > > > > - runtime PM callbacks try to do reference counting, adding yet another > > > > count between runtime PM and clocks > > > > > > > > This fragile setup worked in a way, but broke recently with runtime PM > > > > support added to the serial core. The system would hang when the UART > > > > console was probed and brought up. > > > > > > > > Tony provided some potential fixes [1][2], though they were still a bit > > > > complicated. The 8250_dw driver, which the 8250_mtk driver might have > > > > been based on, has a similar structure but simpler runtime PM usage. > > > > > > > > Simplify clock sequencing and runtime PM support in the 8250_mtk driver. > > > > Specifically, the clock is acquired enabled and assumed to be active, > > > > unless toggled through runtime PM suspend/resume. Reference counting is > > > > removed and left to the runtime PM core. The serial pm function now > > > > only calls the runtime PM API. > > > > > > > > [1] https://lore.kernel.org/linux-serial/20230602092701.GP14287@atomide.com/ > > > > [2] https://lore.kernel.org/linux-serial/20230605061511.GW14287@atomide.com/ > > > > > > > > Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") > > > > Suggested-by: Tony Lindgren > > > > Signed-off-by: Chen-Yu Tsai > > > > > > You're both cleaning this up and solving a critical issue and I > > > completely agree about doing that. > > > > > > I can imagine what actually fixes the driver, but still, is it > > > possible to split this commit in two? > > > One that solves the issue, one that performs the much needed cleanups. > > > > > > If it's not possible, then we can leave this commit as it is... and if the problem > > > about splitting is the Fixes tag... well, we don't forcefully need it: after all, > > > issues started arising after runtime PM support for 8250 landed and before that the > > > driver technically worked, even though it was fragile. > > > > The pure fix would look like what Tony posted [1]. However it would add stuff > > that isn't strictly needed after the cleanup. Doing it in one patch results > > in less churn. Think of it another way: it's a nice cleanup that just so > > happens to fix a regression. > > > > As for the fixes tag, it's there so other people potentially doing backports > > of the 8250 runtime PM work can spot this followup fix. > > Tony's patch is recent enough to not have progressed beyond tty-next so > fixing it shouldn't really require paying that much attention to stable > rules wrt. Fixes tag and minimality. > > As the target currently is tty-next, a cleanup which also happens to fix > the issue seems perfectly fine. The Fixes: tag is relevant here, please don't dissuade people from using them. greg k-h