From patchwork Thu Sep 16 12:34:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 12498971 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=-12.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 99322C433F5 for ; Thu, 16 Sep 2021 12:41:23 +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 59D4360F6D for ; Thu, 16 Sep 2021 12:41:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 59D4360F6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ToKcwDggT3hjg3pJRCCyCJblTy1dPYE2++H+Ye3R1WI=; b=OF3ehPnyFdO0gg VTpDdsm/sraHnRw7yDV9XeOd0/4P2DExTKP3WSIEKZpYtYwbN6i/oeRxehTxCy/46wPEr/0HvjzJ5 0bN3218fBR00DlQvYihOZhUlKrRviqLrJbNx6iFW2DGi+JBrAPKRiyB9cZdrUTec9Nudk3n4tanD+ ZrKCx7XWayN2xjlX9gHzwlKm6/Enxw+eDEu9J1SoBfwusMNouh65uBhsOtumNqy0om4pCDaTGvIUO 2Wt141rtOikorTSq7svshb4kaRDpc74SOMgIjCkB/Q4RZ/tVVuvWViBMhO5Ve3B95knEvc61XQ/9Y uP9ZUgcHVMVZrmmNjw6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQqfy-00B7Ql-Ln; Thu, 16 Sep 2021 12:39:38 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQqfu-00B7On-V8 for linux-arm-kernel@lists.infradead.org; Thu, 16 Sep 2021 12:39:36 +0000 Received: from fraeml740-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H9Gmz2s5Wz67bGM; Thu, 16 Sep 2021 20:37:07 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml740-chm.china.huawei.com (10.206.15.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 14:39:23 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 13:39:19 +0100 From: John Garry To: , , , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH 0/5] Improve perf list support for hisi uncore PMUs Date: Thu, 16 Sep 2021 20:34:20 +0800 Message-ID: <1631795665-240946-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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-20210916_053935_343106_3ED7916A X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently event aliases are supported for HiSilicon uncore PMUs, such that we get events listed like the following: $perf list ... uncore ddrc: uncore_hisi_ddrc.act_cmd [DDRC active commands. Unit: hisi_sccl,ddrc] uncore_hisi_ddrc.flux_rcmd [DDRC read commands. Unit: hisi_sccl,ddrc] uncore_hisi_ddrc.flux_rd [DDRC total read operations. Unit: hisi_sccl,ddrc] uncore_hisi_ddrc.flux_wcmd ... However we still get the events listed from the PMUs event files, like: $perf list ... hisi_sccl1_ddrc0/act_cmd/ [Kernel PMU event] hisi_sccl1_ddrc0/flux_rcmd/ [Kernel PMU event] hisi_sccl1_ddrc0/flux_rd/ [Kernel PMU event] hisi_sccl1_ddrc0/flux_wcmd/ [Kernel PMU event] hisi_sccl1_ddrc0/flux_wr/ [Kernel PMU event] hisi_sccl1_ddrc0/pre_cmd/ [Kernel PMU event] hisi_sccl1_ddrc0/rnk_chg/ [Kernel PMU event] hisi_sccl1_ddrc0/rw_chg/ [Kernel PMU event] hisi_sccl1_ddrc1/act_cmd/ [Kernel PMU event] ... The list of events will include every event for every PMU in the sysfs event folder, so the list can be huge: $perf list | grep hisi_scc | wc -l 783 And it will get larger for the next gen of HiSi SoCs, which has more PMUs. Fortunately the perf PMU code can merge events when an alias with the same name exists. So renaming the events in the JSONs to remove the "uncore_hisi_XXX." prefix from the name to fully match the sysfs name will mean events are merged. The list will then not show the individual events per PMU, and rather just the aliases: $perf list ... uncore ddrc: act_cmd [DDRC active commands. Unit: hisi_sccl,ddrc] flux_rcmd [DDRC read commands. Unit: hisi_sccl,ddrc] flux_rd [DDRC total read operations. Unit: hisi_sccl,ddrc] flux_wcmd [DDRC write commands. Unit: hisi_sccl,ddrc] ... To get the stat for the event, just run something like this: $perf stat -v -e act_cmd sleep 1 Using CPUID 0x00000000480fd010 act_cmd -> hisi_sccl1_ddrc0/config=0x5/ act_cmd -> hisi_sccl3_ddrc1/config=0x5/ act_cmd -> hisi_sccl5_ddrc2/config=0x5/ act_cmd -> hisi_sccl7_ddrc3/config=0x5/ act_cmd -> hisi_sccl5_ddrc0/config=0x5/ Control descriptor is not initialized act_cmd: 0 1001546260 1001546260 act_cmd: 0 1001542780 1001542780 act_cmd: 0 1001531630 1001531630 act_cmd: 0 1001518570 1001518570 act_cmd: 0 1001527830 1001527830 Performance counter stats for 'system wide': 48,142 act_cmd 1.001518294 seconds time elapsed And to run for an individual PMU, run something like this: $perf stat -v -e hisi_sccl1_ddrc0/act_cmd/ sleep 1 hisi_sccl1_ddrc0/act_cmd/: 0 1000818310 1000818310 Performance counter stats for 'system wide': 0 hisi_sccl1_ddrc0/act_cmd/ 1.000827061 seconds time elapsed I expect that having the same event name for different types of PMUs may give unexpected results, so best to use -v option to verify the PMUs used are as expected. John Garry (5): perf parse-events: Set numeric term config perf jevents: Support ConfigCode perf test: Verify more event members in pmu-events test perf test: Add pmu-event test for event described as "config=" perf vendor events arm64: Revise hip08 uncore events .../arm64/hisilicon/hip08/uncore-ddrc.json | 32 ++--- .../arm64/hisilicon/hip08/uncore-hha.json | 120 +++++++++++++++--- .../arm64/hisilicon/hip08/uncore-l3c.json | 52 ++++---- .../arch/test/test_soc/sys/uncore.json | 7 + tools/perf/pmu-events/jevents.c | 13 +- tools/perf/tests/parse-events.c | 8 +- tools/perf/tests/pmu-events.c | 81 ++++++++++-- tools/perf/util/parse-events.c | 2 +- 8 files changed, 234 insertions(+), 81 deletions(-)