On Sat, Jul 07, 2018 at 04:43:48PM +0200, Lukas Wunner wrote: > On Sat, Jul 07, 2018 at 05:25:53PM +0300, Mika Westerberg wrote: > > On Sat, Jul 07, 2018 at 03:38:15PM +0200, Lukas Wunner wrote: > > > You're setting pm_runtime_no_callbacks() on the domain. A side effect of > > > setting this flag is that whenever the domain's device is runtime resumed, > > > it's parent (the NHI) is *not* runtime resumed, see this comment in > > > rpm_resume(): > > > > > > /* > > > * See if we can skip waking up the parent. This is safe only if > > > * power.no_callbacks is set, because otherwise we don't know whether > > > * the resume will actually succeed. > > > */ > > > > > > Above, you're runtime resuming the domain in boot_acl_show(). So if the > > > NHI is runtime suspended while that sysfs attribute is accessed, it won't > > > be runtime resumed. Is that actually what you want? > > > > No, it should be runtime resumed when domain is. Looking at the code in > > question bit more deeper: > [snip] > > So skipping waking the parent can only happen if any of the following > > conditions are true: > > > > - Parent has runtime PM disabled > > - Parent has ignore_children set > > - Parent is already resumed > > > > As far I can tell there can't be situation you describe that the parent > > would > > not be runtime resumed when the domain is. > > Okay, missed that. > > Then why aren't you using pm_runtime_no_callbacks() on switches as well? > Wouldn't that obviate the need to declare those empty runtime PM callbacks?
Domain is a kind of object that does not have a real physical device. It is just an abstraction of a Thunderbolt domain formed by the host controller (NHI) and the connection manager. Therefore we power manage it with the parent device (NHI). This is pretty much the purpose of pm_runtime_no_callbacks(). However, switches do have a real physical device that can be power managed. Furthermore we may need to add switch specific power management logic at some point.