[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160616053802.GA7810@hr-amur2>
Date: Thu, 16 Jun 2016 13:38:14 +0800
From: Huang Rui <ray.huang@....com>
To: Vince Weaver <vincent.weaver@...ne.edu>
CC: Borislav Petkov <bp@...e.de>, Thomas Gleixner <tglx@...utronix.de>,
"Peter Zijlstra" <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
"Andy Lutomirski" <luto@...capital.net>,
Robert Richter <rric@...nel.org>,
"Jacob Shin" <jacob.w.shin@...il.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Kan Liang <kan.liang@...el.com>,
<linux-kernel@...r.kernel.org>, <x86@...nel.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com>,
Borislav Petkov <bp@...en8.de>,
Guenter Roeck <linux@...ck-us.net>,
Fengguang Wu <fengguang.wu@...el.com>
Subject: Re: [REDO PATCH v7] perf/x86/amd/power: Add AMD accumulated power
reporting mechanism
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@...zp:/home/ray/tip# ./tools/perf/perf stat -a -e 'power/power-pkg/' sleep 10
>
Thanks,
Rui
Powered by blists - more mailing lists