From: Kevin Hilman <khilman@mvista.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Paul Walmsley <paul@pwsan.com>, linux-omap@vger.kernel.org
Subject: Re: [PATCH 5/5] ARM: OMAP: remove unnecessary locking in clk_get_rate()
Date: Wed, 04 Jun 2008 17:11:21 -0700 [thread overview]
Message-ID: <48472F29.8000109@mvista.com> (raw)
In-Reply-To: <20080604223019.GJ6992@atomide.com>
Tony Lindgren wrote:
> * Kevin Hilman <khilman@mvista.com> [080604 09:37]:
>> Paul Walmsley wrote:
>>> Hi Kevin,
>>>
>>> On Tue, 20 May 2008, Kevin Hilman wrote:
>>>
>>> > The locking in the get_rate() hook is unnecessary, and causes problems
>>> > when used with the -rt patch, since it may be called recursively.
>>> >
>>> > Signed-off-by: Kevin Hilman <khilman@mvista.com>
>>>
>>> Acked-by: Paul Walmsley <paul@pwsan.com>
>>>
>>> BTW, looks like we could probably get rid of some of the other spinlocking
>>> in plat-omap/clock.c also -- clk_get_usecount() ?
>> I agree, most of the locking in there seems unnecessary, but this was
>> the only one that could be removed without looking closer at at all the
>> platform specific clock code.
>>
>> Basically, I think there minimal (maybe no) locking in the generic
>> layer, and the locking should be done if necessary in the platform
>> specific parts.
>
> To me it seems locking is needed. What if something is changing a clock's
> rate and then something else calls get_rate() while the other thread is
> changing the rate?
Then the caller of get_rate() has an out of date value.
The same can happen even with the locking. If someone asks for the
rate, and then another thread changes the rate right after, the thread
who asked for the rate has an out-of-date value.
That being said, there may be some locks that need to stay, I haven't
done a thorough analysis of this. I just think that there is currently
to much unnecessary locking.
> If get_rate() is not locking, get_rate() may get invalid rate between
> something else programming the hardware and changing clk->rate. I guess
> just locking set_rate() would still work with local irq disabled,
> but would not be SMP safe.
>
> Anyways, ideally the spin_lock would be specific to the clocks accessing
> the same clock registers... But that would mean adding yet another field
> to struct clk or clock domains. Anybody got better ideas?
>
> And of course anything going through the clocks list needs to be protected
> by the mutex.
Agreed, the mutex needs to stay.
Kevin
next prev parent reply other threads:[~2008-06-05 0:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 22:42 [PATCH 0/5] RT: Misc. fixups for ARM/OMAP against 2.6.25.4-rt3 Kevin Hilman
2008-05-20 22:45 ` [PATCH 1/5] RT: ARM: remove non-existant trace_preempt_*_idle calls from idle loop Kevin Hilman
2008-05-20 22:45 ` [PATCH 2/5] RT: wrap BUILD_CHECK_IRQ_FLAGS Kevin Hilman
2008-05-20 22:45 ` [PATCH 3/5] RT: ARM: remove __attribute_used__ from semaphore code Kevin Hilman
2008-05-20 22:45 ` [RFC/PATCH 4/5] RT: ARM: disable duplicate cmpxchg Kevin Hilman
2008-05-20 22:45 ` [PATCH " Kevin Hilman
2008-05-20 22:45 ` [PATCH 5/5] ARM: OMAP: remove unnecessary locking in clk_get_rate() Kevin Hilman
2008-06-04 7:01 ` Paul Walmsley
2008-06-04 16:35 ` Kevin Hilman
2008-06-04 22:30 ` Tony Lindgren
2008-06-05 0:11 ` Kevin Hilman [this message]
2008-06-05 0:30 ` Igor Stoppa
2008-06-05 1:54 ` Paul Walmsley
2008-05-21 1:33 ` [PATCH 0/5] RT: Misc. fixups for ARM/OMAP against 2.6.25.4-rt3 Luís Vitório Cargnini
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=48472F29.8000109@mvista.com \
--to=khilman@mvista.com \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=tony@atomide.com \
/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