All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: "Ramirez Luna, Omar" <omar.ramirez@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	Tarun Kanti DebBarma <tarun.kanti@ti.com>,
	Kevin Hilman <khilman@ti.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Benoit Cousson <b-cousson@ti.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] ARM: OMAP: dmtimer: fix sleeping function called from invalid context
Date: Mon, 12 Dec 2011 15:08:26 -0800	[thread overview]
Message-ID: <20111212230825.GJ32251@atomide.com> (raw)
In-Reply-To: <CAB-zwWjHPzTT5QYZt9DvDcM9ny5VML3mDw3-rQRuBr-fcxYMvQ@mail.gmail.com>

* Ramirez Luna, Omar <omar.ramirez@ti.com> [111209 13:38]:
> On Fri, Dec 9, 2011 at 3:34 PM, Tony Lindgren <tony@atomide.com> wrote:
> >> +     ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> >>  EXPORT_SYMBOL_GPL(omap_dm_timer_request);
> >
> > This does not seem right.. It seems that you're hardcoding the source
> > clock to 32 KiHz clock while other sources are available too?
> 
> Agree, but... (below)
> 
> >> +     ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> > And here too?
> 
> Agree but that is the default behavior set by dm timer framework:
> 
> @@ -134,22 +134,13 @@ static void omap_dm_timer_reset(struct
> omap_dm_timer *timer)
>  int omap_dm_timer_prepare(struct omap_dm_timer *timer)
>  {
> ...
> -       ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> 
> All clocks requested are set to 32 KHz first, even with the current
> approach, there exists another API to set a new source.
> 
> To be honest I don't know why the clocks are set to 32 KHz first,
> maybe the default call path for users should be:

You need a functional clock for the timer registers to work
I believe.

> omap_dm_timer_request

Yes this would make sense. The omap_timer_list should be protected
by a mutex. There should not be a need for spinlock there as
omap_dm_timer_request should be only called during init. If that's
not the case, the the driver using it is broken.

> omap_dm_timer_set_source (new explicit call)
> omap_dm_timer_start

Once the timer has been requested, there should not be a need
for locking as there should be only one timer user using the
timer specific registers.
 
> And remove setting the source to 32 KHz by default in omap_dm_timer_request.

That you may need to be able to do anything with the timer :)

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: OMAP: dmtimer: fix sleeping function called from invalid context
Date: Mon, 12 Dec 2011 15:08:26 -0800	[thread overview]
Message-ID: <20111212230825.GJ32251@atomide.com> (raw)
In-Reply-To: <CAB-zwWjHPzTT5QYZt9DvDcM9ny5VML3mDw3-rQRuBr-fcxYMvQ@mail.gmail.com>

* Ramirez Luna, Omar <omar.ramirez@ti.com> [111209 13:38]:
> On Fri, Dec 9, 2011 at 3:34 PM, Tony Lindgren <tony@atomide.com> wrote:
> >> + ? ? ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> >> ?EXPORT_SYMBOL_GPL(omap_dm_timer_request);
> >
> > This does not seem right.. It seems that you're hardcoding the source
> > clock to 32 KiHz clock while other sources are available too?
> 
> Agree, but... (below)
> 
> >> + ? ? ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> > And here too?
> 
> Agree but that is the default behavior set by dm timer framework:
> 
> @@ -134,22 +134,13 @@ static void omap_dm_timer_reset(struct
> omap_dm_timer *timer)
>  int omap_dm_timer_prepare(struct omap_dm_timer *timer)
>  {
> ...
> -       ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
> ...
> 
> All clocks requested are set to 32 KHz first, even with the current
> approach, there exists another API to set a new source.
> 
> To be honest I don't know why the clocks are set to 32 KHz first,
> maybe the default call path for users should be:

You need a functional clock for the timer registers to work
I believe.

> omap_dm_timer_request

Yes this would make sense. The omap_timer_list should be protected
by a mutex. There should not be a need for spinlock there as
omap_dm_timer_request should be only called during init. If that's
not the case, the the driver using it is broken.

> omap_dm_timer_set_source (new explicit call)
> omap_dm_timer_start

Once the timer has been requested, there should not be a need
for locking as there should be only one timer user using the
timer specific registers.
 
> And remove setting the source to 32 KHz by default in omap_dm_timer_request.

That you may need to be able to do anything with the timer :)

Regards,

Tony

  reply	other threads:[~2011-12-12 23:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-25  4:12 [PATCH 0/2] ARM: OMAP: dmtimer: scheduling while atomic fixes Omar Ramirez Luna
2011-11-25  4:12 ` Omar Ramirez Luna
2011-11-25  4:12 ` [PATCH 1/2] ARM: OMAP: dmtimer: fix sleeping function called from invalid context Omar Ramirez Luna
2011-11-25  4:12   ` Omar Ramirez Luna
2011-12-09 21:34   ` Tony Lindgren
2011-12-09 21:34     ` Tony Lindgren
2011-12-09 22:10     ` Ramirez Luna, Omar
2011-12-09 22:10       ` Ramirez Luna, Omar
2011-12-12 23:08       ` Tony Lindgren [this message]
2011-12-12 23:08         ` Tony Lindgren
2011-12-13  1:49         ` Ramirez Luna, Omar
2011-12-13  1:49           ` Ramirez Luna, Omar
2011-11-25  4:12 ` [PATCH 2/2] ARM: OMAP: dmtimer: reorganize omap_dm_timer_request_* Omar Ramirez Luna
2011-11-25  4:12   ` Omar Ramirez Luna

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=20111212230825.GJ32251@atomide.com \
    --to=tony@atomide.com \
    --cc=b-cousson@ti.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=omar.ramirez@ti.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tarun.kanti@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.