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] [day] [month] [year] [list]
Message-ID: <1682360.syUnOcd5pY@kreacher>
Date:   Mon, 19 Aug 2019 11:33:19 +0200
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Tri Vo <trong@...roid.com>, Tony Lindgren <tony@...mide.com>,
        Qian Cai <cai@....pw>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: "PM / wakeup: Show wakeup sources stats in sysfs" causes boot warnings

On Friday, August 16, 2019 4:19:35 PM CEST Stephen Boyd wrote:
> Quoting Rafael J. Wysocki (2019-08-16 05:17:23)
> > On Wed, Aug 14, 2019 at 8:37 PM Tri Vo <trong@...roid.com> wrote:
> > >
> > > On Wed, Aug 14, 2019 at 1:40 AM Tony Lindgren <tony@...mide.com> wrote:
> > > >
> > > > * Stephen Boyd <swboyd@...omium.org> [691231 23:00]:
> > > > > I also notice that device_set_wakeup_capable() has a check to see if the
> > > > > device is registered yet and it skips creating sysfs entries for the
> > > > > device if it isn't created in sysfs yet. Why? Just so it can be called
> > > > > before the device is created? I guess the same logic is handled by
> > > > > dpm_sysfs_add() if the device is registered after calling
> > > > > device_set_wakeup_*().
> > > >
> > > > Hmm just guessing.. It's maybe because drivers can enable and disable
> > > > the wakeup capability at any point for example like driver/net drivers
> > > > do based on WOL etc?
> > > >
> > > > > There's two approaches I see:
> > > > >
> > > > >       1) Do a similar check for device_set_wakeup_enable() and skip
> > > > >       adding the wakeup class until dpm_sysfs_add().
> > > > >
> > > > >       2) Find each case where this happens and only call wakeup APIs
> > > > >       on the device after the device is added.
> > > > >
> > > > > I guess it's better to let devices have wakeup modified on them before
> > > > > they're registered with the device core?
> > > >
> > > > I think we should at least initially handle case #1 above as multiple
> > > > places otherwise seem to break. Then maybe we could add a warning to
> > > > help fix all the #2 cases if needed?
> > >
> > > Makes sense. For case#1, we could also just register the wakeup source
> > > without specifying the parent device if the latter hasn't been
> > > registered yet. Userspace won't be able to associate a wakeup source
> > > to the parent device. But I think it's a reasonable fix, assuming we
> > > want to fix devices not being added before calling wakeup APIs #2.
> > 
> > Well, OK
> > 
> > I'm going to drop the entire series from linux-next at this point and
> > let's start over.
> 
> I was going to send the first patch I floated as a more formal patch to
> be applied to the PM tree. I was waiting to see if the semantics of
> device_set_wakeup_*() could be clarified because I don't understand if
> they're allowed to be called before device_add().
> 
> > 
> > Also note that all of this is not an issue until we start to add
> > children under the device passed to device_set_wakeup_enable() and
> > friends so maybe that is not a good idea after all?
> 
> My primary goal is to know what wakeup is associated with a device. If
> we delay creation of the sysfs node to the time that device_add() is
> called then it will allow device_set_wakeup_enable() to be called before
> the device is published to userspace. Is anything wrong with that? This
> seems to be the intention of the API based on the way
> device_set_wakeup_capable() is written. Furthermore, if we make this
> change then we don't need to fix various drivers to reorder calls to
> device_set_wakeup_enable() and device_add(), so it looks like the right
> approach.

Sounds reasonable.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ