Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp913807pxb; Mon, 16 Aug 2021 22:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/n8Bwmpg356MKqzjU6TARQvupKf4pa8ieL5BhC3TPU38va+UjmEOjz4NdlV8Ogqhrcz0t X-Received: by 2002:a02:5107:: with SMTP id s7mr1393062jaa.65.1629177732834; Mon, 16 Aug 2021 22:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629177732; cv=none; d=google.com; s=arc-20160816; b=AxV94J3tXLtSfo6Unh0zR5uxnL5yodZw2SZYumunEOybpyidzyfp15T3Q6y3UPZ3vI Fp2SLjYefsHVs/esVojT88nPOmX/wJks/48Wr987LLwo5YtQWFRuF5tOunLnLjpW5PgG dZgC+ZfosN2TOsyGfV9Wkz7PiudQ89u3si28FC1NojNsf3qt1lOXFHdyuNavcWW60kQj im1sVWgcBHwzJTZY/kHeGTlmRkgEGP/A4mKlgjhTIcAH4eKZvWvdzlGvBp6mTzAeAw80 mekJ7W8oUxH5eTBjDNoSsSvA66823N36eJFtfEBeACcOMrEX4BnZV0wfd7++huBiDquh XaaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=WbTBfJQ58oHOXltfXEO4haGnyXCx6B4RD7IieyuOWvM=; b=o3RYxZZcyN3InRRPT3e5YpYFTdb3hEMlBB+pXJqClz3ssgLB9OwHmNILg3iaSLK+Nl 6iCBIRKwXXGluLKl026M9b8AE0gc8TQ720Wwki4lmzTkdD4jm6m2NVMY/d9qqoc62bKD pBvhwwJMPyCY0AA2kWdUzkZ9/2Lbzr4OKARRdAkR7C7N3rltDg3tbQOwo8r5ujXOX1+Q zT65Y54sc+jXIRyxHwwVLvZFXbul4W1Hbq2Io/HQKJEpHgbfFacAZFQIi/u+tzaeeYL0 cloBCzjpTxgYzbxY9qEhEUKyXvLFaeciZt8gTKnkUd6pGm31AKQmmnxeXfi/r+Cjjjp4 vpNA== 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 r8si1325494ill.67.2021.08.16.22.22.00; Mon, 16 Aug 2021 22:22:12 -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 S237616AbhHQFVp (ORCPT + 99 others); Tue, 17 Aug 2021 01:21:45 -0400 Received: from mga09.intel.com ([134.134.136.24]:50476 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbhHQFVo (ORCPT ); Tue, 17 Aug 2021 01:21:44 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="215996568" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="215996568" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2021 22:21:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="462255091" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by orsmga007.jf.intel.com with ESMTP; 16 Aug 2021 22:21:08 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, rickyman7@gmail.com, john.garry@huawei.com, Jin Yao Subject: [PATCH v5 0/2] perf tools: Add PMU alias support Date: Tue, 17 Aug 2021 13:19:31 +0800 Message-Id: <20210817051933.16978-1-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A perf uncore PMU may have two PMU names, a real name and an alias name. With this patch set, the perf tool can monitor the PMU with either the real name or the alias. Use the real name, $ perf stat -e uncore_cha_2/event=1/ -x, 4044879584,,uncore_cha_2/event=1/,2528059205,100.00,, Use the alias, $ perf stat -e uncore_type_0_2/event=1/ -x, 3659675336,,uncore_type_0_2/event=1/,2287306455,100.00,, v5: --- 1. Don't use strdup in find functions (pmu_find_real_name and pmu_find_alias_name). Just return name and keep the 'pmu->name = strdup(name);' in pmu_lookup. 2. Remove invalid comment for alias_name in struct perf_pmu. v4: --- 1. Fix memory leaks in pmu_lookup. 2. Rebase to perf/core. v3: --- 1. Use fgets() to replace fscanf(). 2. Resource cleanup. v2: --- Add test case to verify the real name and alias name having same effect. Jin Yao (1): perf tests: Test for PMU alias Kan Liang (1): perf pmu: Add PMU alias support tools/perf/arch/x86/util/pmu.c | 129 +++++++++++++++++++++++++++++++- tools/perf/tests/parse-events.c | 92 +++++++++++++++++++++++ tools/perf/util/parse-events.y | 3 +- tools/perf/util/pmu.c | 28 ++++++- tools/perf/util/pmu.h | 5 ++ 5 files changed, 252 insertions(+), 5 deletions(-) -- 2.17.1