From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Garry Subject: Re: [PATCH 0/6] perf/imx_ddr: Add namespace for i.MX8 DDR Perf Date: Thu, 16 Apr 2020 17:10:20 +0100 Message-ID: <8341b035-2fac-52dd-45d1-2bf6f5ea4ba4@huawei.com> References: <20200222104621.2258-1-qiangqing.zhang@nxp.com> <2f81eb7a-a6e4-1cc6-cd0a-ca3d749bd552@huawei.com> <55836919-41b5-0834-f7a7-1a2a34535677@huawei.com> <0b3999b8-c307-6b4a-1a1b-e90b45f50b61@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane-mx.org@lists.infradead.org To: Joakim Zhang , irogers@google.com Cc: "mark.rutland@arm.com" , Zhangshaokun , "will@kernel.org" , Linuxarm , "acme@kernel.org" , "linux-perf-users@vger.kernel.org" , dl-linux-imx , Jiri Olsa , "linux-arm-kernel@lists.infradead.org" List-Id: linux-perf-users.vger.kernel.org + Ian (please check the patch at the bottom, thanks) On 16/04/2020 08:15, Joakim Zhang wrote: >> ? >> >> If that doesn't work, then I'll try this myself. > Hi John, > > It still cannot work with this code change. > So I got a SMMUv3 PMCG test metric working here: https://github.com/hisilicon/kernel-dev/commits/private-topic-perf-5.7-sys-pmu-events-v1-debug as follows: john@ubuntu:~/perf list metric List of pre-defined events (to be used in -e): Metrics: smmuv3_pmcg.fake [SMMUv3 PMCG fake metric] john@ubuntu:~/sudo ./perf stat -a -M smmuv3_pmcg.fake sleep 1 Performance counter stats for 'system wide': 531510 smmuv3_pmcg.transaction (49.90%) 124914193 smmuv3_pmcg.cycles (49.90%) 531331 smmuv3_pmcg.transaction (50.29%) 124879887 smmuv3_pmcg.cycles (50.29%) 531269 smmuv3_pmcg.transaction (50.45%) 124867388 smmuv3_pmcg.cycles (50.45%) 531372 smmuv3_pmcg.transaction (50.45%) 124896723 smmuv3_pmcg.cycles (50.45%) 531431 smmuv3_pmcg.transaction (50.12%) 124901700 smmuv3_pmcg.cycles (50.12%) 531574 smmuv3_pmcg.transaction (49.72%) 124924231 smmuv3_pmcg.cycles (49.72%) 531598 smmuv3_pmcg.transaction (49.56%) 124916914 smmuv3_pmcg.cycles (49.56%) 531440 smmuv3_pmcg.transaction (49.56%) 124902473 smmuv3_pmcg.cycles (49.56%) 1.001167246 seconds time elapsed So you can compare this to yours. I did have to fix what looks like a bug in mainline on that branch: --->8----- perf parse-events: Fix comparison of evsel and leader pmu name Since we now strdup() the pmu name for the event selector, use strcmp() instead of pointer equality for comparison. Fixes: d4953f7 ("perf parse-events: Fix 3 use after frees found with clang ASANutil/parse-events.c") Signed-off-by: John Garry --- tools/perf/util/parse-events.c @@ -1629,7 +1629,7 @@ 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; } ---8< Without it, I would get a spew of these: assertion failed at util/parse-events.c:1637 @Ian, does this change look right? I am not intimately familiar with that code. Thanks, John From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DC17C352BE for ; Thu, 16 Apr 2020 16:11:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7BEF20857 for ; Thu, 16 Apr 2020 16:11:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mxi2Q8i8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7BEF20857 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UmJYENNmFV12e5gcMXPa8RqXRjIoBUIWhIzOgXaPXK8=; b=mxi2Q8i8Er2VBL0iB2LNpt4iH preBxML0a3dNLfq0FRB7NcFxbdcs/1ms6p5NGA2c6zjFDPYpKpZFH8rq8tbUCUGTSC3bQK2MvKgxG J71ZixymG8osR/wPrpt2WrDDiDMSSSNzhsZV2U3A+HzpPdoVF/QcGhFbusD9X5CQQZ1dV+/euwFAE MzTvgAT6eUfVVN0YBYS+ROJ5ypNLtj4Gn5FZMXuBrnyFarF6PtylP0zI3WO0d/0pqRAaeYWK9pO9m nRXWnOm0OAFTkaP1NuoN3aJF/9fedkL5A4Wyh1cZaV2xWhWY8jX2xwy141Nj7uqYpXua8sPZ6mfhu Bt6xqBslg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP76f-00033P-4c; Thu, 16 Apr 2020 16:11:13 +0000 Received: from lhrrgout.huawei.com ([185.176.76.210] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP76c-00031j-7k for linux-arm-kernel@lists.infradead.org; Thu, 16 Apr 2020 16:11:12 +0000 Received: from lhreml724-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 3749EBF174D47BC31CD5; Thu, 16 Apr 2020 17:10:52 +0100 (IST) Received: from [127.0.0.1] (10.210.169.188) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Thu, 16 Apr 2020 17:10:51 +0100 Subject: Re: [PATCH 0/6] perf/imx_ddr: Add namespace for i.MX8 DDR Perf To: Joakim Zhang , References: <20200222104621.2258-1-qiangqing.zhang@nxp.com> <2f81eb7a-a6e4-1cc6-cd0a-ca3d749bd552@huawei.com> <55836919-41b5-0834-f7a7-1a2a34535677@huawei.com> <0b3999b8-c307-6b4a-1a1b-e90b45f50b61@huawei.com> From: John Garry Message-ID: <8341b035-2fac-52dd-45d1-2bf6f5ea4ba4@huawei.com> Date: Thu, 16 Apr 2020 17:10:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Originating-IP: [10.210.169.188] X-ClientProxiedBy: lhreml701-chm.china.huawei.com (10.201.108.50) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_091110_425034_561DF439 X-CRM114-Status: GOOD ( 11.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "mark.rutland@arm.com" , Zhangshaokun , "will@kernel.org" , Linuxarm , "acme@kernel.org" , "linux-perf-users@vger.kernel.org" , dl-linux-imx , Jiri Olsa , "linux-arm-kernel@lists.infradead.org" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org + Ian (please check the patch at the bottom, thanks) On 16/04/2020 08:15, Joakim Zhang wrote: >> ? >> >> If that doesn't work, then I'll try this myself. > Hi John, > > It still cannot work with this code change. > So I got a SMMUv3 PMCG test metric working here: https://github.com/hisilicon/kernel-dev/commits/private-topic-perf-5.7-sys-pmu-events-v1-debug as follows: john@ubuntu:~/perf list metric List of pre-defined events (to be used in -e): Metrics: smmuv3_pmcg.fake [SMMUv3 PMCG fake metric] john@ubuntu:~/sudo ./perf stat -a -M smmuv3_pmcg.fake sleep 1 Performance counter stats for 'system wide': 531510 smmuv3_pmcg.transaction (49.90%) 124914193 smmuv3_pmcg.cycles (49.90%) 531331 smmuv3_pmcg.transaction (50.29%) 124879887 smmuv3_pmcg.cycles (50.29%) 531269 smmuv3_pmcg.transaction (50.45%) 124867388 smmuv3_pmcg.cycles (50.45%) 531372 smmuv3_pmcg.transaction (50.45%) 124896723 smmuv3_pmcg.cycles (50.45%) 531431 smmuv3_pmcg.transaction (50.12%) 124901700 smmuv3_pmcg.cycles (50.12%) 531574 smmuv3_pmcg.transaction (49.72%) 124924231 smmuv3_pmcg.cycles (49.72%) 531598 smmuv3_pmcg.transaction (49.56%) 124916914 smmuv3_pmcg.cycles (49.56%) 531440 smmuv3_pmcg.transaction (49.56%) 124902473 smmuv3_pmcg.cycles (49.56%) 1.001167246 seconds time elapsed So you can compare this to yours. I did have to fix what looks like a bug in mainline on that branch: --->8----- perf parse-events: Fix comparison of evsel and leader pmu name Since we now strdup() the pmu name for the event selector, use strcmp() instead of pointer equality for comparison. Fixes: d4953f7 ("perf parse-events: Fix 3 use after frees found with clang ASANutil/parse-events.c") Signed-off-by: John Garry --- tools/perf/util/parse-events.c @@ -1629,7 +1629,7 @@ 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; } ---8< Without it, I would get a spew of these: assertion failed at util/parse-events.c:1637 @Ian, does this change look right? I am not intimately familiar with that code. Thanks, John _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel