Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7116405rdb; Wed, 3 Jan 2024 05:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEu1A/qck9wKXtL5yjRGnWuZ0W4DIHkLg3cMf0p/EF54pWupwzEGCTf5s+lg87syetRa2++ X-Received: by 2002:a05:6808:640a:b0:3bc:1c1:c74f with SMTP id fg10-20020a056808640a00b003bc01c1c74fmr7277946oib.4.1704288012904; Wed, 03 Jan 2024 05:20:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704288012; cv=none; d=google.com; s=arc-20160816; b=c+4Uu8NDopDC4wHdDncxdi++DqaHcOUO12k88ltZqZWIPiZMusMl7t1TrVlktaG7zO tkHImD0C9WTAcCrxEWbs7Yiv1R7BDfm+XDwV/7+dbGsBCvXPIGbmAwHeMaExL53T3YH8 VtB4hGHzLDTExydAhbEcTEry48MPxoyykmbrpnZWUSYmFULzTxpd9NGAGoBYjmPQMhBJ 9a+JZxXdS/V6J/yxh9d0I8lCz/TEB6epXJfQR8gK07NAtiqlPQrf+vOttYWdZ/fodnAF 8VhiOJIjV1Htj69lQ06aglTFjiIeVu6DTBoi7BIfkkdzZh1flJpkvgMINOhNcfH9J/9y zpzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=mmByJGV5INRsF/oNx1o+f3H8EciIYscYJJv+sBSOz5c=; fh=km2W0FAEUDinshj8fSzfmd0V+JdTV9RYE9Ji5FgYux4=; b=Fk5Un82V4CNU/DuygpSW993w+3tNOMldewoG7luHd3/ZV7VW6osVzO57jjZdSw4Jxd j9J0/ZfNvRZkYM542QYoWjBbp70cszrZ6/szcepBe5pK6Gy2K9TRMJdesJ/ZGuKisRy5 WlP0o4sLm1siyEWbd9WQPnd+yWeETHODeWnrckXD/sI6nw3C6HE7twbvKyORtiQJFI4D smG/+8iew9wsdMSYnUTLiCoPABqtA/mLIUSpiYVCzYCMfrofIJPjjzkrq2KgePNbhW2K z4EuTngpBGorb+20TyMP6w+ejZuZHcarDn07PMlaz7ytp2N1/ZQ0i1m9/4u+uGRmoLYX Oasw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ifHJ2JQk; spf=pass (google.com: domain of linux-kernel+bounces-15560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d27-20020a0cb2db000000b0067f70fc7fcdsi28477428qvf.405.2024.01.03.05.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 05:20:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ifHJ2JQk; spf=pass (google.com: domain of linux-kernel+bounces-15560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3B921C235A7 for ; Wed, 3 Jan 2024 13:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3F48199A9; Wed, 3 Jan 2024 13:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ifHJ2JQk" X-Original-To: linux-kernel@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 7B5E2199A7; Wed, 3 Jan 2024 13:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704288005; bh=s7vTp6LFjuarM7eEnLjgpp6xTiC2/ovPwGE/gEID388=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ifHJ2JQk2Xx0eDuhX/RT6938DRzpEPREv4f71QxEvJQ2oGLjZMMBPnbsDGNTuVhOT zSkXooUUb5pOf7mRGvLPBw8auZLztlvWX61KC6ec5mlOWGlP7vVMn4VoaY2ZAeUeS7 bMER8BT+AgPg46qevggFAMLCKPDh6BGvKMZgiK5COtQ+apa+3E4Vld9XOTpYJVfnNK vQybCKDEiBzlsC8eq6f5nJMzVDfK8m27JmOYYBOq0ND1YjQllFWqbkpSHnURUBUMYQ qWv9t3Z4guGa1TMRbN0w77d9wue9HJEqBG+qHhVA+WFhg0WuYU3wNo/h1Bp1l2zoww B1S/xHNL+YNCQ== Received: from [100.90.194.27] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madrid.collaboradmins.com (Postfix) with ESMTPSA id B1B0037813F8; Wed, 3 Jan 2024 13:20:04 +0000 (UTC) Message-ID: <5520e8e3-c75b-480f-b831-c40b5cca029f@collabora.com> Date: Wed, 3 Jan 2024 15:20:03 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] clk: mediatek: Introduce need_pm_runtime to mtk_clk_desc Content-Language: en-US To: AngeloGioacchino Del Regno , Pin-yen Lin , Michael Turquette , Stephen Boyd , Matthias Brugger Cc: 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 References: <20240102081402.1226795-1-treapking@chromium.org> From: Eugen Hristev In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 reproduce after > some changes. > > In an effort to try to solve this issue (but again, reproducing is really hard), > Eugen has sent a commit in the hope that someone else found a way to easily > 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.78993-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.hristev@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 call >> >> 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 = pm_runtime_resume_and_get(&pdev->dev); >> + if (r) >> + return r; >> + } >> + >> /* Calculate how many clk_hw_onecell_data entries to allocate */ >> num_clks = mcd->num_clks + mcd->num_composite_clks; >> num_clks += 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); > > > >