Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1351152

Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended
Date 2016-03-06 18:00 +0100
Message-ID <r9Kca-7GF-1@gated-at.bofh.it> (permalink)
References <r9IWJ-6Sg-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 6 Mar 2016, Laurent Pinchart wrote:

> > >> What I was thinking though, but it might be a bit controversial. :-)...
> > >> Instead of relying on whether we actually forced runtime suspend
> > >> earlier, why couldn't we instead check the runtime PM usage count of
> > >> the device?
> > >> 
> > >> Only when it's greater than zero, we shall do the forced resume of the
> > >> device, otherwise just re-enable runtime PM.
> > >> 
> > >> This would have the affect of leaving devices in runtime suspend,
> > >> until they really needs to be used again. It would thus decrease the
> > >> total system PM resume time.
> > >> 
> > >> Do you think this could work?
> > > 
> > > If you do this then there would be no need for is_force_suspended.  It
> > > seems like a good idea to me.
> > 
> > I agree, that's a better idea. Drivers shouldn't call
> > pm_runtime_force_resume() if they haven't called pm_runtime_force_suspend(),
> > so checking the PM use count should be fine. I'll modify the patch, test it
> > and resubmit.
> 
> I gave it an unfortunately unsuccessful try. The problem I ran into is that 
> device_prepare() calls pm_runtime_get_noresume() calls 
> pm_runtime_get_noresume(), with the corresponding pm_runtime_put() call being 
> performed in device_complete(). The device power usage_count is thus always 
> non-zero in the system resume handler, so I can't base the decision on that.

You could check for usage_count > 1 instead of > 0.  With a comment 
explaining why, of course.

Alan Stern

> I also noticed that pm_genpd_prepare() runtime-resumes the device (when the 
> power domain is in the GPD_STATE_ACTIVE state). I don't know why that is, but 
> it means that in practice my device gets runtime-resumed when suspending the 
> system while it could stay runtime-suspended in practice.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended Ulf Hansson <ulf.hansson@linaro.org> - 2016-03-04 11:40 +0100
  Re: [PATCH] PM / Runtime: Only force-resume device if it has been  force-suspended Alan Stern <stern@rowland.harvard.edu> - 2016-03-04 16:30 +0100
    Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-03-04 22:10 +0100
      Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-03-06 16:40 +0100
        Re: [PATCH] PM / Runtime: Only force-resume device if it has been  force-suspended Alan Stern <stern@rowland.harvard.edu> - 2016-03-06 18:00 +0100
        Re: [PATCH] PM / Runtime: Only force-resume device if it has been force-suspended Ulf Hansson <ulf.hansson@linaro.org> - 2016-03-07 11:20 +0100

csiph-web