Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp161303pxj; Wed, 23 Jun 2021 18:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzPESD0nNycxuQSfZLGjLs5ade0wLxfwZpMdvmo95M07dIgn86k2Slp4TeJjwjy2G3z4kj X-Received: by 2002:a17:906:dbd5:: with SMTP id yc21mr2699159ejb.233.1624498745224; Wed, 23 Jun 2021 18:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624498745; cv=none; d=google.com; s=arc-20160816; b=PwuHgNox2/tBCtK25TpkZDp9CeXbBIZAYCueyfvQLZOJxFhMZY5s5tX8dEfHPtlXG7 fZiCBSny7ocr1wycdIcQKQ37ZIu7lE0WldNyc3tc48B2vEwSuY1DIo2ulBEdOa5WEGel ZCmptKsG88lFz997ihmKp4K0h8sv5+uzM+TtsRL8fXT1IoRYLXSjKYWDfK/W6pJJaJGN 7ym5/4bTEmAlJ7FRG0MNnqqZbQ3UvoJbiaK05hwGS6Ft43XL2bip5LQDSpn9Tob9SLhz IMM8uYF4FbZg72kbkyiyyyA33JvxaqH6tp/r+N16IhcXn2FsoDNag68/dRxy8CPXmeDU wM8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=twYjyrAcPEohAU4QPeHPzofl4OxNmfKFSWqzPotLpCE=; b=ReL7iVbIXVTP40PL7geTN+ol3bZvShZk0TAWFb346e/1y5a8NZ5J7Nsoa+6TjJNoPo yY1txZ1+jzKtTA2FPfcDPVNTx2a4NHki3tO/1ZqEq6d4mu7l0ITWdNoEqP37sr7U1YrM ALMm/uO8ip0mb+cElA6WVIrzghJoDUMpurQBLZ8vmcpctFavUqL4fc2SOFWeUJrYOYgr 775eZZL43/GUUW1gQV781TbBoiIL+euxio2czXv+TCZ8ZUVTzmg4lQzysWhMNd4oFGyF eBVeyB6SUGVoBVNvAq93I1oE3W9bGCm37Z/oEI+aiCJS5Lw3uApyLol3cpVXNUFldAL/ NYtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id w12si1655550edc.87.2021.06.23.18.38.42; Wed, 23 Jun 2021 18:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230004AbhFXBjT (ORCPT + 99 others); Wed, 23 Jun 2021 21:39:19 -0400 Received: from mga17.intel.com ([192.55.52.151]:8652 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbhFXBjQ (ORCPT ); Wed, 23 Jun 2021 21:39:16 -0400 IronPort-SDR: fiEZHI7KKLUID24+JACL71vSZbRq8SmVxHoORo8+AHWeJbotNp45zIt5xBYJxtLwie5INmsy/p YL2qxvj/v2Xg== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="187756992" X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="187756992" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 18:36:58 -0700 IronPort-SDR: sHmcMBjRyYeFjI70969dxqkeXWNm7DEtroX5wF0xOZUCL2soB8lyQpLQu0Ocvh/iI2ufy5zML4 x93pJBNYlNfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="490928476" Received: from otc-lr-04.jf.intel.com ([10.54.39.41]) by fmsmga002.fm.intel.com with ESMTP; 23 Jun 2021 18:36:58 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: eranian@google.com, namhyung@kernel.org, acme@kernel.org, jolsa@redhat.com, ak@linux.intel.com, Kan Liang Subject: [PATCH 3/7] perf/x86/intel/uncore: Create a symlink for an uncore PMU Date: Wed, 23 Jun 2021 18:22:05 -0700 Message-Id: <1624497729-158864-4-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624497729-158864-1-git-send-email-kan.liang@linux.intel.com> References: <1624497729-158864-1-git-send-email-kan.liang@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The platform specific support for Sapphire Rapids will apply a meaningful name for each uncore PMU. The script which works well with the old name may not work anymore because of the name change. To avoid the issue, a symlink should be created from the new name to the old name. Add an variable link_name to store the new name. The rule to name a new meaningful uncore name is the same as the previous platforms. Factor out __uncore_get_pmu_name(). Signed-off-by: Kan Liang --- arch/x86/events/intel/uncore.c | 28 ++++++++++++++++++++-------- arch/x86/events/intel/uncore.h | 2 ++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 9bf4dbb..04e5d37 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -842,6 +842,18 @@ static const struct attribute_group uncore_pmu_attr_group = { .attrs = uncore_pmu_attrs, }; +static void __uncore_get_pmu_name(char *pmu_name, const char *type_name, + int num_boxes, int idx) +{ + if (num_boxes == 1) { + if (strlen(type_name) > 0) + sprintf(pmu_name, "uncore_%s", type_name); + else + sprintf(pmu_name, "uncore"); + } else + sprintf(pmu_name, "uncore_%s_%d", type_name, idx); +} + static void uncore_get_pmu_name(struct intel_uncore_pmu *pmu) { struct intel_uncore_type *type = pmu->type; @@ -857,17 +869,17 @@ static void uncore_get_pmu_name(struct intel_uncore_pmu *pmu) sprintf(pmu->name, "uncore_type_%u_%d", type->type_id, type->box_ids[pmu->pmu_idx]); } + + if (type->link_name) { + __uncore_get_pmu_name(pmu->link_name, type->link_name, + type->num_boxes, type->box_ids[pmu->pmu_idx]); + pmu->pmu.link_name = pmu->link_name; + } return; } - if (type->num_boxes == 1) { - if (strlen(type->name) > 0) - sprintf(pmu->name, "uncore_%s", type->name); - else - sprintf(pmu->name, "uncore"); - } else - sprintf(pmu->name, "uncore_%s_%d", type->name, pmu->pmu_idx); - + __uncore_get_pmu_name(pmu->name, type->name, + type->num_boxes, pmu->pmu_idx); } static int uncore_pmu_register(struct intel_uncore_pmu *pmu) diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h index 187d728..2fc8565 100644 --- a/arch/x86/events/intel/uncore.h +++ b/arch/x86/events/intel/uncore.h @@ -46,6 +46,7 @@ struct intel_uncore_topology; struct intel_uncore_type { const char *name; + const char *link_name; int num_counters; int num_boxes; int perf_ctr_bits; @@ -118,6 +119,7 @@ struct intel_uncore_ops { struct intel_uncore_pmu { struct pmu pmu; char name[UNCORE_PMU_NAME_LEN]; + char link_name[UNCORE_PMU_NAME_LEN]; int pmu_idx; int func_id; bool registered; -- 2.7.4