From: Huang Rui <ray.huang@amd.com>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: Borislav Petkov <bp@suse.de>,
Thomas Gleixner <tglx@linutronix.de>,
"Peter Zijlstra" <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Andy Lutomirski" <luto@amacapital.net>,
Robert Richter <rric@kernel.org>,
"Jacob Shin" <jacob.w.shin@gmail.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Kan Liang <kan.liang@intel.com>, <linux-kernel@vger.kernel.org>,
<x86@kernel.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Borislav Petkov <bp@alien8.de>,
Guenter Roeck <linux@roeck-us.net>,
Fengguang Wu <fengguang.wu@intel.com>
Subject: Re: [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power reporting mechanism
Date: Thu, 16 Jun 2016 13:38:14 +0800 [thread overview]
Message-ID: <20160616053802.GA7810@hr-amur2> (raw)
In-Reply-To: <alpine.DEB.2.20.1606152104370.26137@macbook-air>
Hi Vince,
Thanks for asking.
On Wed, Jun 15, 2016 at 09:13:59PM -0400, Vince Weaver wrote:
>
> three questions about this functionality:
>
> 1. In theory this should also work on an amd fam16h model 30h
> processor too, correct? The current code limits things to fam15h
> even though the fam16mod30h has all the proper cpuid flags.
>
I was told this feature would be supported on fam15h 60h, 70h and
later processors before. Just checked the fam16h model 30h BKDG, yes,
it should be also supported. But I didn't test that platform, if you
confirm it works in your side. We can enable it.
> I've tested the functionality a bit and it seems to work but for
> some reason the ptsc seems to occasionally count backwards
> on my machine. Any reason that would be? (It doesn't seem to be
> an overflow, just reading the ptsc 5ms apart and the values are
> slightly lower after than before).
>
PTSC's frequency is about 100Mhz, it shouldn't be overflow.
> 2. Unless I'm misunderstanding things, the code seems to be accumulating
> Power. (see chunk below) Power is an instantaneous measurement, it
> makes no sense to add values. If you use 5W for 1ms and 10W for
> 1ms, the average power across the 2ms interval is not 15W.
>
> You can add energy, but not power.
>
> > + delta *= cpu_pwr_sample_ratio * 1000;
> > + tdelta = new_ptsc - prev_ptsc;
> > +
> > + do_div(delta, tdelta);
> > + local64_add(delta, &event->count);
>
You're right. Nice catch! The average power is per compute unit. We
cannot add the power simplely for each processor/package.
So here, the average power per package should be (delta1 + delta2 + ... + deltaN)/(tdelta_avg).
I will work out a fix. Thanks to point out.
> 3. The actual results gathered seem rediculously low. 341 seconds of
> calculation and only using 183 mWatts of power?
>
mWatts are for processor power not system power. Below data is
calculated on fam15h model 60h which is low power platform. Even
though the method has a minor mistake, the processor power should be
in mWatts field.
> > Performance counter stats for 'system wide':
> >
> > 183.44 mWatts power/power-pkg/
> >
> > 341.837270111 seconds time elapsed
> >
> > root@hr-zp:/home/ray/tip# ./tools/perf/perf stat -a -e 'power/power-pkg/' sleep 10
>
Thanks,
Rui
next prev parent reply other threads:[~2016-06-16 6:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 5:45 [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power reporting mechanism Huang Rui
2016-03-21 9:55 ` [tip:perf/urgent] " tip-bot for Huang Rui
2016-06-16 1:13 ` [REDO PATCH v7] " Vince Weaver
2016-06-16 5:38 ` Huang Rui [this message]
2016-06-16 5:59 ` Huang Rui
2016-06-16 21:10 ` Vince Weaver
2016-06-16 21:16 ` Vince Weaver
2016-06-16 21:36 ` Borislav Petkov
2016-06-16 16:47 ` Borislav Petkov
2016-06-17 9:58 ` Huang Rui
2016-07-19 18:22 ` Vince Weaver
2016-07-20 2:58 ` Huang Rui
2016-06-16 20:44 ` Vince Weaver
2016-06-17 10:03 ` Huang Rui
2016-06-17 15:54 ` Vince Weaver
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=20160616053802.GA7810@hr-amur2 \
--to=ray.huang@amd.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=acme@kernel.org \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=fengguang.wu@intel.com \
--cc=jacob.w.shin@gmail.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rric@kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=tglx@linutronix.de \
--cc=vincent.weaver@maine.edu \
--cc=x86@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