From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Tri Vo <trong@android.com>,
viresh.kumar@linaro.org, rafael@kernel.org, hridya@google.com,
sspatil@google.com, kaleshsingh@google.com,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
kernel-team@android.com
Subject: Re: [PATCH v2] PM / wakeup: show wakeup sources stats in sysfs
Date: Thu, 04 Jul 2019 12:31:24 +0200 [thread overview]
Message-ID: <3451189.hAX5mKGt1u@kreacher> (raw)
In-Reply-To: <20190628151040.GA14074@kroah.com>
On Friday, June 28, 2019 5:10:40 PM CEST Greg KH wrote:
> On Thu, Jun 27, 2019 at 03:53:35PM -0700, Tri Vo wrote:
> > 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, debugfs doesn't have stable ABI. For this reason, expose wakeup
> > sources statistics in sysfs under /sys/power/wakeup_sources/<name>/
> >
> > Embedding a struct kobject into struct wakeup_source changes lifetime
> > requirements on the latter. To that end, change deallocation of struct
> > wakeup_source using kfree to kobject_put().
> >
> > Change struct wakelock's wakeup_source member to a pointer to decouple
> > lifetimes of struct wakelock and struct wakeup_source for above reason.
> >
> > Introduce CONFIG_PM_SLEEP_STATS that enables/disables showing wakeup
> > source statistics in sysfs.
> >
> > Signed-off-by: Tri Vo <trong@android.com>
>
> Ok, this looks much better, but I don't like the use of a "raw" kobject
> here. It is much simpler, and less code, to use 'struct device'
> instead.
>
> As proof, I reworked the patch to do just that, and it saves over 50
> lines of .c code, which is always nice :)
Thanks for taking the time to do that!
> Attached below is the reworked code, along with the updated
> documentation file. It creates devices in a virtual class, and you can
> easily iterate over them all by looking in /sys/class/wakeup/.
That actually is nice - no need to add anything under /sys/power/.
> Note, I'm note quite sure you need all of the changes you made in
> kernel/power/wakelock.c when you make the structure contain a pointer to
> the wakeup source and not the structure itself, but I just went with it
> and got it all to build properly.
I'm not really sure about it either.
> Also note, I've not actually tested this at all, only built it, so I
> _strongly_ suggest that you test this to make sure it really works :)
>
> What do you think?
I agree with the direction. :-)
Cheers!
next prev parent reply other threads:[~2019-07-04 10:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 0:54 [PATCH] PM / wakeup: show wakeup sources stats in sysfs Tri Vo
2019-06-26 0:59 ` Tri Vo
2019-06-26 1:12 ` Greg KH
2019-06-26 1:33 ` Tri Vo
2019-06-26 1:46 ` Greg KH
2019-06-26 22:26 ` Tri Vo
2019-06-26 22:48 ` Tri Vo
2019-06-27 0:04 ` Greg KH
2019-06-27 22:53 ` [PATCH v2] " Tri Vo
2019-06-28 15:10 ` Greg KH
2019-07-04 10:31 ` Rafael J. Wysocki [this message]
2019-07-08 3:33 ` Tri Vo
2019-07-15 20:11 ` [PATCH v3] " Tri Vo
2019-07-15 20:36 ` Greg KH
2019-07-15 21:43 ` [PATCH v4] " Tri Vo
2019-07-15 21:48 ` Rafael J. Wysocki
2019-07-16 2:11 ` Greg Kroah-Hartman
2019-07-16 4:16 ` Tri Vo
2019-07-16 8:30 ` Rafael J. Wysocki
2019-07-16 8:39 ` Greg Kroah-Hartman
2019-07-16 9:36 ` Rafael J. Wysocki
2019-07-15 21:48 ` [PATCH v3] " Tri Vo
2019-07-16 2:12 ` Greg KH
2019-06-27 22:57 ` [PATCH] " Tri Vo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3451189.hAX5mKGt1u@kreacher \
--to=rjw@rjwysocki.net \
--cc=gregkh@linuxfoundation.org \
--cc=hridya@google.com \
--cc=kaleshsingh@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sspatil@google.com \
--cc=trong@android.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).