Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7755777rdb; Thu, 4 Jan 2024 06:51:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJhb2YX3EKg9n3uBCz5r9gYkvOKLEPzs8n/kHOIM+0JdOR1y3M8wolpt9Bn4/huD9XnIo0 X-Received: by 2002:a17:906:b783:b0:a27:5b34:d572 with SMTP id dt3-20020a170906b78300b00a275b34d572mr362477ejb.51.1704379915908; Thu, 04 Jan 2024 06:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704379915; cv=none; d=google.com; s=arc-20160816; b=j3xEIHeGQz6aQa5G5sCNGtTd5Q9BkEY2fse5HKt/1X8SGV+ZYe/gvYUMU0xx4TXa0a oO1rs8An07O+ieIqtcv/8JkDEWeGURwovnHJOnm8ys0GyINooVI0i8A8kLVQt1EixPCd T2B4zOAUn1W8rPnaVOSspoVsCHTtCe0pXPZxvsIra+DbIm/x1KELZQhO1m2CAza9nTRw 9LFS94z0zJ+mv6sJvRGvnLQ5KWYyFj8rekfGhoyL9mv1HR3v/gJ/x979uU+mePojrQ9a rI7fLqLPFGJS0re9W00i/YliYCIc0j533tW9Dq3JpSQbf0fn2KtLXx6ozrWWsS3J12S+ xT6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=or1h/yMnjb6tVAyJBd6HlW28SfRdcpAwUGvNMzv3A58=; fh=qRg784gGTFR9ShcOak5ACiDlpqXSuGbTV+ouLQD1lgM=; b=PYRGK76N2MqINf+zAc08M8rPXujHzzM8wvD1pdIAmIM7g62G4iW+SNSSwYfcm+l17F F2HENxEmQ0iN422mgrQaB3cJpdNurfPFLs3g6BjLP3pcBkJVLPK1jzX9Lu5Rmo64uOui xPPrskJY9sAIDQUtIDPV+KGN/BTgiOmUINTJtHDVduPRna9fZEph9wYKumzqv14cCfSs wRZOJYvibaMXqGxynrvWM24nOE9F3YuD27IlpwjLPN5y4MKPdWMibBsLStQeYiQ2Q1w5 tQDpfg3CUpncVXmFLjQhZVzIm6GN+O/tAnM/1y7c1QkG0XSCQ6fS6qhL58BAJ4gv6X+M uSNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BjfY4km8; spf=pass (google.com: domain of linux-kernel+bounces-16804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w17-20020a17090652d100b00a27cff4eafdsi4087361ejn.670.2024.01.04.06.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 06:51:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BjfY4km8; spf=pass (google.com: domain of linux-kernel+bounces-16804-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 607091F22B8C for ; Thu, 4 Jan 2024 14:51:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5618224CC; Thu, 4 Jan 2024 14:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BjfY4km8" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84E4623755 for ; Thu, 4 Jan 2024 14:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7bbe90357d8so26924539f.2 for ; Thu, 04 Jan 2024 06:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704379904; x=1704984704; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=or1h/yMnjb6tVAyJBd6HlW28SfRdcpAwUGvNMzv3A58=; b=BjfY4km8d2TyCCCvkH/MBBhr/62VTu+nN/Jzh4dEHBEp7XZHum2le35+8dbDHwiMB2 4VxvXDU8apZ0vkHWsEz8TZct98hFG1qKRLH3MHOW9DcJfov99jizBVBhmsoKGoPMbala ywvK6cVy+Oz1uiD0qj9PomcT2GXSmhPGXTN4g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704379904; x=1704984704; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=or1h/yMnjb6tVAyJBd6HlW28SfRdcpAwUGvNMzv3A58=; b=fio7++tbtA0mFpuBbSMjQaWtZO/Aq5oho8j0LUvcM0QzVcad+OVvgsCix4YxhS7aNt SoZD+IqoQPnIRS+BEkWmjywcx6NM9xTcaAz/BMQ2RyyqPb6kqqSFA+K3kEzopjc/Z7kS 42eW0om4v5lF8zlxpq973+Kgce7eMfqKSY6Y8XNe1zD0Uk2ISRx70bi2r6RAjt62ur+f 7X4Cp3isBnv8qsZ1pVImBVijhEsqO+u1q9FYi0ucEjSsKmALOhpp5dNLV1s0A+XYcPvM v5KS4qKSNBTaQnNACMSL/6I8KmP7yE3CoHRqafMOBget7XSQwo2Ok5E6LeL+QCp5tEPU Hitg== X-Gm-Message-State: AOJu0YzH2ppYsCvyf9LWtc2Ezsx8mP4u6kusrGCvapRfh2T++Br0yZ3p 1VtKCrpeJyx8TDqtn4vlQ+g8+D7ERTFu/CXjLgN1SlUpHwR9 X-Received: by 2002:a05:6e02:1689:b0:35d:58ce:2322 with SMTP id f9-20020a056e02168900b0035d58ce2322mr876045ila.5.1704379904640; Thu, 04 Jan 2024 06:51:44 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240102081402.1226795-1-treapking@chromium.org> <5520e8e3-c75b-480f-b831-c40b5cca029f@collabora.com> In-Reply-To: <5520e8e3-c75b-480f-b831-c40b5cca029f@collabora.com> From: Pin-yen Lin Date: Thu, 4 Jan 2024 22:51:33 +0800 Message-ID: Subject: Re: [PATCH v2 1/2] clk: mediatek: Introduce need_pm_runtime to mtk_clk_desc To: Eugen Hristev , AngeloGioacchino Del Regno Cc: Michael Turquette , Stephen Boyd , Matthias Brugger , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Weiyi Lu , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Eugen and Angelo, Unfortunately, I don't have a way to reliably reproduce this either. We notice this issue from the automatic crash reports sent from the users, but we are still not able to reproduce this locally. So our plan is to ship this patch to the users and see if the crash rate goes down after a month or so. Regards, Pin-yen On Wed, Jan 3, 2024 at 9:20=E2=80=AFPM Eugen Hristev wrote: > > On 1/3/24 14:19, AngeloGioacchino Del Regno wrote: > > Il 02/01/24 09:12, Pin-yen Lin ha scritto: > >> Introduce a new need_pm_runtime variable to mtk_clk_desc to indicate > >> this clock needs a runtime PM get on the clock controller during the > >> probing stage. > >> > >> Signed-off-by: Pin-yen Lin > > > > Hello Pin-yen, > > > > We have experienced something similar, but it was really hard to reprod= uce after > > some changes. > > > > In an effort to try to solve this issue (but again, reproducing is real= ly hard), > > Eugen has sent a commit in the hope that someone else found a way to ea= sily > > reproduce. Please look at [1]. > > > > I'm also adding Eugen to the Cc's of this email. > > > > Cheers, > > Angelo > > > > [1]: > > https://patchwork.kernel.org/project/linux-pm/patch/20231225133615.7899= 3-1-eugen.hristev@collabora.com/ > > Hello Pin-yen, > > Can you try my patch and let me know if this changes anything for you ? > > If it does not change anything, can you also try this one as well ? It's = another > attempt to fix the synchronization with genpd. > > https://lore.kernel.org/linux-arm-kernel/20231129113120.4907-1-eugen.hris= tev@collabora.com/ > > Thanks, > Eugen > > > > >> --- > >> > >> Changes in v2: > >> - Fix the order of error handling > >> - Update the commit message and add a comment before the runtime PM ca= ll > >> > >> drivers/clk/mediatek/clk-mtk.c | 15 +++++++++++++++ > >> drivers/clk/mediatek/clk-mtk.h | 2 ++ > >> 2 files changed, 17 insertions(+) > >> > >> diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk= -mtk.c > >> index 2e55368dc4d8..c31e535909c8 100644 > >> --- a/drivers/clk/mediatek/clk-mtk.c > >> +++ b/drivers/clk/mediatek/clk-mtk.c > >> @@ -13,6 +13,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #include > >> > >> #include "clk-mtk.h" > >> @@ -494,6 +495,14 @@ static int __mtk_clk_simple_probe(struct platform= _device *pdev, > >> return IS_ERR(base) ? PTR_ERR(base) : -ENOMEM; > >> } > >> > >> + > >> + if (mcd->need_runtime_pm) { > >> + devm_pm_runtime_enable(&pdev->dev); > >> + r =3D pm_runtime_resume_and_get(&pdev->dev); > >> + if (r) > >> + return r; > >> + } > >> + > >> /* Calculate how many clk_hw_onecell_data entries to allocate */ > >> num_clks =3D mcd->num_clks + mcd->num_composite_clks; > >> num_clks +=3D mcd->num_fixed_clks + mcd->num_factor_clks; > >> @@ -574,6 +583,9 @@ static int __mtk_clk_simple_probe(struct platform_= device *pdev, > >> goto unregister_clks; > >> } > >> > >> + if (mcd->need_runtime_pm) > >> + pm_runtime_put(&pdev->dev); > >> + > >> return r; > >> > >> unregister_clks: > >> @@ -604,6 +616,9 @@ static int __mtk_clk_simple_probe(struct platform_= device *pdev, > >> free_base: > >> if (mcd->shared_io && base) > >> iounmap(base); > >> + > >> + if (mcd->need_runtime_pm) > >> + pm_runtime_put(&pdev->dev); > >> return r; > >> } > >> > >> diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk= -mtk.h > >> index 22096501a60a..c17fe1c2d732 100644 > >> --- a/drivers/clk/mediatek/clk-mtk.h > >> +++ b/drivers/clk/mediatek/clk-mtk.h > >> @@ -237,6 +237,8 @@ struct mtk_clk_desc { > >> > >> int (*clk_notifier_func)(struct device *dev, struct clk *clk); > >> unsigned int mfg_clk_idx; > >> + > >> + bool need_runtime_pm; > >> }; > >> > >> int mtk_clk_pdev_probe(struct platform_device *pdev); > > > > > > > > >