Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp886134ybj; Thu, 7 May 2020 09:49:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKy6v1AsMhe5+2h4RAL0iipVwetM+zcjaWbSiOe99YVtyfDV1E/JS+eC8IytQGrnBUG5sT3 X-Received: by 2002:a17:906:28c3:: with SMTP id p3mr7153541ejd.130.1588870160442; Thu, 07 May 2020 09:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588870160; cv=none; d=google.com; s=arc-20160816; b=co6edWw40u+nNjmuuERYffQI7up24IadrKZaXgcPR8VT8OSoOwwLVZA/17vX8LySpt RXqyhhtpDyaAeE2CjlZ3JrBI+vJeMKruxWLqaLXtwmlfeUHNJWKzjpqbLTeaJRZ4B+Nh cfzIFqQyNqPF7hv4Es6cxCvUpGvxiV2+gYIBPHDG6sS+0xbcMGb5QhN7RNZUeFIfrk0O +1ZB3QoKZI+BiKmzb5n9URqp/EhumXUxjKwdwAJheIOWVWwhHcuj0V8UaubAw6JIuyz2 O4AiyQytWTWLkbOGSzpHzDDy0mKGRD5ntwjO8Ob1ewJzyvCELQgB9YufOF+isgeMazzf OduA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=ALB6CWA2NPbVZmvAcJDJvwoWj31I6zoHjr5Bjo7YDh8=; b=Qrj4/ZeESkiTNMWmdSk2Pmm3HMgZSEneSMLQ+RQW5mxmnudRWiBYla6WpVfau7ExEV 1hMbmi3CeoSCO2SJPJqTaUeq0EpT5qN0tALtP1/zWj3mPI+ov/YSkohE2iQutVDmolto s2HylUvWTsBc+KETWp70FiygFLL+uqOyfVihR6QITuAnbETeOi4xzx3uUsNFw+BGoJqU SPFJB33B5dzCsytw2jWQRW/b11Sgt09HbroZT2mPcFKqXI4+EMC+l5x3SJUMglbvZyr3 pt6W09pp4eIRCvcVpNIPXsZjllN6ZQdhUsfC8z4Ob03HhSk/SvPLbAMhtEbGdkutNA6G np1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OiSACmCh; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t30si3344499edt.410.2020.05.07.09.48.55; Thu, 07 May 2020 09:49:20 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OiSACmCh; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbgEGQqr (ORCPT + 99 others); Thu, 7 May 2020 12:46:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726518AbgEGQqr (ORCPT ); Thu, 7 May 2020 12:46:47 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19BCC05BD43 for ; Thu, 7 May 2020 09:46:45 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id s9so384244qkm.6 for ; Thu, 07 May 2020 09:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=ALB6CWA2NPbVZmvAcJDJvwoWj31I6zoHjr5Bjo7YDh8=; b=OiSACmChxi9gyUUngS6RRcjSkLUbt8gTQIpXJ9aLSM9Gjq/bjA9CtMr5WjutgVHrdU zpoHDYCMKgh9cuapjJndg6lWup7QoRz11eXvbC9Nnxy22zMPAi/tDPVrfMavVHJyURSk GPrsUuMD0hbD8V2gpq4Wu5rDfmlX5oMEFTWYexpELWxXcz7R4repS1cQnAj86klm3gyt 2hPqRw7ySA9dqyzUKQPfFIbFr9NKKOxfo9NGyYw3q6WHtLQRBr2d5sOKg3/LIIh3/xGY 768MW/nDidbsCzmKkNxOx/+53HF/3TqKmSFVwhK3bpoCKwSG5lKkQ3tQnD64v5IX4NFh 4C7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ALB6CWA2NPbVZmvAcJDJvwoWj31I6zoHjr5Bjo7YDh8=; b=TbSO2lc1ZfzB7amcZ1vxnapFjtcEWkWRJEduGlmfk/2GKgLDs0urUM6HQATwWYKsdr 4+/U/HP9grZ9u0JFJZRmSIW4Yr27Offm0HXz6yhKeGdoYFlNbLWzkVDf73kutEeQtxIx Ff1Msxo36644dE4qivaUdZmILhAzYGHJ3zbD5mr7NQQTgy+WlpQI+j3MVYXtreTEf8zV /cY9HSn1s66kjUv719ypsLpaNJ13ofU+ZGT2SXDjlWa9yimDGevtjyxD8Zp+Y1Y8WRxM qXhUNHlpmeTx2UaMW7CsAxRIgvwwsTVCB6FZwdOwxoD3CrOHAkCHsrgMtYxt3RY8g95p 5WKA== X-Gm-Message-State: AGi0PuY2oMUMHPsmTVz3QO955IdJ0+q7V1zeK2B94KIYCQfr34PYLxT3 91V7UQ3blhV+w/dNT7lZefs= X-Received: by 2002:ae9:e894:: with SMTP id a142mr1644087qkg.296.1588870004942; Thu, 07 May 2020 09:46:44 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id w27sm4710698qtc.18.2020.05.07.09.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 09:46:44 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3B1C640AFD; Thu, 7 May 2020 13:46:42 -0300 (-03) Date: Thu, 7 May 2020 13:46:42 -0300 To: "Jin, Yao" Cc: John Garry , Jiri Olsa , 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, "irogers@google.com" Subject: Re: [PATCH] perf parse-events: Use strcmp to compare the PMU name Message-ID: <20200507164642.GD31109@kernel.org> References: <20200430003618.17002-1-yao.jin@linux.intel.com> <20200430084529.GC1681583@krava> <66b84e3f-f7d8-bb65-616e-d159a509a439@huawei.com> <20200430111551.GC1694693@krava> <0195184b-0b43-f2fd-8d80-3b70d3f5a950@huawei.com> <8685d584-1d28-4648-8d85-2ea637f3c695@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8685d584-1d28-4648-8d85-2ea637f3c695@linux.intel.com> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Apr 30, 2020 at 09:38:34PM +0800, Jin, Yao escreveu: > Hi John, Jiri, > > On 4/30/2020 7:48 PM, John Garry wrote: > > On 30/04/2020 12:15, Jiri Olsa wrote: > > > > + > > > > > On Thu, Apr 30, 2020 at 09:54:18AM +0100, John Garry wrote: > > > > On 30/04/2020 09:45, 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 > > > > > > > > Hi jirka, > > > > > > > > JFYI, this is effectively the same patch as I mentioned to you, which was a > > > > fix for the same WARN: > > > > > > > > https://lore.kernel.org/linux-arm-kernel/1587120084-18990-2-git-send-email-john.garry@huawei.com/ > > > > > > > > > > > > but I found that it "fixed" d4953f7ef1a2 ("perf parse-events: Fix 3 use > > > > after frees found with clang ASANutil/parse-events.c"), based on bisect > > > > breakage > > > > > > hum right.. sorry I did not recalled that, there's > > > also the warn removal in here, could you guys also > > > plz sync on the fixes clauses? > > > > I just thought that it fixes d4953f7ef1a2, as I found that the pointer > > equality fails from that commit. I assume the parse-events code was > > sound before then (in that regard). That's all I know :) > > > > Thanks! > > > > For 3cdc5c2cb924a, I just think it should use strcmp for pmu_name comparison > rather than using pointer. But I'm OK to add d4953f7ef1a2 in fixes clauses. > :) So, I'm keeping Ian's patch, as I just applied it, and replaced the fixes clause to: Fixes: d4953f7ef1a2 ("perf parse-events: Fix 3 use after frees found with clang ASAN") Would this be ok? Or does John's fix has something else in it (I haven't checked). - Arnaldo