linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naveen Krishna Ch <naveenkrishna.ch@gmail.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Naveen Krishna Chatradhi <nchatrad@amd.com>,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 1/3 v7] hwmon: Add amd_energy driver to report energy counters
Date: Wed, 27 May 2020 08:33:25 +0530	[thread overview]
Message-ID: <CAHfPSqCDSQkR03B_g+OAWvja9-+Zwo4Pbx0jLpsHUu_sn9K77Q@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.13.2005270120271.8241@monopod.intra.ispras.ru>

Hi Alexander,

Thanks for using the driver.

On Wed, 27 May 2020 at 04:07, Alexander Monakov <amonakov@ispras.ru> wrote:
>
> On Fri, 22 May 2020, Naveen Krishna Ch wrote:
>
> > > This version looks ok, and it looks like there are no more
> > > unexpected counter wraps either. Series applied to hwmon-next.
> >
> > Thank you for your guidance and support.
>
> Thank you, looking forward to using this driver. Meanwhile, I have
> a couple of questions about AMD RAPL counters.
>
> The documentation says the PKG_ENERGY_STAT MSR is instantiated per CCD
> and L3 complex, implying that energy is accumulated for 3 or 4 cores
> in an L3 complex.
>
> However your patch reads that MSR per socket, and from testing on my
> Ryzen 4500U CPU I can confirm that the MSR gives the same value when
> accessed from each core. Therefore I think your code is correct and
> the documentation is wrong, can you confirm?
I confirmed this with the hardware folks, the definition of package has
changed with the chiplet design. May be the documentation needs an update.

>
> Next, I'm seeing paradoxical results when attempting to test accuracy
> of the counters. When running an AVX workload on 6 cores, I see
> CORE_ENERGY_STAT MSR reporting values just above 9 Watts per core, with
> 55 Watts in total, and yet PKG_ENERGY_STAT reporting only 30 Watts.
> This is clearly a contradiction since package energy must be at least
> the sum of core energy readings. Furthermore, this is happening on a
> 18 W CPU in a laptop, which definitely cannot sustain 55 Watts, and
> even 30 Watts seems too high.
>
> Can you clarify how the counters work and under what conditions they
> give accurate readings?

These registers are 32bit counters, they might wrap-around quite faster at
high work loads. So, we used a kernel thread to accumulate the values of
each core and socket to 64bit values.

Depending on when the module is inserted in the system, the initial values
of the counters could be different and we do not have a way to know, how
many time the registers are wrapped around in the past.

Difference of Energy over Time is the best way to use this information.
For example:
at t1 = 0, Read the register before starting the job, say E1.
at t2= 300secs, Read the register after the completion of the job, say E2.
power consumed = (E2-E1)/(t2 - t1) in Watts.

In our evaluation, the sum of the energy consumption of cores of a socket was
always less (actually far lesser) than the socket energy consumption.

One other thing could be the enumeration of the cores of a package in the
Desktop/Laptop systems might need different handling in the read. I will check
this.

>
> Thanks.
> Alexander

-- 
Shine bright,
(: Nav :)

  reply	other threads:[~2020-05-27  3:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 15:50 [PATCH 1/3 v7] hwmon: Add amd_energy driver to report energy counters Naveen Krishna Chatradhi
2020-05-19 15:50 ` [PATCH 2/3 v7] hwmon: (amd_energy) Add documentation Naveen Krishna Chatradhi
2020-05-19 15:50 ` [PATCH 3/3 v7] MAINTAINERS: add entry for AMD energy driver Naveen Krishna Chatradhi
2020-05-22 13:26 ` [PATCH 1/3 v7] hwmon: Add amd_energy driver to report energy counters Guenter Roeck
2020-05-22 14:19   ` Naveen Krishna Ch
2020-05-26 22:37     ` Alexander Monakov
2020-05-27  3:03       ` Naveen Krishna Ch [this message]
2020-05-27  6:59         ` Alexander Monakov
2020-05-27 10:35           ` Naveen Krishna Ch
2020-05-27 13:28             ` Guenter Roeck
2020-05-27 14:08               ` Alexander Monakov
2020-05-27 14:42                 ` Naveen Krishna Ch
2020-05-27 15:15                   ` Guenter Roeck
2020-05-27 15:25                     ` Alexander Monakov
2020-05-27 15:35                       ` Guenter Roeck
2020-05-27 14:48                 ` Guenter Roeck
2020-05-27 15:12                   ` Alexander Monakov
2020-05-27 15:33                     ` Guenter Roeck
2020-05-27 16:41                       ` Alexander Monakov
2020-05-27 16:57                         ` Guenter Roeck
2020-05-27 17:12                           ` Alexander Monakov
2020-05-27 16:59             ` Alexander Monakov
2020-05-28  4:11               ` Naveen Krishna Ch
2020-06-10 20:21                 ` Alexander Monakov
2020-06-16 14:46                   ` Chatradhi, Naveen Krishna
2020-06-16 14:53                     ` Guenter Roeck
2020-06-16 14:57                       ` Naveen Krishna Ch

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=CAHfPSqCDSQkR03B_g+OAWvja9-+Zwo4Pbx0jLpsHUu_sn9K77Q@mail.gmail.com \
    --to=naveenkrishna.ch@gmail.com \
    --cc=amonakov@ispras.ru \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nchatrad@amd.com \
    /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).