* One issue regarding the run time power management @ 2010-11-02 20:38 Raj Kumar 2010-11-03 3:18 ` Rafael J. Wysocki 0 siblings, 1 reply; 6+ messages in thread From: Raj Kumar @ 2010-11-02 20:38 UTC (permalink / raw) To: linux-pm [-- Attachment #1.1: Type: text/plain, Size: 1166 bytes --] Hi, There is a one issue coming regarding the run time power management during system suspend, Suppose system suspend is going on and before the suspend callback of driver is executed, driver issues a runtime resume to run time power management core before it gets the system suspend call back but System suspend is going on then how the run time power management prevents this condition? As I saw the code during dpm_prepare, power usage count is incremented by 1 by calling pm_runtime_get_noresume(dev) and then it calls pm_runtime_barrier, Since During System suspend, driver calls pm_runtime_get which will invoke atomic_inc(&dev->power.usage_count); which increments the power usage count and calls pm_request_resume which does not have any check on power usage count, So when System suspend is going on and it has not reached suspend call back of driver and driver submits run time resume request (if the device is suspended at runtime earlier) Then How run time power management prevents device run time resume when the system suspend is going on as it does not check for power usage count? Regards Raj [-- Attachment #1.2: Type: text/html, Size: 1516 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: One issue regarding the run time power management 2010-11-02 20:38 One issue regarding the run time power management Raj Kumar @ 2010-11-03 3:18 ` Rafael J. Wysocki 2010-11-07 16:31 ` Alan Stern 2011-03-22 9:31 ` Regarding the dedicated memory for hibernation Raj Kumar 0 siblings, 2 replies; 6+ messages in thread From: Rafael J. Wysocki @ 2010-11-03 3:18 UTC (permalink / raw) To: Raj Kumar; +Cc: linux-pm On Tuesday, November 02, 2010, Raj Kumar wrote: > > Hi, > > There is a one issue coming regarding the run time power management during system suspend, Suppose > system suspend is going on and before the suspend callback of driver is executed, driver issues a runtime resume to run time power management core before it gets > the system suspend call back but System suspend is going on then how the run time power management prevents this condition? > > As I saw the code during dpm_prepare, power usage count is incremented by 1 by calling pm_runtime_get_noresume(dev) and then it calls > pm_runtime_barrier, > > Since During System suspend, driver calls pm_runtime_get which will invoke > > atomic_inc(&dev->power.usage_count); > > which increments the power usage count and calls pm_request_resume which does not have any check on power usage count, pm_request_resume() called during system suspend will not have any effect, unless it is called before the pm_runtime_barrier() in dpm_prepare(), in which case the device is going to be resumed and system suspend will be aborted, because the PM workqueue if frozen before the suspend of devices. > So when System suspend is going on and it has not reached suspend call back of driver and driver submits run time resume request (if > the device is suspended at runtime earlier) > > Then How run time power management prevents device run time resume when the system suspend is going on as it does not > check for power usage count? The request to resume the device waits until the thawing of the PM workqueue. if the driver needs to resume the device during suspend, it should use pm_runtime_resume() for that, in which case the PM core doesn't care. Thanks, Rafael ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: One issue regarding the run time power management 2010-11-03 3:18 ` Rafael J. Wysocki @ 2010-11-07 16:31 ` Alan Stern 2010-11-08 23:27 ` Rafael J. Wysocki 2011-03-22 9:31 ` Regarding the dedicated memory for hibernation Raj Kumar 1 sibling, 1 reply; 6+ messages in thread From: Alan Stern @ 2010-11-07 16:31 UTC (permalink / raw) To: Rafael J. Wysocki; +Cc: linux-pm, Raj Kumar On Wed, 3 Nov 2010, Rafael J. Wysocki wrote: > On Tuesday, November 02, 2010, Raj Kumar wrote: > > > > Hi, > > > > There is a one issue coming regarding the run time power management during system suspend, Suppose > > system suspend is going on and before the suspend callback of driver is executed, driver issues a runtime resume to run time power management core before it gets > > the system suspend call back but System suspend is going on then how the run time power management prevents this condition? > > > > As I saw the code during dpm_prepare, power usage count is incremented by 1 by calling pm_runtime_get_noresume(dev) and then it calls > > pm_runtime_barrier, > > > > Since During System suspend, driver calls pm_runtime_get which will invoke > > > > atomic_inc(&dev->power.usage_count); > > > > which increments the power usage count and calls pm_request_resume which does not have any check on power usage count, > > pm_request_resume() called during system suspend will not have any effect, unless it is called before > the pm_runtime_barrier() in dpm_prepare(), in which case the device is going to be resumed and > system suspend will be aborted, because the PM workqueue if frozen before the suspend of > devices. Should pm_request_resume be changed? Maybe it should abort a system sleep transition. Or maybe it should abort the sleep if the device in question has already been suspended. Alan Stern ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: One issue regarding the run time power management 2010-11-07 16:31 ` Alan Stern @ 2010-11-08 23:27 ` Rafael J. Wysocki 0 siblings, 0 replies; 6+ messages in thread From: Rafael J. Wysocki @ 2010-11-08 23:27 UTC (permalink / raw) To: Alan Stern; +Cc: linux-pm, Raj Kumar On Sunday, November 07, 2010, Alan Stern wrote: > On Wed, 3 Nov 2010, Rafael J. Wysocki wrote: > > > On Tuesday, November 02, 2010, Raj Kumar wrote: > > > > > > Hi, > > > > > > There is a one issue coming regarding the run time power management during system suspend, Suppose > > > system suspend is going on and before the suspend callback of driver is executed, driver issues a runtime resume to run time power management core before it gets > > > the system suspend call back but System suspend is going on then how the run time power management prevents this condition? > > > > > > As I saw the code during dpm_prepare, power usage count is incremented by 1 by calling pm_runtime_get_noresume(dev) and then it calls > > > pm_runtime_barrier, > > > > > > Since During System suspend, driver calls pm_runtime_get which will invoke > > > > > > atomic_inc(&dev->power.usage_count); > > > > > > which increments the power usage count and calls pm_request_resume which does not have any check on power usage count, > > > > pm_request_resume() called during system suspend will not have any effect, unless it is called before > > the pm_runtime_barrier() in dpm_prepare(), in which case the device is going to be resumed and > > system suspend will be aborted, because the PM workqueue if frozen before the suspend of > > devices. I should have said that it only affects the devices for which device_may_wakeup() returns 'true'. > Should pm_request_resume be changed? Maybe it should abort a system > sleep transition. Or maybe it should abort the sleep if the device in > question has already been suspended. Well, I don't think so, at least not always. Perhaps it's better to let the caller execute pm_wakeup_event() or pm_stay_awake() before calling pm_request_resume() in case it wants to abort system suspend in progress. I guess the core might do that as well, actually, in the situation described above ... Thanks, Rafael ^ permalink raw reply [flat|nested] 6+ messages in thread
* Regarding the dedicated memory for hibernation 2010-11-03 3:18 ` Rafael J. Wysocki 2010-11-07 16:31 ` Alan Stern @ 2011-03-22 9:31 ` Raj Kumar 2011-03-22 20:36 ` Rafael J. Wysocki 1 sibling, 1 reply; 6+ messages in thread From: Raj Kumar @ 2011-03-22 9:31 UTC (permalink / raw) To: rjw; +Cc: linux-pm [-- Attachment #1.1: Type: text/plain, Size: 489 bytes --] Hi Rafael, I have one question regarding the dedicated memory(the memory that is not OS addressable). But when userspace does mmap, I am creating mapping for VMA to physical addresses that are in dedicated memory. The question is when system hibernates, will the OS kernel take care of this when creating hibernation image as mmap creates a virtual address space or device driver should explicity swap this memory(dedicated memory) in hibernation image? Regards Raj [-- Attachment #1.2: Type: text/html, Size: 700 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Regarding the dedicated memory for hibernation 2011-03-22 9:31 ` Regarding the dedicated memory for hibernation Raj Kumar @ 2011-03-22 20:36 ` Rafael J. Wysocki 0 siblings, 0 replies; 6+ messages in thread From: Rafael J. Wysocki @ 2011-03-22 20:36 UTC (permalink / raw) To: Raj Kumar; +Cc: linux-pm On Tuesday, March 22, 2011, Raj Kumar wrote: > > Hi Rafael, > > I have one question regarding the dedicated memory(the memory that is not OS addressable). What do you mean by not OS addressable? > But when userspace does mmap, I am creating mapping for VMA to physical addresses that are in dedicated memory. > The question is when system hibernates, will the OS kernel take care of this when creating hibernation image as mmap creates a virtual address space or device driver should explicity swap this memory(dedicated memory) in hibernation image? The hibernate core saves everything that's regarded as RAM. The other memory areas have to be saved by drivers (or generally subsystems) that manage them before the image is created. Thanks, Rafael ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-22 20:36 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-11-02 20:38 One issue regarding the run time power management Raj Kumar 2010-11-03 3:18 ` Rafael J. Wysocki 2010-11-07 16:31 ` Alan Stern 2010-11-08 23:27 ` Rafael J. Wysocki 2011-03-22 9:31 ` Regarding the dedicated memory for hibernation Raj Kumar 2011-03-22 20:36 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox