Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1229728ybz; Wed, 29 Apr 2020 17:40:57 -0700 (PDT) X-Google-Smtp-Source: APiQypLgRYDonnBCvFX9RO+qZZcXJWGohALLIaOzK/m7pjLWW3AWi3kVarhbw5U8Vz5cevuqHwDE X-Received: by 2002:a17:906:2548:: with SMTP id j8mr386571ejb.378.1588207257497; Wed, 29 Apr 2020 17:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588207257; cv=none; d=google.com; s=arc-20160816; b=SK03RgsOpFIHi9VCjVowlEKShPqT6xIbBbrxALp+zwQdHa9ZJVktQlkW8PLHowGgXp McRyp9EsGrXudylE1cfmq6jJZ+dIOtfMHQdiF9bRIZ+WXnWoqw/b7d3UxGNo5pDb55Sh MVzx2yF96P5hnC41QbaYJ3m/1S05tMJo93dR/nHI1cKr10qT192xKupezxYmVTtYpUoB Xa6+28UknkDffRT08ZKAYzfNFgghYqNbwR6hQqg2//+iLKnrrmOjaWBBgZRStCjR+OMg 8IuGUMgTvUhfT822YWK5M+xjJMF1FqXoAo1HIbXRNCSNr7ThsSQ93iHYOWDDFDVZBQQX 2wrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=miQlfTc9W1fHEkq+aCt/qjYWIONcU651WFLbMXpjrAI=; b=CjotRRX/3ns2rzgy8l5qkpaxa6ijgTGF6EYz+wQ01JAbWP7g1bUUb6RhPxPZgiyshv uVJgpNx1F7/dSBU6HiHkFsoCZOr0aM1JelgyH9d5cm7DZ2lbWs6BSnMjzmkZ3V9QSaJr +Or7Un0AJ1jZqQTijrRO5gNFLNQWMjrumxE8OLnT9MGXlW20ZQsRaNSx7OUUY0dUH4ZT QiciN1ZOj3gyjpVdo9TvNg6/xl49+HHSvmMt6hxt79J9akKcajUfkeAMBFC26gRLem8e I/Muxr856D++f3r4iTRhYprqQDnywHHNG4OhMBsLLY1MIn53MwhLChfDlP25v7oFDZKz UquQ== 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 e7si4780574ejx.367.2020.04.29.17.40.34; Wed, 29 Apr 2020 17:40:57 -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 S1726441AbgD3AiW (ORCPT + 99 others); Wed, 29 Apr 2020 20:38:22 -0400 Received: from mga05.intel.com ([192.55.52.43]:27133 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgD3AiV (ORCPT ); Wed, 29 Apr 2020 20:38:21 -0400 IronPort-SDR: gn3yI0ba676kKI4IIqVnInNpvey8Tq5RCvUSoY1RKw7Ezn/Egl3fDK2G7j8Ts4U25BkvexZHoX FU/Z3lugZInQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 17:38:21 -0700 IronPort-SDR: kCupO7Ez+fFu875Tr5wGjEN8LXzgJTL08uPs9G/JLF8I6fnqLbzyxF9Rronaf6prmRNyBbESNJ gf65kJJoSp1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,333,1583222400"; d="scan'208";a="282678294" Received: from kbl-ppc.sh.intel.com ([10.239.159.118]) by fmsmga004.fm.intel.com with ESMTP; 29 Apr 2020 17:38:19 -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, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Jin Yao Subject: [PATCH] perf parse-events: Use strcmp to compare the PMU name Date: Thu, 30 Apr 2020 08:36:18 +0800 Message-Id: <20200430003618.17002-1-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A big uncore event group is split into multiple small groups which only include the uncore events from the same PMU. This has been supported in the commit 3cdc5c2cb924a ("perf parse-events: Handle uncore event aliases in small groups properly"). If the event's PMU name starts to repeat, it must be a new event. That can be used to distinguish the leader from other members. But now it only compares the pointer of pmu_name (leader->pmu_name == evsel->pmu_name). If we use "perf stat -M LLC_MISSES.PCIE_WRITE -a" on cascadelakex, the event list is: evsel->name evsel->pmu_name --------------------------------------------------------------- unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_4 (as leader) unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_2 unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_0 unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_5 unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_3 unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_1 unc_iio_data_req_of_cpu.mem_write.part1 uncore_iio_4 ...... For the event "unc_iio_data_req_of_cpu.mem_write.part1" with "uncore_iio_4", it should be the event from PMU "uncore_iio_4". It's not a new leader for this PMU. But if we use "(leader->pmu_name == evsel->pmu_name)", the check would be failed and the event is stored to leaders[] as a new PMU leader. So this patch uses strcmp to compare the PMU name between events. Fixes: 3cdc5c2cb924a ("perf parse-events: Handle uncore event aliases in small groups properly") Signed-off-by: Jin Yao --- tools/perf/util/parse-events.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 10107747b361..786eddb6a097 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1629,12 +1629,11 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list, * event. That can be used to distinguish the leader from * other members, even they have the same event name. */ - if ((leader != evsel) && (leader->pmu_name == evsel->pmu_name)) { + if ((leader != evsel) && + !strcmp(leader->pmu_name, evsel->pmu_name)) { is_leader = false; continue; } - /* The name is always alias name */ - WARN_ON(strcmp(leader->name, evsel->name)); /* Store the leader event for each PMU */ leaders[nr_pmu++] = (uintptr_t) evsel; -- 2.17.1