From patchwork Fri Jun 14 14:07:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 166814 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2111438ilk; Fri, 14 Jun 2019 07:09:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbYCtpByCr0tw8Q8f8xpirp2PExW96PpAWABOplirDxLRXawPb705n1difrm05AjJwoRxN X-Received: by 2002:a17:90a:2506:: with SMTP id j6mr11741284pje.129.1560521374233; Fri, 14 Jun 2019 07:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560521374; cv=none; d=google.com; s=arc-20160816; b=UwRhDykJaS0AJfI5+Ps14en9Li55xufg1bHHz1jrW0o2BJWmemwMGjasx3FQnlOKjR U706kb16HkL0EvmQetKmGRdB/tkTk8VKs292agcaWZfSQgwzoFMVxMafqDC3zvgc31Z3 Y5T4majuvIWcdIn8KZvWkC9zQ/iRgA2XhRSUNK5fORufLQVgAAZ3n9tBz8WXrVjd7nPN kg2LPk/fEM3CXhM3JQo74KqRyzPgXUt31oh67mg6zhb9+rkm7l5HkoU7oLl/M9i0di3Z o3hqealM2oiw51Tb8gkeTD62s1L2kLzW9LqS8mz8p8Rrk8+XuHo4apY9B0SN82dEVf7h VP7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Okrq2jn1bGVWk0ID3KNHcuAnL1v0i/ZwRERnUFr2RQc=; b=DZbMZ9RiHHAAXLOyBXh3U8p4WZHJrsX+bD2twu06zPw9JeiCI5LvkASaa4fzolAAyI qjBhJQ4Eorwz/3rcHN1akghFjUcHWnb2DShcuyGw3mHw9XmMu3L//ksjpvLQVB6TySbl 26TTlsHotyjqPxa2ThVg7gMTlghOCXkSHKV2OgKEr3w0z6R0UakTo4kZlLepcL+flU3l OA0/a1PSSOvJaug5hzcD8AsEQQ2KXHQY9Ia6jeRt1W4LFvdH7T7oINeJ1bX4lARCCcHy smiLcwjkpgQZqvpQb0aUWvG1LqWU91Y9qsyEIme4niAiDlw1dVxuSI8CNFQtzmPlN0kZ C18A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21si2518750pfe.116.2019.06.14.07.09.33; Fri, 14 Jun 2019 07:09:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbfFNOJc (ORCPT + 16 others); Fri, 14 Jun 2019 10:09:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:48064 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728619AbfFNOJb (ORCPT ); Fri, 14 Jun 2019 10:09:31 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C657F890C7430FEBB34A; Fri, 14 Jun 2019 22:09:29 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Fri, 14 Jun 2019 22:09:22 +0800 From: John Garry To: , , , , , , , , , , , , CC: , , , , "John Garry" Subject: [PATCH v2 1/5] perf pmu: Fix uncore PMU alias list for ARM64 Date: Fri, 14 Jun 2019 22:07:59 +0800 Message-ID: <1560521283-73314-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1560521283-73314-1-git-send-email-john.garry@huawei.com> References: <1560521283-73314-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform"), we fixed the issue of CPU events being aliased to uncore events. Fix this same issue for ARM64, since the said commit left the (broken) behaviour untouched for ARM64. Signed-off-by: John Garry --- tools/perf/util/pmu.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index f2eff272279b..7e7299fee550 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) { int i; struct pmu_events_map *map; - struct pmu_event *pe; const char *name = pmu->name; - const char *pname; map = perf_pmu__find_map(pmu); if (!map) @@ -722,28 +720,26 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) */ i = 0; while (1) { + const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; + struct pmu_event *pe = &map->table[i++]; + const char *pname = pe->pmu ? pe->pmu : cpu_name; - pe = &map->table[i++]; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; break; } - if (!is_arm_pmu_core(name)) { - pname = pe->pmu ? pe->pmu : "cpu"; - - /* - * uncore alias may be from different PMU - * with common prefix - */ - if (pmu_is_uncore(name) && - !strncmp(pname, name, strlen(pname))) - goto new_alias; + /* + * uncore alias may be from different PMU + * with common prefix + */ + if (pmu_is_uncore(name) && + !strncmp(pname, name, strlen(pname))) + goto new_alias; - if (strcmp(pname, name)) - continue; - } + if (strcmp(pname, name)) + continue; new_alias: pr_err("%s new_alias name=%s pe->name=%s\n", __func__, name, pe->name);