lkml.org 
[lkml]   [2012]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUGFIX] PM: Fix active child counting when disabled and forbidden
On Mon, 5 Nov 2012, Huang Ying wrote:

> In current runtime PM implementation, the active child count of the
> parent device may be decreased if the runtime PM of the child device
> is disabled and forbidden. For example, to unbind a PCI driver with a
> PCI device, the following code path is possible:
>
> pci_device_remove
> pm_runtime_set_suspended
> __pm_runtime_set_status
> atomic_add_unless(&parent->power.child_count, -1, 0)
>
> That is, the parent device may be suspended, even if the runtime PM of
> child device is forbidden to be suspended. This violate the rule that
> parent is allowed to be suspended only after all its children are
> suspended, and may cause issue.

This doesn't sound like a correct description of the situation. The
rule is not violated. After pm_runtime_set_suspended runs, the child
_is_ suspended. Thus there's no reason not to allow the parent to be
suspended.

The problem -- if there really is one -- is that a driver can put a
device into the suspended state by calling pm_runtime_disable followed
by pm_runtime_set_suspended, even if the usage count is > 0.

I'm not so sure this should count as a problem. Generally devices
aren't disabled for runtime PM unless something is wrong. Under those
circumstances, the meaning of pm_runtime_forbid isn't very well
defined.

Alan Stern



\
 
 \ /
  Last update: 2012-11-05 03:41    [W:0.078 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site