public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Cc: "Basak, Partha" <p-basak2@ti.com>, Paul Walmsley <paul@pwsan.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"Kalliguddi, Hema" <hemahk@ti.com>,
	"Raja, Govindraj" <govindraj.raja@ti.com>,
	"Varadarajan, Charulatha" <charu@ti.com>
Subject: Re: Issues with calling pm_runtime functions in platform_pm_suspend_noirq/IRQ disabled context.
Date: Mon, 09 Aug 2010 08:55:04 -0700	[thread overview]
Message-ID: <87tyn3lr1j.fsf@deeprootsystems.com> (raw)
In-Reply-To: <EAF47CD23C76F840A9E7FCE10091EFAB02C6553186@dbde02.ent.ti.com> (Santosh Shilimkar's message of "Mon, 9 Aug 2010 21:09:55 +0530")

"Shilimkar, Santosh" <santosh.shilimkar@ti.com> writes:

>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>> owner@vger.kernel.org] On Behalf Of Kevin Hilman
>> Sent: Monday, August 09, 2010 9:01 PM
>> To: Basak, Partha
>> Cc: Paul Walmsley; linux-omap@vger.kernel.org; Kalliguddi, Hema; Raja,
>> Govindraj; Varadarajan, Charulatha
>> Subject: Re: Issues with calling pm_runtime functions in
>> platform_pm_suspend_noirq/IRQ disabled context.
>> 
>> "Basak, Partha" <p-basak2@ti.com> writes:
>> 
>> >> Finally, we have omap_sram_idle():
>> >>
>> >> > In particular, for USB, while executing SRAM_Idle, is we use
>> pm_runtime
>> >> > functions, we see spurious IO-Pad interrupts.
>> >>
>> >> Your message doesn't specify what PM runtime functions you are
>> executing.
>> >> But if those functions are calling mutex_lock(), then they obviously
>> must
>> >> not be called from omap_sram_idle() in interrupt context.
>> >>
>> >> It's not clear from your message why you need to call PM runtime
>> functions
>> >> from the idle loop.  I'd suggest that you post the problematic code in
>> >> question to the list.
>> >>
>> >
>> > USB issue:
>> >
>> > Please refer to the USB patch attached (will be sent to the list as well
>> in a few minutes)
>> > As I mentioned previously, few drivers like GPIO, USB & UART have clock-
>> disable/enable + context save/restore in Idle path(omap_sram_idle()).
>> >
>> > In particular, I am referring to calling of the functions
>> pm_runtime_put_sync() & pm_runtime_get_sync() for USB around wfi.
>> >
>> > Now, the following call sequence from omap_sram_idle()will enable IRQs:
>> > pm_runtime_put_sync-->
>> > 	__pm_runtime_put-->
>> > 		pm_runtime_idle-->
>> > 			spin_unlock_irq(),
>> > 			__pm_runtime_idle(),-->
>> > 			 spin_unlock_irq,
>> > 				spin_unlock_irq
>> >
>> > The functions pm_runtime_idle() & __ pm_runtime_idle() do not use
>> > spin_lock_irqsave & spin_unlock_irqrestore. This leads to enabling of
>> > the interrupts in omap_sram_idle unconditionally, which for USB in
>> > particular is leading to IO-pad interrupt being triggered which does
>> > not come otherwise.
>> 
>> You seem to have correctly identified the problem.  Can you try the
>> patch below (untested) which attempts to address the root cause you've
>> identified?
>> 
>> Kevin
>> 
>> > To work around this problem, instead of using Runtime APIs, we are using
>> omap_device_enable/disable, which in-turn call to __omap_hwmod_enable/idle
>> >
>> > Simply put, I am not talking about grabbing a mutex when interrupts are
>> disabled, rather of a scenario where interrupts are getting enabled as a
>> side-effect of calling these functions in   omap_sram_idle().
>> 
>> From be3aeea5f8d29c8ce2fa278f48aef849eb682282 Mon Sep 17 00:00:00 2001
>> From: Kevin Hilman <khilman@deeprootsystems.com>
>> Date: Mon, 9 Aug 2010 08:12:39 -0700
>> Subject: [PATCH] PM: allow runtime PM get/put from interrupts-disabled
>> context
>> 
>> When using runtime PM in combination with CPUidle, the runtime PM
>> transtions of some devices may be triggered during the idle path.
>> Late in the idle sequence, interrupts may already be disabled when
>> runtime PM for these devices is initiated (using the _sync versions of
>> the runtime PM API.)
>> 
>> Currently, the runtime PM core assumes methods are called with
>> interrupts enabled.  However, if it is called with interrupts
>> disabled, the internal locking unconditionally enables interrupts, for
>> example:
>> 
>> pm_runtime_put_sync()
>>     __pm_runtime_put()
>>         pm_runtime_idle()
>>             spin_lock_irq()
>>             __pm_runtime_idle()
>>                 spin_unlock_irq()   <--- interrupts unconditionally
>> enabled
>>                 dev->bus->pm->runtime_idle()
>>                 spin_lock_irq()
>>              spin_unlock_irq()
>> 
>> To fix, use the save/restore versions of the spinlock API.
>>
> Similar thing was thought when this problem was encountered but 
> there was a concern that it may lead to interrupts are being disable
> for longer times

why?

if interrupts are enabled when this API is used, this patch doesn't
change the amount of time interrupts are disabled.

if interrupts are already disabled, then you *want* interrupts to be
disabled for the entire time.

what exactly is the concern?

Kevin

> Are all run time PM APIs are short enough to keep interrupts
> disabled without impacting interrupt latency?
>  

  reply	other threads:[~2010-08-09 15:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B85A65D85D7EB246BE421B3FB0FBB59301E7ED0FDF@dbde02.ent.ti.com>
     [not found] ` <alpine.DEB.2.00.1008061305360.5732@utopia.booyaka.com>
     [not found]   ` <B85A65D85D7EB246BE421B3FB0FBB59301E800BD63@dbde02.ent.ti.com>
2010-08-09  7:50     ` Issues with calling pm_runtime functions in platform_pm_suspend_noirq/IRQ disabled context Paul Walmsley
2010-08-09 10:31       ` Basak, Partha
2010-08-09 15:31         ` Kevin Hilman
2010-08-09 15:39           ` Shilimkar, Santosh
2010-08-09 15:55             ` Kevin Hilman [this message]
2010-08-09 16:13               ` Shilimkar, Santosh
2010-08-09 16:25                 ` Shilimkar, Santosh
2010-08-10 14:59           ` Basak, Partha
2010-08-03 13:49 Basak, Partha
2010-08-03 17:35 ` Kevin Hilman
2010-08-04 13:19   ` Basak, Partha
2010-08-04 21:47     ` Kevin Hilman
2010-08-04 22:32       ` Kevin Hilman
2010-08-04 23:20         ` Kevin Hilman
2010-08-06 14:22           ` Basak, Partha
2010-08-06 14:37       ` Basak, Partha
2010-08-04 23:35     ` Kevin Hilman
2010-08-06 14:21       ` Basak, Partha

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=87tyn3lr1j.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=charu@ti.com \
    --cc=govindraj.raja@ti.com \
    --cc=hemahk@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=p-basak2@ti.com \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox