From: Jerome Brunet <jbrunet@baylibre.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Russell King" <linux@armlinux.org.uk>,
linux-clk@vger.kernel.org,
"MyungJoo Ham" <myungjoo.ham@samsung.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"Chanwoo Choi" <cw00.choi@samsung.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
dri-devel@lists.freedesktop.org,
linux-amlogic@lists.infradead.org,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Rob Herring" <robh@kernel.org>,
linux-tegra@vger.kernel.org,
"Johan Hovold" <johan+linaro@kernel.org>,
"Georgi Djakov" <djakov@kernel.org>,
kernel@pengutronix.de
Subject: Re: [PATCH 0/5] clk: Make clk_rate_exclusive_get() return void
Date: Fri, 15 Dec 2023 09:41:59 +0100 [thread overview]
Message-ID: <1jedfnq1sx.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <ki5n3rz5n4oxj2hhc3rj6xpn3e2tdi7fcp2q7exjbzilrlqflp@przautvhuy4g>
On Wed 13 Dec 2023 at 08:16, Maxime Ripard <mripard@kernel.org> wrote:
> [[PGP Signed Part:Undecided]]
> Hi,
>
> On Tue, Dec 12, 2023 at 06:26:37PM +0100, Uwe Kleine-König wrote:
>> Hello,
>>
>> clk_rate_exclusive_get() returns zero unconditionally. Most users "know"
>> that and don't check the return value. This series fixes the four users
>> that do error checking on the returned value and then makes function
>> return void.
>>
>> Given that the changes to the drivers are simple and so merge conflicts
>> (if any) should be easy to handle, I suggest to merge this complete
>> series via the clk tree.
>
> I don't think it's the right way to go about it.
>
> clk_rate_exclusive_get() should be expected to fail.
Yes, at some point it might. That is why the API returns an error code.
What CCF (or any other framework) should be no concern to the consummer.
Driver not checking the return are taking there chances, and that is up
to them. It is like regmap. Most calls can return an error code but the
vast majority of driver happily ignore that.
> For example if
> there's another user getting an exclusive rate on the same clock.
>
> If we're not checking for it right now, then it should probably be
> fixed, but the callers checking for the error are right to do so if they
> rely on an exclusive rate. It's the ones that don't that should be
> modified.
>
I'm not sure that would be right. For sure, restricting a to single user
was not my intent when I wrote the thing.
The intent was for a consumer to state that it cannot tolerate a rate
change of the clock it is using. It is fine for several consumers to
state that for a single clock, as long as they 'agree' on the rate. Two
instances of the same device could be a good example of that.
Those consumers should use 'clk_set_rate_exclusive()' to set the rate
and protect it atomically. Calling 'clk_exclusive_get()' then
'clk_set_rate()' is racy as both instance could effectively lock the
rate without actually getting the rate they want :/
Admittingly, the API naming is terrible when it comes to this ...
> Maxime
>
> [[End of PGP Signed Part]]
--
Jerome
prev parent reply other threads:[~2023-12-15 8:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 17:26 [PATCH 0/5] clk: Make clk_rate_exclusive_get() return void Uwe Kleine-König
2023-12-12 17:26 ` [PATCH 1/5] PM / devfreq: sun8i-a33-mbus: Simplify usage of clk_rate_exclusive_get() Uwe Kleine-König
2023-12-12 18:16 ` Andre Przywara
2023-12-12 17:26 ` [PATCH 5/5] clk: Make clk_rate_exclusive_get() return void Uwe Kleine-König
2023-12-13 7:16 ` [PATCH 0/5] " Maxime Ripard
2023-12-13 7:43 ` Uwe Kleine-König
2023-12-13 8:36 ` Maxime Ripard
2023-12-13 11:08 ` Uwe Kleine-König
2023-12-13 11:54 ` Maxime Ripard
2023-12-13 15:52 ` Uwe Kleine-König
2023-12-15 12:34 ` Maxime Ripard
2023-12-15 15:15 ` Uwe Kleine-König
2023-12-15 18:49 ` Uwe Kleine-König
2023-12-13 16:44 ` Neil Armstrong
2023-12-15 9:11 ` Maxime Ripard
2023-12-15 9:46 ` Jerome Brunet
2023-12-15 8:41 ` Jerome Brunet [this message]
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=1jedfnq1sx.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=airlied@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=daniel@ffwll.ch \
--cc=djakov@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=johan+linaro@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=myungjoo.ham@samsung.com \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tzimmermann@suse.de \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wens@csie.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