linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, tglx@linutronix.de, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, kees@kernel.org,
	gustavoars@kernel.org,
	Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org, ananth.narayan@amd.com,
	gautham.shenoy@amd.com, kprateek.nayak@amd.com,
	ravi.bangoria@amd.com, sandipan.das@amd.com,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH 0/6] Add per-core RAPL energy counter support for AMD CPUs
Date: Mon, 10 Jun 2024 20:08:43 +0200	[thread overview]
Message-ID: <1887843.tdWV9SEqCh@natalenko.name> (raw)
In-Reply-To: <cfd0a622-89bc-4303-a972-4b5c8380eb76@amd.com>

[-- Attachment #1: Type: text/plain, Size: 5365 bytes --]

On pondělí 10. června 2024 17:17:42, SELČ Dhananjay Ugwekar wrote:
> Hello Oleksandr,
> 
> On 6/10/2024 7:58 PM, Oleksandr Natalenko wrote:
> > Hello.
> > 
> > On pondělí 10. června 2024 12:07:45, SELČ Dhananjay Ugwekar wrote:
> >> Currently the energy-cores event in the power PMU aggregates energy
> >> consumption data at a package level. On the other hand the core energy
> >> RAPL counter in AMD CPUs has a core scope (which means the energy 
> >> consumption is recorded separately for each core). Earlier efforts to add
> >> the core event in the power PMU had failed [1], due to the difference in 
> >> the scope of these two events. Hence, there is a need for a new core scope
> >> PMU.
> >>
> >> This patchset adds a new "power_per_core" PMU alongside the existing
> >> "power" PMU, which will be responsible for collecting the new
> >> "energy-per-core" event.
> >>
> >> Tested the package level and core level PMU counters with workloads
> >> pinned to different CPUs.
> >>
> >> Results with workload pinned to CPU 1 in Core 1 on an AMD Zen4 Genoa 
> >> machine:
> >>
> >> $ perf stat -a --per-core -e power_per_core/energy-per-core/ sleep 1
> >>
> >>  Performance counter stats for 'system wide':
> >>
> >> S0-D0-C0         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C1         1          5.72 Joules power_per_core/energy-per-core/
> >> S0-D0-C2         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C3         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C4         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C5         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C6         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C7         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C8         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C9         1          0.02 Joules power_per_core/energy-per-core/
> >> S0-D0-C10        1          0.02 Joules power_per_core/energy-per-core/
> >>
> >> [1]: https://lore.kernel.org/lkml/3e766f0e-37d4-0f82-3868-31b14228868d@linux.intel.com/
> >>
> >> This patchset applies cleanly on top of v6.10-rc3 as well as latest 
> >> tip/master.
> >>
> >> Dhananjay Ugwekar (6):
> >>   perf/x86/rapl: Fix the energy-pkg event for AMD CPUs
> >>   perf/x86/rapl: Rename rapl_pmu variables
> >>   perf/x86/rapl: Make rapl_model struct global
> >>   perf/x86/rapl: Move cpumask variable to rapl_pmus struct
> >>   perf/x86/rapl: Add wrapper for online/offline functions
> >>   perf/x86/rapl: Add per-core energy counter support for AMD CPUs
> >>
> >>  arch/x86/events/rapl.c | 311 ++++++++++++++++++++++++++++++-----------
> >>  1 file changed, 233 insertions(+), 78 deletions(-)
> >>
> >>
> > 
> > With my CPU:
> > 
> >   Model name:             AMD Ryzen 9 5950X 16-Core Processor
> > 
> > and this workload:
> > 
> > $ taskset -c 1 dd if=/dev/zero of=/dev/null
> > 
> > the following result is got:
> > 
> > $ sudo perf stat -a --per-core -e power_per_core/energy-per-core/ sleep 1
> > 
> >  Performance counter stats for 'system wide':
> > 
> > S0-D0-C0              1               1,70 Joules power_per_core/energy-per-core/
> > S0-D0-C1              1               8,83 Joules power_per_core/energy-per-core/
> > S0-D0-C2              1               0,17 Joules power_per_core/energy-per-core/
> > S0-D0-C3              1               0,33 Joules power_per_core/energy-per-core/
> > S0-D0-C4              1               0,14 Joules power_per_core/energy-per-core/
> > S0-D0-C5              1               0,33 Joules power_per_core/energy-per-core/
> > S0-D0-C6              1               0,25 Joules power_per_core/energy-per-core/
> > S0-D0-C7              1               0,19 Joules power_per_core/energy-per-core/
> > S0-D0-C8              1               0,66 Joules power_per_core/energy-per-core/
> > S0-D0-C9              1               1,71 Joules power_per_core/energy-per-core/
> > S0-D0-C10             1               0,38 Joules power_per_core/energy-per-core/
> > S0-D0-C11             1               1,69 Joules power_per_core/energy-per-core/
> > S0-D0-C12             1               0,22 Joules power_per_core/energy-per-core/
> > S0-D0-C13             1               0,11 Joules power_per_core/energy-per-core/
> > S0-D0-C14             1               0,49 Joules power_per_core/energy-per-core/
> > S0-D0-C15             1               0,37 Joules power_per_core/energy-per-core/
> > 
> >        1,002409590 seconds time elapsed
> > 
> > If it is as expected, please add my:
> > 
> > Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
> 
> We can see that after you affined the workload to cpu 1, energy 
> consumption of core 1 is considerably higher than the other cores, 
> which is as expected, will add your tested-by in next version.
> 
> P.S: I'm assuming here that cpu 1 is part of core 1 in your system, 
> please let me know if that assumption is wrong.

You assumption should be correct:

$ cat /sys/devices/system/cpu/cpu1/topology/core_id
1

> Thanks for testing the patch!
> 
> Regards,
> Dhananjay
> 
> > 
> > Thank you.
> > 
> 


-- 
Oleksandr Natalenko (post-factum)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-06-10 18:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 10:07 [PATCH 0/6] Add per-core RAPL energy counter support for AMD CPUs Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 1/6] perf/x86/rapl: Fix the energy-pkg event " Dhananjay Ugwekar
2024-06-11  5:35   ` Zhang, Rui
2024-06-11 14:17     ` Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 2/6] perf/x86/rapl: Rename rapl_pmu variables Dhananjay Ugwekar
2024-06-11  5:43   ` Zhang, Rui
2024-06-11  8:33     ` Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 3/6] perf/x86/rapl: Make rapl_model struct global Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 4/6] perf/x86/rapl: Move cpumask variable to rapl_pmus struct Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 5/6] perf/x86/rapl: Add wrapper for online/offline functions Dhananjay Ugwekar
2024-06-10 10:07 ` [PATCH 6/6] perf/x86/rapl: Add per-core energy counter support for AMD CPUs Dhananjay Ugwekar
2024-06-11  8:30   ` Zhang, Rui
2024-06-13  6:39     ` Dhananjay Ugwekar
2024-06-10 14:28 ` [PATCH 0/6] Add per-core RAPL " Oleksandr Natalenko
2024-06-10 15:17   ` Dhananjay Ugwekar
2024-06-10 18:08     ` Oleksandr Natalenko [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=1887843.tdWV9SEqCh@natalenko.name \
    --to=oleksandr@natalenko.name \
    --cc=Dhananjay.Ugwekar@amd.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ananth.narayan@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gautham.shenoy@amd.com \
    --cc=gustavoars@kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kees@kernel.org \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=sandipan.das@amd.com \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).