From: Chen Yu <yu.c.chen@intel.com>
To: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2][RFC] PM-runtime: add tracepoints to cover all usage_count changes
Date: Mon, 8 Jun 2020 14:53:24 +0800 [thread overview]
Message-ID: <20200608065324.GA9018@chenyu-office.sh.intel.com> (raw)
In-Reply-To: <20200607045535.GD12913@qmqm.qmqm.pl>
On Sun, Jun 07, 2020 at 06:55:35AM +0200, Michal Miroslaw wrote:
> On Sat, Jun 06, 2020 at 03:14:59PM +0800, Chen Yu wrote:
> > Hi,
> > On Fri, Jun 05, 2020 at 09:33:11PM +0200, Michal Miroslaw wrote:
> > > On Sat, Jun 06, 2020 at 03:05:52AM +0800, Chen Yu wrote:
> > > > Commit d229290689ae ("PM-runtime: add tracepoints for usage_count changes")
> > > > has added some tracepoints to monitor the change of runtime usage, and
> > > > there is something to improve:
> > > > 1. There are some places that adjust the usage count have not
> > > > been traced yet. For example, pm_runtime_get_noresume() and
> > > > pm_runtime_put_noidle()
> > > > 2. The change of the usage count will not be tracked if decreased
> > > > from 1 to 0.
> > > [...]
> > > > @@ -1448,16 +1453,17 @@ EXPORT_SYMBOL_GPL(pm_runtime_forbid);
> > > > */
> > > > void pm_runtime_allow(struct device *dev)
> > > > {
> > > > + bool is_zero;
> > > > +
> > > > spin_lock_irq(&dev->power.lock);
> > > > if (dev->power.runtime_auto)
> > > > goto out;
> > > >
> > > > dev->power.runtime_auto = true;
> > > > - if (atomic_dec_and_test(&dev->power.usage_count))
> > > > + is_zero = atomic_dec_and_test(&dev->power.usage_count);
> > > > + trace_rpm_usage_rcuidle(dev, RPM_AUTO | RPM_ASYNC);
> > > > + if (is_zero)
> > > > rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
> > > > - else
> > > > - trace_rpm_usage_rcuidle(dev, RPM_AUTO | RPM_ASYNC);
> > > > -
> > > [...]
> > >
> > > IIRC, rpm_idle() has a tracepoint already.
> > >
> > Yes, this is what I concerned previously. If someone
> > want to track the change of usage_count, then he might
> > have to enable both trace rpm_usage and rpm_idle so
> > as to track the moment when the counter drops from 1 to
> > 0. It might be more consistent if we only enable
> > trace rpm_usage to track the whole process.
> > > > @@ -1523,9 +1529,8 @@ static void update_autosuspend(struct device *dev, int old_delay, int old_use)
> > > > /* If it used to be allowed then prevent it. */
> > > > if (!old_use || old_delay >= 0) {
> > > > atomic_inc(&dev->power.usage_count);
> > > > - rpm_resume(dev, 0);
> > > > - } else {
> > > > trace_rpm_usage_rcuidle(dev, 0);
> > > > + rpm_resume(dev, 0);
> > > > }
> > > > }
> > > [...]
> > >
> > > This actually changes logic, so it doesn't match the patch description.
> > >
> > This patch intends to adjust the logic to be consistent with
> > the change of usage_counter, that is to say, only after the
> > counter has been possibly modified, we record it. In current
> > logic above, it tracks the usage count where the latter does
> > not change.
>
> I see now what you intended. I think it would be nice to put the idea
> (that all usage changes be shown using rpm_usage even if included in
> other trace points) into the commit message. Otherwise, looks ok.
>
Okay, will do in next version, thanks!
Chenyu
prev parent reply other threads:[~2020-06-08 6:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 19:05 [PATCH 0/2][RFC] Add more trace point for runtime usage count Chen Yu
2020-06-05 19:05 ` [PATCH 1/2][RFC] PM-runtime: Move all runtime usage related function to runtime.c Chen Yu
2020-06-06 17:18 ` Chen Yu
2020-06-05 19:05 ` [PATCH 2/2][RFC] PM-runtime: add tracepoints to cover all usage_count changes Chen Yu
2020-06-05 19:33 ` Michal Miroslaw
2020-06-06 7:14 ` Chen Yu
2020-06-07 4:55 ` Michal Miroslaw
2020-06-08 6:53 ` Chen Yu [this message]
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=20200608065324.GA9018@chenyu-office.sh.intel.com \
--to=yu.c.chen@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=rafael@kernel.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
Powered by JetHome