Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp929356yba; Thu, 9 May 2019 08:06:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDi8BkNQbeHKKfnAinvYL/L1w00Jy64RrpJA/dBCPoXDPQzkq/TUGRNAveyUKy8kt3L8UT X-Received: by 2002:a63:ef53:: with SMTP id c19mr6432404pgk.120.1557414395705; Thu, 09 May 2019 08:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557414395; cv=none; d=google.com; s=arc-20160816; b=VeK4o4yRNCsp7nkb/ES8OUTHZ0T2Y1A2/92lOZB/Zu4LJ5wI/3dqnvPw73p8Qnp36c 5l7B/l/2ISg9VuYwZvC3b0a/sQ1NLzcUTjqbL9cRhTQrwyqUPm6QkhVd0pCuBciJcc4g kyZOQxFFW6m31qIKFxahGbsmUnVJpsWzLA7peYGp70mGx1ET6KsvJXwydw7rwLdDSGIr xFayH90IUePQw8UuCl+a6DrJNZglZbZI636a//mNyVZnbRDNbD6j6ytla/VV7eRVyXpA U4ZgD+22FhiiJViqhgHwgxJGCMJ7864LmZ7/CdJGkjLrGKHU3BI+Us0xg9zWReUh/Vbk EKBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=JOQhoyPMbbcJSfZn9QXhL4ndn62m5KWHeJzy08WnpzY=; b=yjeKqc2CZ5TuBDOAXMUlgrYUK5ql9VcSdIevLwH8gUhvx1K8pwv7/rEGYbvC7Fmu9G IAdbHC+HhWWhoxakZNpvCha3iBa+HO0GX4ni3oUpdM77Xv68NLi6Zcw6BmwoLo77Dy6v mbRsikX9zJuVE+2JFXeuFJwIg1BC1G9Cwfu5QRysLUajXqhuNjYUYLxJ+agYFxqCugdH 2mnY+e2d0VYEBcKkUQxIhiNRjJlsmQ2ovAzgXdTP17WPKRKnaT63Eujh0fC8gXcWaXlx L4hi7SCk2S0oSn6MjC1M9WGOEvqjmygMiCOOrUt9zfALI08Xd32M/Fg5XG2qJD/UL9+j Op/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d75si3704882pfm.259.2019.05.09.08.06.15; Thu, 09 May 2019 08:06:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726907AbfEIPEE (ORCPT + 99 others); Thu, 9 May 2019 11:04:04 -0400 Received: from mga11.intel.com ([192.55.52.93]:33485 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbfEIPEE (ORCPT ); Thu, 9 May 2019 11:04:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2019 08:04:03 -0700 X-ExtLoop1: 1 Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 09 May 2019 08:04:03 -0700 Received: from [10.254.89.177] (kliang2-mobl.ccr.corp.intel.com [10.254.89.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id BFA80580102; Thu, 9 May 2019 08:04:02 -0700 (PDT) Subject: Re: [PATCH 22/22] perf/x86/intel/rapl: rename internal variables in response to multi-die/pkg support To: Len Brown , x86@kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1557177585.git.len.brown@intel.com> <9f57786ba08d4d5e913cd21693aadb0ccdba72b2.1557177585.git.len.brown@intel.com> From: "Liang, Kan" Message-ID: <06e134aa-943a-dff9-4d33-e0bc8449f284@linux.intel.com> Date: Thu, 9 May 2019 11:04:01 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <9f57786ba08d4d5e913cd21693aadb0ccdba72b2.1557177585.git.len.brown@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/6/2019 5:26 PM, Len Brown wrote: > From: Len Brown > > 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 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 Signed-off-by: Kan Liang --- 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