Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-05 Thread Rafael J. Wysocki
On Sun, Aug 4, 2019 at 12:40 AM Tri Vo wrote: > > On Thu, Aug 1, 2019 at 3:10 PM Rafael J. Wysocki wrote: > > > > On Thu, Aug 1, 2019 at 11:45 PM Tri Vo wrote: > > > > > > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > > > > > Quoting Tri Vo (2019-08-01 12:50:25) > > > > > On Wed, J

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-03 Thread Tri Vo
On Thu, Aug 1, 2019 at 3:10 PM Rafael J. Wysocki wrote: > > On Thu, Aug 1, 2019 at 11:45 PM Tri Vo wrote: > > > > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > > > Quoting Tri Vo (2019-08-01 12:50:25) > > > > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd > > > > wrote: > > > > > >

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Rafael J. Wysocki (2019-08-01 15:46:33) > On Fri, Aug 2, 2019 at 12:11 AM Stephen Boyd wrote: > > > > Ok. If the device name is going to be something generic like 'wakeupN', > > then we need to make sure that the wakeup source name is unique. > > Otherwise, I'm not able to see how userspac

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Tri Vo (2019-08-01 15:44:40) > On Thu, Aug 1, 2019 at 3:11 PM Stephen Boyd wrote: > > > > Quoting Tri Vo (2019-08-01 14:44:52) > > > > > > The concern was that having both "id" and "name" around might be > > > confusing. I don't think that making the presence of "name" > > > conditional he

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Rafael J. Wysocki
On Fri, Aug 2, 2019 at 12:11 AM Stephen Boyd wrote: > > Quoting Tri Vo (2019-08-01 14:44:52) > > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > > > > > > I don't find it awkward or difficult. Just know what the name of the > > > /sys/class/wakeup/ path is and then extract the name fro

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Tri Vo
On Thu, Aug 1, 2019 at 3:11 PM Stephen Boyd wrote: > > Quoting Tri Vo (2019-08-01 14:44:52) > > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > > > > > > I don't find it awkward or difficult. Just know what the name of the > > > /sys/class/wakeup/ path is and then extract the name from

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Tri Vo (2019-08-01 14:44:52) > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > > > I don't find it awkward or difficult. Just know what the name of the > > /sys/class/wakeup/ path is and then extract the name from there if it > > doesn't match wakeupN, otherwise read the 'device

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Rafael J. Wysocki
On Thu, Aug 1, 2019 at 11:45 PM Tri Vo wrote: > > On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > > > Quoting Tri Vo (2019-08-01 12:50:25) > > > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > > > > > > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > > > > On Thu, Aug 1, 201

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Tri Vo
On Thu, Aug 1, 2019 at 1:23 PM Stephen Boyd wrote: > > Quoting Tri Vo (2019-08-01 12:50:25) > > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > > > > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > > > > > > > > > > > > > >

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Tri Vo (2019-08-01 12:50:25) > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > > > > > > > > > > > So why wouldn't something like this suffice: > > > > > > > > > > dev =

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Tri Vo
On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki > > > wrote: > > > > > > > > That's not my point (see below). > > > > > > > > >

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Greg Kroah-Hartman
On Thu, Aug 01, 2019 at 12:25:04PM -0700, Stephen Boyd wrote: > Quoting Rafael J. Wysocki (2019-08-01 10:21:44) > > On Thu, Aug 1, 2019 at 5:31 PM Stephen Boyd wrote: > > > > > > BTW, paths in /sys/devices aren't supposed to matter too much. In this > > > case, I'd expect to see userspace looking

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Rafael J. Wysocki (2019-08-01 10:21:44) > On Thu, Aug 1, 2019 at 5:31 PM Stephen Boyd wrote: > > > > BTW, paths in /sys/devices aren't supposed to matter too much. In this > > case, I'd expect to see userspace looking at the /sys/class/wakeup path > > to follow the symlink to figure out wh

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Rafael J. Wysocki
On Thu, Aug 1, 2019 at 5:31 PM Stephen Boyd wrote: > > Quoting Rafael J. Wysocki (2019-08-01 01:09:22) > > On Thu, Aug 1, 2019 at 2:45 AM Stephen Boyd wrote: > > > > > > Quoting Stephen Boyd (2019-07-31 16:45:31) > > > > > > > > This approach also nicely detects duplicate wakeup source names in t

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Stephen Boyd
Quoting Rafael J. Wysocki (2019-08-01 01:09:22) > On Thu, Aug 1, 2019 at 2:45 AM Stephen Boyd wrote: > > > > Quoting Stephen Boyd (2019-07-31 16:45:31) > > > > > > This approach also nicely detects duplicate wakeup source names in the > > > case that the string passed in to wakeup_source_register(

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-08-01 Thread Rafael J. Wysocki
On Thu, Aug 1, 2019 at 2:45 AM Stephen Boyd wrote: > > Quoting Stephen Boyd (2019-07-31 16:45:31) > > > > This approach also nicely detects duplicate wakeup source names in the > > case that the string passed in to wakeup_source_register() is already > > used on the virtual bus. > > This was clear

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Stephen Boyd
Quoting Stephen Boyd (2019-07-31 16:45:31) > > This approach also nicely detects duplicate wakeup source names in the > case that the string passed in to wakeup_source_register() is already > used on the virtual bus. This was clearly untested! Here's a better one. This is what I see on my device

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Stephen Boyd
Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki > > wrote: > > > > > > That's not my point (see below). > > > > > > > > > > + if (id < 0) > > > > > > > + return id; > > >

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Tri Vo
On Wed, Jul 31, 2019 at 4:10 PM Rafael J. Wysocki wrote: > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki > > wrote: > > > > > > On Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > > > > On Wed, Jul 31, 2019 at 3:17 PM Rafael J

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Rafael J. Wysocki
On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki wrote: > > > > On Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > > > On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki > > > wrote: > > > > > > > > On Wednesday, July 31, 2019 11:59:32

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Rafael J. Wysocki
On Thu, Aug 1, 2019 at 12:42 AM Rafael J. Wysocki wrote: > > On Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > > On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki > > wrote: > > > > > > On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > > > > Quoting Tri Vo (2019-07-31

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Tri Vo
On Wed, Jul 31, 2019 at 3:42 PM Rafael J. Wysocki wrote: > > On Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > > On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki > > wrote: > > > > > > On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > > > > Quoting Tri Vo (2019-07-31

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Rafael J. Wysocki
On Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki wrote: > > > > On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > > > Quoting Tri Vo (2019-07-31 14:55:14) > > > > +/** > > > > + * wakeup_source_sysfs_add - Add wakeup_so

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Tri Vo
On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki wrote: > > On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > > Quoting Tri Vo (2019-07-31 14:55:14) > > > +/** > > > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > > > + * @parent: Device given wakeup source

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Rafael J. Wysocki
On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > Quoting Tri Vo (2019-07-31 14:55:14) > > +/** > > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > > + * @parent: Device given wakeup source is associated with (or NULL if > > virtual). > > + * @ws: Wakeup sou

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Tri Vo
On Wed, Jul 31, 2019 at 2:59 PM Stephen Boyd wrote: > > Quoting Tri Vo (2019-07-31 14:55:14) > > +/** > > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > > + * @parent: Device given wakeup source is associated with (or NULL if > > virtual). > > + * @ws: Wakeup source to be

Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Stephen Boyd
Quoting Tri Vo (2019-07-31 14:55:14) > +/** > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > + * @parent: Device given wakeup source is associated with (or NULL if > virtual). > + * @ws: Wakeup source to be added in sysfs. > + */ > +int wakeup_source_sysfs_add(struct device

[PATCH v6] PM / wakeup: show wakeup sources stats in sysfs

2019-07-31 Thread Tri Vo
Userspace can use wakeup_sources debugfs node to plot history of suspend blocking wakeup sources over device's boot cycle. This information can then be used (1) for power-specific bug reporting and (2) towards attributing battery consumption to specific processes over a period of time. However, de