Re: [PATCH 5/5] thunderbolt: Add support for runtime PM

From: Lukas Wunner
Date: Sat Jul 07 2018 - 10:51:25 EST


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?


> > BTW, what's the purpose of nhi_enable_int_throttling()?
>
> It changes how fast interrupts get delivered and when to start throttling.
> Mostly needed in P2P functionality (but should not do any harm for control
> channel traffic). See also 8c6bba10fb92 ("thunderbolt: Configure interrupt
> throttling for all interrupts").

Understood, thanks.

Lukas