All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Kevin Hilman <khilman@linaro.org>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	Mike Turquette <mturquette@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH] PM / Clocks: fix pm_clk_resume/suspend if CONFIG_PM_RUNTIME is set
Date: Fri, 22 Nov 2013 14:01:20 -0500	[thread overview]
Message-ID: <528FAA00.9060801@ti.com> (raw)
In-Reply-To: <87ppps6zve.fsf@linaro.org>

On Friday 22 November 2013 01:43 PM, Kevin Hilman wrote:
> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> 
> [...]
> 
>>>> It looks like even if you just remove the locks here, the PM core is
>>>> free to call this function with irqs disabled if pm_runtime_irq_safe()
>>>> has been called on the device. Perhaps runtime PM can only do the
>>>> clk_enable()/clk_disable() part and the clk_unprepare()/clk_prepare()
>>>> calls should happen in the system suspend callbacks?
>>>
>>> Even don't know what to say :( On Keystone clk_unprepare()/clk_prepare() are NOPs.
>>> But clk_prepare() has to be called at least once before clk_enable() :((
>>> So, solution with suspend/resume will not fix current problem :( unfortunately.
>>>
>>> FYI, Now pm_clk_suspend/pm_clk_resume are called from arch/arm/mach-keystone/pm_domain.c
>>> (also similar solution is used by Davinci, but issue has not been detected because
>>> PM runtime hasn't been used by Davinci IP drivers before)
>>>
>> One way to deal with this is to have clk_unprepare()/clk_prepare()
>> called from dev_pm_domain ops before calling pm_clk_[suspend/resume]() if we
>> can't have that as part of runtime code.
> 
> That doesn't solve the irq_safe problem that Stephen pointed out without
> being very careful.  Basically, if you have _any_ potentially sleeping
> calls in this path, you can never allow devices to use
> pm_runtime_irq_safe().
> 
You are right. I realized that after reading the code.

> Also, I don't like having the clk_enable in the PM core but the
> clk_prepare in the platform-specific pm_domain.  That seems prone for
> platforms to get wrong.
> 
Agree.

> I'll need to think about this a little more before having any idea what
> to do here.
> 
Thanks Kevin for looking into it.

Regards,
Santosh


WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PM / Clocks: fix pm_clk_resume/suspend if CONFIG_PM_RUNTIME is set
Date: Fri, 22 Nov 2013 14:01:20 -0500	[thread overview]
Message-ID: <528FAA00.9060801@ti.com> (raw)
In-Reply-To: <87ppps6zve.fsf@linaro.org>

On Friday 22 November 2013 01:43 PM, Kevin Hilman wrote:
> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> 
> [...]
> 
>>>> It looks like even if you just remove the locks here, the PM core is
>>>> free to call this function with irqs disabled if pm_runtime_irq_safe()
>>>> has been called on the device. Perhaps runtime PM can only do the
>>>> clk_enable()/clk_disable() part and the clk_unprepare()/clk_prepare()
>>>> calls should happen in the system suspend callbacks?
>>>
>>> Even don't know what to say :( On Keystone clk_unprepare()/clk_prepare() are NOPs.
>>> But clk_prepare() has to be called at least once before clk_enable() :((
>>> So, solution with suspend/resume will not fix current problem :( unfortunately.
>>>
>>> FYI, Now pm_clk_suspend/pm_clk_resume are called from arch/arm/mach-keystone/pm_domain.c
>>> (also similar solution is used by Davinci, but issue has not been detected because
>>> PM runtime hasn't been used by Davinci IP drivers before)
>>>
>> One way to deal with this is to have clk_unprepare()/clk_prepare()
>> called from dev_pm_domain ops before calling pm_clk_[suspend/resume]() if we
>> can't have that as part of runtime code.
> 
> That doesn't solve the irq_safe problem that Stephen pointed out without
> being very careful.  Basically, if you have _any_ potentially sleeping
> calls in this path, you can never allow devices to use
> pm_runtime_irq_safe().
> 
You are right. I realized that after reading the code.

> Also, I don't like having the clk_enable in the PM core but the
> clk_prepare in the platform-specific pm_domain.  That seems prone for
> platforms to get wrong.
> 
Agree.

> I'll need to think about this a little more before having any idea what
> to do here.
> 
Thanks Kevin for looking into it.

Regards,
Santosh

WARNING: multiple messages have this Message-ID (diff)
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: Kevin Hilman <khilman@linaro.org>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-pm@vger.kernel.org>,
	Mike Turquette <mturquette@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH] PM / Clocks: fix pm_clk_resume/suspend if CONFIG_PM_RUNTIME is set
Date: Fri, 22 Nov 2013 14:01:20 -0500	[thread overview]
Message-ID: <528FAA00.9060801@ti.com> (raw)
In-Reply-To: <87ppps6zve.fsf@linaro.org>

On Friday 22 November 2013 01:43 PM, Kevin Hilman wrote:
> Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> 
> [...]
> 
>>>> It looks like even if you just remove the locks here, the PM core is
>>>> free to call this function with irqs disabled if pm_runtime_irq_safe()
>>>> has been called on the device. Perhaps runtime PM can only do the
>>>> clk_enable()/clk_disable() part and the clk_unprepare()/clk_prepare()
>>>> calls should happen in the system suspend callbacks?
>>>
>>> Even don't know what to say :( On Keystone clk_unprepare()/clk_prepare() are NOPs.
>>> But clk_prepare() has to be called at least once before clk_enable() :((
>>> So, solution with suspend/resume will not fix current problem :( unfortunately.
>>>
>>> FYI, Now pm_clk_suspend/pm_clk_resume are called from arch/arm/mach-keystone/pm_domain.c
>>> (also similar solution is used by Davinci, but issue has not been detected because
>>> PM runtime hasn't been used by Davinci IP drivers before)
>>>
>> One way to deal with this is to have clk_unprepare()/clk_prepare()
>> called from dev_pm_domain ops before calling pm_clk_[suspend/resume]() if we
>> can't have that as part of runtime code.
> 
> That doesn't solve the irq_safe problem that Stephen pointed out without
> being very careful.  Basically, if you have _any_ potentially sleeping
> calls in this path, you can never allow devices to use
> pm_runtime_irq_safe().
> 
You are right. I realized that after reading the code.

> Also, I don't like having the clk_enable in the PM core but the
> clk_prepare in the platform-specific pm_domain.  That seems prone for
> platforms to get wrong.
> 
Agree.

> I'll need to think about this a little more before having any idea what
> to do here.
> 
Thanks Kevin for looking into it.

Regards,
Santosh


  reply	other threads:[~2013-11-22 19:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 13:31 [PATCH] PM / Clocks: fix pm_clk_resume/suspend if CONFIG_PM_RUNTIME is set Grygorii Strashko
2013-11-20 13:31 ` Grygorii Strashko
2013-11-20 13:31 ` Grygorii Strashko
2013-11-20 18:42 ` Stephen Boyd
2013-11-20 18:42   ` Stephen Boyd
2013-11-20 19:06   ` Grygorii Strashko
2013-11-20 19:06     ` Grygorii Strashko
2013-11-20 19:06     ` Grygorii Strashko
2013-11-20 19:53     ` Stephen Boyd
2013-11-20 19:53       ` Stephen Boyd
2013-11-20 20:11       ` Grygorii Strashko
2013-11-20 20:11         ` Grygorii Strashko
2013-11-20 20:11         ` Grygorii Strashko
2013-11-20 20:32         ` Santosh Shilimkar
2013-11-20 20:32           ` Santosh Shilimkar
2013-11-20 20:32           ` Santosh Shilimkar
2013-11-22 18:43           ` Kevin Hilman
2013-11-22 18:43             ` Kevin Hilman
2013-11-22 18:43             ` Kevin Hilman
2013-11-22 19:01             ` Santosh Shilimkar [this message]
2013-11-22 19:01               ` Santosh Shilimkar
2013-11-22 19:01               ` Santosh Shilimkar
2013-11-25 10:05               ` Grygorii Strashko
2013-11-25 10:05                 ` Grygorii Strashko
2013-11-25 10:05                 ` Grygorii Strashko

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=528FAA00.9060801@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=pavel@ucw.cz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.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 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.