lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=UV+3PNF=O8Zv4UJK50gvDx=WHbamLLhH5ANZUBeCxjdQ@mail.gmail.com>
Date:   Wed, 23 Feb 2022 07:43:27 -0800
From:   Doug Anderson <dianders@...omium.org>
To:     Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Brian Norris <briannorris@...omium.org>,
        Andrzej Hajda <andrzej.hajda@...el.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...ux.ie>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Jonas Karlman <jonas@...boo.se>,
        Neil Armstrong <narmstrong@...libre.com>,
        Robert Foss <robert.foss@...aro.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/bridge: ti-sn65dsi86: Properly undo autosuspend

Hi,

On Tue, Feb 22, 2022 at 9:08 PM Laurent Pinchart
<laurent.pinchart@...asonboard.com> wrote:
>
> On Tue, Feb 22, 2022 at 11:44:54PM +0100, Linus Walleij wrote:
> > On Tue, Feb 22, 2022 at 11:19 PM Douglas Anderson <dianders@...omium.org> wrote:
> > >
> > > The PM Runtime docs say:
> > >   Drivers in ->remove() callback should undo the runtime PM changes done
> > >   in ->probe(). Usually this means calling pm_runtime_disable(),
> > >   pm_runtime_dont_use_autosuspend() etc.
> > >
> > > We weren't doing that for autosuspend. Let's do it.
> > >
> > > Fixes: 9bede63127c6 ("drm/bridge: ti-sn65dsi86: Use pm_runtime autosuspend")
> > > Signed-off-by: Douglas Anderson <dianders@...omium.org>
> >
> > Hm. I know a few places in drivers where I don't do this :/
>
> It seems to be a very common problem indeed, I haven't seen any driver
> yet that uses pm_runtime_dont_use_autosuspend(). We could play a game of
> whack-a-mole, but we'll never win. Could this be solved in the runtime
> PM framework instead ? pm_runtime_disable() could disable auto-suspend.
> If there are legitimate use cases for disabling runtime PM temporarily
> without disabling auto-suspend, then a new function designed
> specifically for remove() that would take care of cleaning everything up
> could be another option.

Yeah, it would be good. It's probably not a yak I have time to shave
right now, though. :(

I _suspect_ that there are legitimate reasons we can't just magically
do it in pm_runtime_disable(). If nothing else I believe there are
legitimate code paths during normal operation that look like this:

  pm_runtime_disable();
  do_something_that_needs_pm_runtime_disabled();
  pm_runtime_enable();

Also: if it were really a simple problem to solve one would have
thought that it would have been solved initially instead of adding
documentation particularly mentioning
pm_runtime_dont_use_autosuspend()

How about a middle ground, though: we could add a devm function that
does all the magic. Somewhat recently devm_pm_runtime_enable() was
added. What if we add a variant for those that use autosuspend, like:

devm_pm_runtime_enable_with_autosuspend(dev, initial_delay)

That would:
* pm_runtime_enable()
* pm_runtime_set_autosuspend_delay()
* pm_runtime_use_autosuspend()
* Use devm_add_action_or_reset() to undo everything.

Assuming that the pm_runtime folks are OK with that, we could
transition things over to the new function once it rolls into
mainline.

So this doesn't magically fix all existing code but provides a path to
make this more discoverable.

-Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ