From patchwork Fri Jul 12 12:19:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 168944 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp825460ilk; Fri, 12 Jul 2019 05:33:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkPlLFJTtFjH9eBO8AkVHZpiAlAFsH0dFeuItbiZB73zwL1ZBspHy8kM/v//RFKvn5SAQq X-Received: by 2002:a63:e356:: with SMTP id o22mr10690268pgj.150.1562934806021; Fri, 12 Jul 2019 05:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934806; cv=none; d=google.com; s=arc-20160816; b=t5AqWYGxv4hUy7EJDjnBfowhVEYseQmk+jv97X84k9NvBjVJsTq+jtS4v7/ZBDEWTD NBPo9dj8GQkbDZbNB0v+x0UlwQFgryd9lLQ1n7DHcxTcpXpSWalaktewQ3yCasQVSVAK Ld/dYhXk3L4Xx/taXviXQ+WSXgn0tStF0IX1LNtP3yq+bbxarEAFyxDuGZvY3h83W8NH SbpvgiwQ9ZW+CtCcgFC4BhxgwpUVS2zHanaL8fcPbOwf2adSJORYQvmmjOmUjFMs8u9F +cs1jpxzzkg95X3Q0SgDVl9IbagqWQOgEaiwRJaEGjabMbi9tMdmyVU1frgJG6JiSDl+ yhgA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=11Dyiqec6wajqzSgTGwsUd9OrMe5kuwDmKQla8lUMdk=; b=1Bz4zj3H1iKfYa2sF92xSLTyMImYoYPVACQ7tQ2xpmcLMT8QlmJ5ayh/4ntqqUOaEC CxkdIt7xTfunaKMj3E9vPt0n7Vyp3Es62SrfSpSOkvOzusTIyZBpcRkvev347EfDICVJ 3ban9v+so5I/qRf+ZsV9i3/wRvsmvKIJMS2F66vujyvTq4gNSCSPcjilA5dB4rDuRJ2t HJj975wfEd3HVwhrpSd9RrV4aIlxVU2Rrig3SiOFugCXyKdWIAXVpjZeUMl5sARzGYX8 VnouAUReir23zbsdjgYVfgmgTuGrqIIBE2V6MTo641qvsVUs/GcOW76CObhtL8fQ6WM0 jKiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ioiq6VlD; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 v16si8368635pfi.142.2019.07.12.05.33.24; Fri, 12 Jul 2019 05:33:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ioiq6VlD; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729465AbfGLMcU (ORCPT + 13 others); Fri, 12 Jul 2019 08:32:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:50100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729212AbfGLMcT (ORCPT ); Fri, 12 Jul 2019 08:32:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D42D21721; Fri, 12 Jul 2019 12:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934738; bh=dqGDFDIi2rDPmFMdQfVLnotYxhySOqw8XaoV8MfvQW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ioiq6VlD+LyXA18llH1tE1Gj8kIF4zwwWbMTKxxdNLs+ZNW5ccZMsvoskwjAn8oVN yyeSwyQ3cIBOuOhBzFLmPMgbHTqYv+ZtZznQfe2mdyUFMePLGFx0oRKvRO4aGc34g3 M/qcabHlZB3DW1NyVj1TfiOkuSyBrImlX69cniyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Alexander Shishkin , Ben Hutchings , Hendrik Brueckner , Jiri Olsa , Kan Liang , Mark Rutland , Mathieu Poirier , Namhyung Kim , Peter Zijlstra , Shaokun Zhang , Thomas Richter , Will Deacon , linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, Arnaldo Carvalho de Melo Subject: [PATCH 5.2 16/61] perf pmu: Fix uncore PMU alias list for ARM64 Date: Fri, 12 Jul 2019 14:19:29 +0200 Message-Id: <20190712121621.508627544@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121620.632595223@linuxfoundation.org> References: <20190712121620.632595223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: John Garry commit 599ee18f0740d7661b8711249096db94c09bc508 upstream. 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 Cc: Alexander Shishkin Cc: Ben Hutchings Cc: Hendrik Brueckner Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Shaokun Zhang Cc: Thomas Richter Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linuxarm@huawei.com Cc: stable@vger.kernel.org Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform") Link: http://lkml.kernel.org/r/1560521283-73314-2-git-send-email-john.garry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/pmu.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct l { 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 l */ 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: /* need type casts to override 'const' */