From: skannan@codeaurora.org (Saravana Kannan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: Fix race conditions between clk_set_parent() and clk_enable()
Date: Tue, 15 May 2012 13:09:00 -0700 [thread overview]
Message-ID: <4FB2B7DC.4070706@codeaurora.org> (raw)
In-Reply-To: <20120515200040.GP30400@pengutronix.de>
On 05/15/2012 01:00 PM, Sascha Hauer wrote:
> On Tue, May 15, 2012 at 12:51:06PM -0700, Saravana Kannan wrote:
>>>> ret = clk->ops->set_parent(clk->hw, i);
>>>
>>> You call ->set_parent while holding a spinlock. This won't work with i2c
>>> clocks.
>>
>> I did account for that. I explained it in the commit text. Please
>> let me know if any part of that is not clear or is not correct.
>>
>
> I missed this part in the commit log. I have no idea whether we can live
> with this limitation though.
>
> Sascha
>
It's not really an artificial limitation of the patch. This has to be
enforced if the clock is to be managed correctly while allowing
.set_parent to NOT be atomic.
There is no way to guarantee that the enable/disable is properly
propagated to the parent clock if we can't guarantee mutual exclusion
between changing parents and calling enable/disable.
Since we can't do mutual exclusion be using spinlock (since .set_parent
is NOT atomic for these clocks), then only other way of ensuring mutual
exclusion is to force an unprepare and then mutually exclude a prepare
while changing the parent. This by association (can't enable unprepared
clock) mutually excludes the changing of parent and calling enable/disable.
Thanks,
Saravana
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next prev parent reply other threads:[~2012-05-15 20:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-12 4:59 [PATCH] clk: Fix race conditions between clk_set_parent() and clk_enable() Saravana Kannan
2012-05-15 18:20 ` Saravana Kannan
2012-05-22 13:58 ` Peter De Schrijver
2012-05-22 18:06 ` Turquette, Mike
2012-05-23 9:16 ` Peter De Schrijver
2012-05-31 3:46 ` Saravana Kannan
2012-05-15 19:42 ` Sascha Hauer
2012-05-15 19:51 ` Saravana Kannan
2012-05-15 20:00 ` Sascha Hauer
2012-05-15 20:09 ` Saravana Kannan [this message]
2012-05-16 5:59 ` Turquette, Mike
2012-05-16 9:19 ` skannan at codeaurora.org
2012-05-15 20:43 ` [PATCH] clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate() Saravana Kannan
2012-05-15 22:31 ` Richard Zhao
2012-05-16 0:25 ` Richard Zhao
2012-05-16 5:40 ` Turquette, Mike
2012-05-16 6:00 ` [PATCH] clk: Fix race conditions between clk_set_parent() and clk_enable() Turquette, Mike
2012-05-16 7:30 ` Linus Walleij
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=4FB2B7DC.4070706@codeaurora.org \
--to=skannan@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).