public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Len Brown <lenb@kernel.org>, x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 22/22] perf/x86/intel/rapl: rename internal variables in response to multi-die/pkg support
Date: Thu, 9 May 2019 11:04:01 -0400	[thread overview]
Message-ID: <06e134aa-943a-dff9-4d33-e0bc8449f284@linux.intel.com> (raw)
In-Reply-To: <9f57786ba08d4d5e913cd21693aadb0ccdba72b2.1557177585.git.len.brown@intel.com>



On 5/6/2019 5:26 PM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
> 
> Syntax update only -- no logical or functional change.
> 
> In response to the new multi-die/package changes, update variable names
> to use the more generic "pmuid" terminology, instead of "pkgid",
> as the pmu can refer to either packages or die.


The perf rapl "pmu" in the code is cross the pkg/die. We only register 
one rapl pmu for whole system for now.
I think it may be better use "die" to replace the "pkg" as well.
How about the patch as below?

Thanks,
Kan


 From a898867b24ed8ea3582b0c8b3218838701249065 Mon Sep 17 00:00:00 2001
From: Kan Liang <kan.liang@linux.intel.com>
Date: Thu, 9 May 2019 07:21:35 -0700
Subject: [PATCH 2/2] perf/x86/intel/rapl: rename internal variables in 
response to multi-die/pkg support

Syntax update only -- no logical or functional change.

In response to the new multi-die/package changes, update variable names
to use "die" terminology, instead of "pkg".
For previous platforms which doesn't have multi-die, "die" is identical
as "pkg".

Originally-by: Len Brown <len.brown@intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
  arch/x86/events/intel/rapl.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index e49f69c..f7fc94d 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -148,7 +148,7 @@ struct rapl_pmu {

  struct rapl_pmus {
  	struct pmu		pmu;
-	unsigned int		maxpkg;
+	unsigned int		maxdie;
  	struct rapl_pmu		*pmus[];
  };

@@ -161,13 +161,13 @@ static u64 rapl_timer_ms;

  static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
  {
-	unsigned int pkgid = topology_logical_die_id(cpu);
+	unsigned int dieid = topology_logical_die_id(cpu);

  	/*
  	 * The unsigned check also catches the '-1' return value for non
  	 * existent mappings in the topology map.
  	 */
-	return pkgid < rapl_pmus->maxpkg ? rapl_pmus->pmus[pkgid] : NULL;
+	return dieid < rapl_pmus->maxdie ? rapl_pmus->pmus[dieid] : NULL;
  }

  static inline u64 rapl_read_counter(struct perf_event *event)
@@ -668,22 +668,22 @@ static void cleanup_rapl_pmus(void)
  {
  	int i;

-	for (i = 0; i < rapl_pmus->maxpkg; i++)
+	for (i = 0; i < rapl_pmus->maxdie; i++)
  		kfree(rapl_pmus->pmus[i]);
  	kfree(rapl_pmus);
  }

  static int __init init_rapl_pmus(void)
  {
-	int maxpkg = topology_max_packages() * topology_max_die_per_package();
+	int maxdie = topology_max_packages() * topology_max_die_per_package();
  	size_t size;

-	size = sizeof(*rapl_pmus) + maxpkg * sizeof(struct rapl_pmu *);
+	size = sizeof(*rapl_pmus) + maxdie * sizeof(struct rapl_pmu *);
  	rapl_pmus = kzalloc(size, GFP_KERNEL);
  	if (!rapl_pmus)
  		return -ENOMEM;

-	rapl_pmus->maxpkg		= maxpkg;
+	rapl_pmus->maxdie		= maxdie;
  	rapl_pmus->pmu.attr_groups	= rapl_attr_groups;
  	rapl_pmus->pmu.task_ctx_nr	= perf_invalid_context;
  	rapl_pmus->pmu.event_init	= rapl_pmu_event_init;
-- 
2.7.4


  reply	other threads:[~2019-05-09 15:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 21:25 [PATCH 0/22] v5 multi-die/package topology support Len Brown
2019-05-06 21:25 ` [PATCH 01/22] x86 topology: Fix doc typo Len Brown
2019-05-06 21:25   ` [PATCH 02/22] topology: Simplify cputopology.txt formatting and wording Len Brown
2019-05-06 21:25   ` [PATCH 03/22] x86 smpboot: Rename match_die() to match_pkg() Len Brown
2019-05-06 21:25   ` [PATCH 04/22] x86 topology: Add CPUID.1F multi-die/package support Len Brown
2019-05-06 21:26   ` [PATCH 05/22] x86 topology: Create topology_max_die_per_package() Len Brown
2019-05-06 21:26   ` [PATCH 06/22] cpu topology: Export die_id Len Brown
2019-05-06 21:26   ` [PATCH 07/22] x86 topology: Define topology_die_id() Len Brown
2019-05-06 21:26   ` [PATCH 08/22] x86 topology: Define topology_logical_die_id() Len Brown
2019-05-06 21:26   ` [PATCH 09/22] powercap/intel_rapl: Simplify rapl_find_package() Len Brown
2019-05-06 21:26   ` [PATCH 10/22] powercap/intel_rapl: Support multi-die/package Len Brown
2019-05-07 12:14     ` Peter Zijlstra
2019-05-08 19:45       ` Len Brown
2019-05-06 21:26   ` [PATCH 11/22] thermal/x86_pkg_temp_thermal: " Len Brown
2019-05-06 21:26   ` [PATCH 12/22] powercap/intel_rapl: update rapl domain name and debug messages Len Brown
2019-05-06 21:26   ` [PATCH 13/22] hwmon/coretemp: Support multi-die/package Len Brown
2019-05-06 21:26   ` [PATCH 14/22] topology: Create package_cpus sysfs attribute Len Brown
2019-05-06 21:26   ` [PATCH 15/22] topology: Create core_cpus and die_cpus sysfs attributes Len Brown
2019-05-06 21:26   ` [PATCH 16/22] perf/x86/intel/uncore: Support multi-die/package Len Brown
2019-05-07 12:21     ` Peter Zijlstra
2019-05-08 19:51       ` Len Brown
2019-05-07 12:22     ` Peter Zijlstra
2019-05-08 19:51       ` Len Brown
2019-05-06 21:26   ` [PATCH 17/22] perf/x86/intel/rapl: " Len Brown
2019-05-06 21:26   ` [PATCH 18/22] perf/x86/intel/cstate: " Len Brown
2019-05-06 21:26   ` [PATCH 19/22] thermal/x86_pkg_temp_thermal: rename internal variables to zones from packages Len Brown
2019-05-06 21:26   ` [PATCH 20/22] hwmon/coretemp: " Len Brown
2019-05-06 21:26   ` [PATCH 21/22] perf/x86/intel/uncore: renames in response to multi-die/pkg support Len Brown
2019-05-09 15:02     ` Liang, Kan
2019-05-13 17:30       ` Len Brown
2019-05-06 21:26   ` [PATCH 22/22] perf/x86/intel/rapl: rename internal variables " Len Brown
2019-05-09 15:04     ` Liang, Kan [this message]
2019-05-13 17:29       ` Len Brown

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=06e134aa-943a-dff9-4d33-e0bc8449f284@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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