All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Partha Basak <p-basak2@ti.com>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH ver. 2] PM: add synchronous runtime interface for interrupt	handlers
Date: Mon, 11 Apr 2011 19:20:47 +0200	[thread overview]
Message-ID: <4DA3386F.8090609@samsung.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1104111202470.1975-100000@iolanthe.rowland.org>

On 04/11/2011 06:08 PM, Alan Stern wrote:
> On Mon, 11 Apr 2011, Sylwester Nawrocki wrote:
> 
>>> +  void pm_runtime_irq_safe(struct device *dev);
>>> +    - set the power.irq_safe flag for the device, causing the runtime-PM
>>> +      callbacks to be invoked with interrupts disabled
>>> +
>>>    void pm_runtime_mark_last_busy(struct device *dev);
>>>      - set the power.last_busy field to the current time
>>>  
>>> @@ -438,6 +454,16 @@ pm_runtime_suspended()
>>>  pm_runtime_mark_last_busy()
>>>  pm_runtime_autosuspend_expiration()
>>>  
>>> +If pm_runtime_irq_safe() has been called for a device then the following helper
>>> +functions may also be called in interrupt context:
>>
>> I was wondering what is the proper usage of this API. From a point of view of
>> a driver, does it mean that in runtime_resume/runtime_suspend helpers any
>> blocking calls cannot be used, so the device driver is prepared for situations
>> when some other subsystem invokes pm_runtime_irq_safe() on its device?
> 
> I should have mentioned this in the documentation.  Yes, if 
> pm_runtime_irq_safe() has been called for a device then that device's 
> runtime_resume and runtime_suspend helpers must be able to run in 
> interrupt context.  Hence they must not make any blocking calls.
> 
> However, this doesn't mean _all_ runtime_resume/runtime_suspend methods 
> have to be IRQ-safe.  Only those for which pm_runtime_irq_safe() has 
> been called.

Thank you for the clarification.

OK, my main concerns was, who decides whether the specific runtime PM
helpers are IRQ-safe or not. But indeed, it now makes a little sense
to me to impose such a requirement on all runtime_suspend/resume helpers.

> 
> A driver shouldn't worry about some other subsystem calling
> pm_runtime_irq_safe() for one of its devices.  If that ever happened,
> it would be a gross violation of proper layering.

Ok, that's good news.

> 
>> Or is pm_runtime_irq_safe() intended to be called only by the device driver
>> in such case?
> 
> Yes, that's right.
> 
>> I'd like to use blocking calls for a voltage regulator control within
>> the runtime PM helpers in the driver but I'm not sure whether this wouldn't
>> violate the API.
> 
> You should be okay.  Just bear in mind that it means the voltage 
> regulator's parent won't be able to runtime suspend.  If the regulator 
> is a platform device with no meaningful parent then of course this 
> won't matter.

The regulator driver is a PMIC that uses I2C communication to control
the voltage regulators. So to be able to control the regulator supplying
the device, the runtime_resume/suspend callbacks need to be called with 
interrupts enabled. Otherwise the I2C communication wouldn't work.

I don't really need runtime_suspend/resume to be IRQ-safe, just wanted 
to make sure that in some conditions some other subsystem does not request that.

As I have seen there is no runtime PM call to clear the power.irq_safe
flags once it is set, so it looked like pm_runtime_irq_safe() is a basically 
a "one-time" call.


Regards,
-- 
Sylwester Nawrocki
Samsung Poland R&D Center

  reply	other threads:[~2011-04-11 17:20 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24  0:05 runtime_pm_get_sync() from ISR with IRQs disabled? Kevin Hilman
2010-09-24 15:13 ` Alan Stern
2010-09-24 15:13 ` [linux-pm] " Alan Stern
2010-09-24 18:54   ` Kevin Hilman
2010-09-24 20:04     ` Rafael J. Wysocki
2010-09-24 20:04     ` [linux-pm] " Rafael J. Wysocki
2010-09-27 13:57       ` Alan Stern
2010-09-27 13:57       ` [linux-pm] " Alan Stern
2010-09-27 20:00         ` Rafael J. Wysocki
2010-09-27 20:39           ` Alan Stern
2010-09-27 21:09             ` Rafael J. Wysocki
2010-09-27 21:09             ` [linux-pm] " Rafael J. Wysocki
2010-09-28 14:55               ` Alan Stern
2010-09-28 14:55               ` [linux-pm] " Alan Stern
2010-09-28 18:19                 ` Rafael J. Wysocki
2010-09-28 18:19                 ` [linux-pm] " Rafael J. Wysocki
2010-09-30 18:25                   ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Alan Stern
2010-09-30 18:25                   ` Alan Stern
2010-09-30 20:15                     ` Rafael J. Wysocki
2010-09-30 20:15                     ` Rafael J. Wysocki
2010-09-30 21:42                       ` Alan Stern
2010-09-30 22:41                         ` Rafael J. Wysocki
2010-10-01 14:28                           ` Alan Stern
2010-10-01 14:28                           ` Alan Stern
2010-10-01 21:23                             ` Rafael J. Wysocki
2010-10-02 14:12                               ` Alan Stern
2010-10-02 14:12                               ` Alan Stern
2010-10-02 22:06                                 ` Rafael J. Wysocki
2010-10-02 22:06                                 ` Rafael J. Wysocki
2010-10-03 15:52                                   ` Alan Stern
2010-10-03 20:33                                     ` Rafael J. Wysocki
2010-10-03 20:33                                     ` Rafael J. Wysocki
2010-10-03 15:52                                   ` Alan Stern
2010-10-08 23:24                                   ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: Re: [PATCH] PM: add synchronous ...) Rafael J. Wysocki
2010-10-08 23:24                                   ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: Re: [linux-pm] " Rafael J. Wysocki
2010-10-10 20:18                                     ` Alan Stern
2010-10-10 20:18                                     ` PATCH: PM / Runtime: Remove idle notification after failing suspend (was: " Alan Stern
2010-10-05 21:44                                 ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Kevin Hilman
2010-10-05 21:44                                 ` Kevin Hilman
2010-10-06 15:58                                   ` Alan Stern
2010-10-06 19:33                                     ` Rafael J. Wysocki
2010-10-06 19:33                                     ` Rafael J. Wysocki
2010-10-06 19:35                                     ` Kevin Hilman
2010-10-06 20:28                                       ` Alan Stern
2010-10-06 20:28                                       ` Alan Stern
2010-10-06 21:47                                         ` Rafael J. Wysocki
2010-10-06 21:47                                         ` Rafael J. Wysocki
2010-10-07 15:26                                           ` Alan Stern
2010-10-07 16:52                                             ` Kevin Hilman
2010-10-07 17:35                                               ` Alan Stern
2010-10-07 21:11                                                 ` Rafael J. Wysocki
2010-10-07 23:15                                                   ` Kevin Hilman
2010-10-07 23:15                                                   ` Kevin Hilman
2010-10-07 23:37                                                     ` Rafael J. Wysocki
2010-10-07 23:37                                                     ` Rafael J. Wysocki
2010-10-07 23:55                                                       ` Kevin Hilman
2010-10-07 23:55                                                       ` Kevin Hilman
2010-10-08 16:22                                                         ` Alan Stern
2010-10-08 21:04                                                           ` Kevin Hilman
2010-10-08 21:04                                                           ` Kevin Hilman
2010-10-08 16:22                                                         ` Alan Stern
2010-10-08 19:57                                                         ` Rafael J. Wysocki
2010-10-08 19:57                                                         ` Rafael J. Wysocki
2010-10-08 16:18                                                   ` Alan Stern
2010-10-08 19:53                                                     ` Rafael J. Wysocki
2010-10-09 11:09                                                       ` [linux-pm] " Rafael J. Wysocki
2010-10-11 17:00                                                         ` Alan Stern
2010-10-11 17:00                                                         ` [linux-pm] " Alan Stern
2010-10-11 22:30                                                           ` Rafael J. Wysocki
2010-10-11 22:30                                                           ` Rafael J. Wysocki
2010-10-09 11:09                                                       ` Rafael J. Wysocki
2010-10-08 19:53                                                     ` Rafael J. Wysocki
2010-10-08 16:18                                                   ` Alan Stern
2010-10-07 21:11                                                 ` Rafael J. Wysocki
2010-10-07 17:35                                               ` Alan Stern
2010-10-07 16:52                                             ` Kevin Hilman
2010-10-07 15:26                                           ` Alan Stern
2010-11-19 15:45                                           ` [PATCH ver. 2] " Alan Stern
2011-04-11 15:47                                             ` Sylwester Nawrocki
2011-04-11 16:08                                               ` Alan Stern
2011-04-11 17:20                                                 ` Sylwester Nawrocki [this message]
2011-04-11 18:37                                                   ` Alan Stern
2010-11-19 15:45                                           ` Alan Stern
2010-11-20 12:56                                             ` Rafael J. Wysocki
2010-11-20 16:59                                               ` Alan Stern
2010-11-20 16:59                                               ` Alan Stern
2010-11-20 19:41                                                 ` Alan Stern
2010-11-20 19:41                                                 ` [linux-pm] " Alan Stern
2010-11-21 23:45                                                   ` Rafael J. Wysocki
2010-11-21 23:45                                                   ` Rafael J. Wysocki
2010-11-21 23:41                                                 ` Rafael J. Wysocki
2010-11-22 15:38                                                   ` Alan Stern
2010-11-22 23:01                                                     ` Rafael J. Wysocki
2010-11-22 23:01                                                     ` Rafael J. Wysocki
2010-11-23  3:19                                                       ` Alan Stern
2010-11-23 22:51                                                         ` Rafael J. Wysocki
2010-11-23 22:51                                                         ` Rafael J. Wysocki
2010-11-24  0:11                                                           ` Kevin Hilman
2010-11-24  0:11                                                           ` Kevin Hilman
2010-11-24 16:43                                                             ` Alan Stern
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24 18:03                                                               ` Kevin Hilman
2010-11-24 16:43                                                             ` Alan Stern
2010-11-24 14:56                                                           ` Alan Stern
2010-11-24 20:33                                                             ` Rafael J. Wysocki
2010-11-24 20:33                                                             ` Rafael J. Wysocki
2010-11-25 15:52                                                               ` [PATCH ver. 3] " Alan Stern
2010-11-25 15:52                                                               ` Alan Stern
2010-11-25 18:58                                                                 ` Oliver Neukum
2010-11-25 18:58                                                                 ` [linux-pm] " Oliver Neukum
2010-11-25 20:03                                                                   ` Rafael J. Wysocki
2010-11-25 20:03                                                                   ` [linux-pm] " Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-26 22:23                                                                 ` Rafael J. Wysocki
2010-11-24 14:56                                                           ` [PATCH ver. 2] " Alan Stern
2010-11-23  3:19                                                       ` Alan Stern
2010-11-22 15:38                                                   ` Alan Stern
2010-11-21 23:41                                                 ` Rafael J. Wysocki
2010-11-20 12:56                                             ` Rafael J. Wysocki
2010-10-06 23:51                                         ` [PATCH] " Kevin Hilman
2010-10-06 23:51                                         ` Kevin Hilman
2010-10-06 19:35                                     ` Kevin Hilman
2010-10-06 15:58                                   ` Alan Stern
2010-09-30 22:41                         ` Rafael J. Wysocki
2010-09-30 21:42                       ` Alan Stern
2010-09-30 21:42                       ` Alan Stern
2010-09-30 22:02                     ` Rafael J. Wysocki
2010-10-01 14:12                       ` Alan Stern
2010-10-01 21:14                         ` Rafael J. Wysocki
2010-10-01 21:14                         ` Rafael J. Wysocki
2010-10-01 22:37                           ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: Re: [PATCH] PM: add synchronous ...) Rafael J. Wysocki
2010-10-01 22:37                           ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: Re: [linux-pm] " Rafael J. Wysocki
2010-10-02 14:15                             ` Alan Stern
2010-10-02 14:15                             ` [PATCH] PM / Runtime: Reduce code duplication in core helper functions (was: " Alan Stern
2010-10-01 14:12                       ` [PATCH] PM: add synchronous runtime interface for interrupt handlers Alan Stern
2010-09-27 21:11             ` runtime_pm_get_sync() from ISR with IRQs disabled? Kevin Hilman
2010-09-27 21:11             ` [linux-pm] " Kevin Hilman
2010-09-27 20:39           ` Alan Stern
2010-09-27 20:00         ` Rafael J. Wysocki
2010-09-24 20:27     ` [linux-pm] " Alan Stern
2010-09-24 21:52       ` Kevin Hilman
2010-09-24 21:52       ` [linux-pm] " Kevin Hilman
2010-09-24 20:27     ` Alan Stern
2010-09-24 18:54   ` Kevin Hilman

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=4DA3386F.8090609@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=p-basak2@ti.com \
    --cc=stern@rowland.harvard.edu \
    /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.