public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-pm@vger.kernel.org, Adam Ford <aford173@gmail.com>,
	Fabio Estevam <festevam@denx.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jacky Bai <ping.bai@nxp.com>, Kevin Hilman <khilman@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Len Brown <len.brown@intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Mark Brown <broonie@kernel.org>,
	Martin Kepplinger <martink@posteo.de>,
	Pavel Machek <pavel@ucw.cz>, Peng Fan <peng.fan@nxp.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	Shengjiu Wang <shengjiu.wang@nxp.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH 1/3] [RFC] PM: domains: Introduce .power_pre/post_on/off callbacks
Date: Mon, 14 Nov 2022 21:32:12 +0100	[thread overview]
Message-ID: <52578b45-cf4c-e949-b2b1-a0f251815337@denx.de> (raw)
In-Reply-To: <CAPDyKFoUdfUjZMgzU-3SS0gVstj-04FbTSjxihdar2wxu5c97w@mail.gmail.com>

On 11/14/22 20:40, Ulf Hansson wrote:
> On Tue, 8 Nov 2022 at 02:35, Marek Vasut <marex@denx.de> wrote:
>>
>> Currently it is possible that a power domain power on or off would claim
>> the genpd lock first and clock core prepare_lock second, while another
>> thread could do the reverse, and this would trigger lockdep warning.
> 
> I am not quite sure I fully understand. In this case is the lockdep
> warning relevant or just something that we want to silence?

This is a valid problem, see patches 2/3 and 3/3 for details too.

>> Introduce new callbacks, .power_pre/post_on() and .power_off_pre/post(), which
>> are triggered before the genpd_lock() and after genpd_unlock() respectively in
>> case the domain is powered on and off. Those are meant to let drivers claim
>> clock core prepare_lock via clk_*prepare() call and release the lock via
>> clk_*unprepare() call to always assure that the clock and genpd lock ordering
>> is correct.
> 
> To me, this sounds like a problem that may be better fixed by trying
> to model the parent/child-domains in a more strict way, through genpd.
> 
> There is a comment in the code in imx8mp_blk_ctrl_probe() that seems
> to be pointing in this direction too.
> 
> "* We use runtime PM to trigger power on/off of the upstream GPC
>    * domain, as a strict hierarchical parent/child power domain
>    * setup doesn't allow us to meet the sequencing requirements......"
> 
> I am wondering about what those "sequencing requirements" are - and
> whether it could make better sense to fix these issues instead?

Here is the lockdep splat:

https://lore.kernel.org/all/Y1cs++TV2GCuh4tS@pendragon.ideasonboard.com/

It really is a problem between the clock and genpd subsystem locks, they 
can be claimed in arbitrary order, see patch 2/3 and 3/3.

I think that might clarify what I am attempting to solve here.

[...]

  reply	other threads:[~2022-11-14 20:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  1:35 [PATCH 1/3] [RFC] PM: domains: Introduce .power_pre/post_on/off callbacks Marek Vasut
2022-11-08  1:35 ` [PATCH 2/3] [RFC] soc: imx: gpcv2: Split clock prepare from clock enable in the domain Marek Vasut
2022-11-11  8:27   ` Peng Fan
2022-11-08  1:35 ` [PATCH 3/3] [RFC] soc: imx: imx8m-blk-ctrl: " Marek Vasut
2022-11-09 13:19 ` [PATCH 1/3] [RFC] PM: domains: Introduce .power_pre/post_on/off callbacks Laurent Pinchart
2022-11-09 13:25   ` Marek Vasut
2022-11-14 19:40 ` Ulf Hansson
2022-11-14 20:32   ` Marek Vasut [this message]
2022-11-16 12:41     ` Ulf Hansson
2022-11-16 13:25       ` Lucas Stach
2022-11-16 16:30         ` Ulf Hansson
2023-01-04  8:37           ` Peng Fan
2023-01-18 12:55             ` Ulf Hansson
2023-01-18 13:07               ` Marek Vasut
2023-02-16  1:47               ` Peng Fan
2023-02-16 10:48                 ` Ulf Hansson
2023-03-01  0:52                   ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52578b45-cf4c-e949-b2b1-a0f251815337@denx.de \
    --to=marex@denx.de \
    --cc=aford173@gmail.com \
    --cc=broonie@kernel.org \
    --cc=festevam@denx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=khilman@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=len.brown@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=p.zabel@pengutronix.de \
    --cc=pavel@ucw.cz \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=rafael@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@nxp.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox