mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
To: Oleksandr Natalenko <oleksandr@natalenko.name>,
	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
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:47:42 +0530	[thread overview]
Message-ID: <cfd0a622-89bc-4303-a972-4b5c8380eb76@amd.com> (raw)
In-Reply-To: <2733323.mvXUDI8C0e@natalenko.name>

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.

Thanks for testing the patch!

Regards,
Dhananjay

> 
> Thank you.
> 

  reply	other threads:[~2024-06-10 15:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 10:07 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 [this message]
2024-06-10 18:08     ` Oleksandr Natalenko

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=cfd0a622-89bc-4303-a972-4b5c8380eb76@amd.com \
    --to=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=oleksandr@natalenko.name \
    --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

all inboxes | Powered by JetHome®