Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1858119ybz; Thu, 30 Apr 2020 06:47:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJ85f0lfUIMpRpF11uNlB6VcK3JSGpk2rs53I+b6R7qpFEjxjrz/GTpxITsM2L2me6rp3OB X-Received: by 2002:aa7:c1ca:: with SMTP id d10mr2870174edp.152.1588254428582; Thu, 30 Apr 2020 06:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588254428; cv=none; d=google.com; s=arc-20160816; b=xmCyVl+OYdE5PLA0W7hHBgs8RyiTmxDFEujL52nTcoI5CIRxpORHmw4N9tDvIHmio6 07zd82pUNe6HLGKi1GMyJgoyyBdPtr3BKpYKEDVt/V28vjA9H94ukElm9U57YtKvwjT2 miIAWO9w21Zri3PuFHAxbDuRIGThjakxpMbX5VpUuI3Jlch7MszkCvuks0xsKM4CF9Y6 Drw22Bs5AfVowuVZ+V3egp1VLNhdohcf52RXJdxv6U2z5+uv62ficEv5f+vPK7kZa8Cw i5YunhkV0YGFh9g2sltj4/t5BIgilVMfwdJSzWgneQs0XQjKP4oeJEeJN9vIKBJkbeBr oQ/w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=dxmfvd32S7iejhwmQojIqVp7L9bW6cgEq+2AL1plhQM=; b=0tVZShPcMtwPvzAf3Th3ffnFpDy27yM+LG0tlaaiHlJ41ISEwuP9n/AT6UtoTpP879 z/p67Yol7PRktTTfKPU/nNt/bLbMhm1rXsSuISj0PaP4rHKZs9fiWWyw5G311vHS4a4k 9XP6SV6aU6ugapyRpODGSYg3AA6LGdG2mUUddnzAuZj3A40ga7xrZeUHX+get/XwHd3U KLcVoQGqdT4tKvaTKJzDXq2hq40Cv0eOnxtUP85g6feZJYm/yGeV4DhTjFsFsEISG++l OtOjHcDIcRVBr5Z6OqOIsfDJA6gFkxF8Dp5lOLvMkkFen9P3rWKH20cs3l5TwFOuvbXM c79w== 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 a6si6163361edb.367.2020.04.30.06.46.44; Thu, 30 Apr 2020 06:47:08 -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 S1726808AbgD3NpU (ORCPT + 99 others); Thu, 30 Apr 2020 09:45:20 -0400 Received: from mga02.intel.com ([134.134.136.20]:18087 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726577AbgD3NpU (ORCPT ); Thu, 30 Apr 2020 09:45:20 -0400 IronPort-SDR: 6fLJFrYba3cvQPPlDPfoKCvi8A9PVz2FAlY7xthdsBZbqPzM2S36Y3UX+jL3KuWNW0/MEwkbVO 5NTm1EfdmdRg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 06:45:19 -0700 IronPort-SDR: Y1mMGgekiC14nOYj8Q+IaQofXgqMR49XA8Na1HQ98tMAvMDzdYOqP/asHOreFT9cQ//HFt5kC9 PcGNTSwPzrrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,336,1583222400"; d="scan'208";a="368148168" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.254.213.153]) ([10.254.213.153]) by fmsmga001.fm.intel.com with ESMTP; 30 Apr 2020 06:45:15 -0700 Subject: Re: [PATCH] perf parse-events: Use strcmp to compare the PMU name To: Jiri Olsa Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, John Garry References: <20200430003618.17002-1-yao.jin@linux.intel.com> <20200430084529.GC1681583@krava> From: "Jin, Yao" Message-ID: Date: Thu, 30 Apr 2020 21:45:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200430084529.GC1681583@krava> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 4/30/2020 4:45 PM, Jiri Olsa wrote: > On Thu, Apr 30, 2020 at 08:36:18AM +0800, Jin Yao wrote: >> 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 > > looks good, any chance we could have automated test > for this uncore leader setup logic? like maybe the way > John did the pmu-events tests? like test will trigger > only when there's the pmu/events in the system > > Acked-by: Jiri Olsa > > thanks, > jirka > > I'm considering to use LKP to do the sanity tests for all perf events (core/uncore) and perf metrics periodically. It may help us to find the regressions on time. Thanks 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 >> >