From patchwork Wed Mar 3 15:22:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 12114457 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=-11.8 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,URIBL_BLOCKED,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 1AF5DC433E0 for ; Wed, 3 Mar 2021 22:52:52 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B406D64EF9 for ; Wed, 3 Mar 2021 22:52:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B406D64EF9 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+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=desiato.20200630; 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=5xogJWlL+MrMZtnB/BZrKD+RHhpcHHm2BfuvDtmt5xE=; b=EaZViIEuLDLrpiVNHgqUlQsSXl 1tdfEQo1fSr1xlnhoDKVweDb/nrXdInhiOwTcg2KER3S8uvDZQv+Tpa5EV+MnF5rEcgSGLOQP6+U/ fXIDvDYDVjA2Z7+h9/fh1ip4EpbCofNkNVlyM4LO+QCUuMgNGAiu77VE/aXjGi82Leb2GYGTQDPGs mUT6hI9gMDzjbLy2RZxrPfTIa8TtRau5kkJ/Rs6/U7hQ6RqM8rKaYKz3GItpqLpmxWjl6ld941rbR B0XqJAzHpsnhtwg0Edl5GNlZwRbNbH49QnttNemhX9xMZpnUNg8yiYQ+/LjX5W4ncjg/B1+f+PS4J WabDH16w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHaJF-006oBz-Ma; Wed, 03 Mar 2021 22:49:38 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHTOi-005Nac-KU for linux-arm-kernel@lists.infradead.org; Wed, 03 Mar 2021 15:26:52 +0000 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DrHqV3Qknz16Fyj; Wed, 3 Mar 2021 23:24:54 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Wed, 3 Mar 2021 23:26:27 +0800 From: John Garry To: , , , , , , , , , CC: , , , , , , , John Garry Subject: [PATCH 0/5] perf arm64 metricgroup support Date: Wed, 3 Mar 2021 23:22:13 +0800 Message-ID: <1614784938-27080-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-CFilter-Loop: Reflected 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 This series contains support to get basic metricgroups working for arm64 CPUs. Initial support is added for HiSilicon hip08 platform. Some sample usage on Huawei D06 board: $ ./perf list metric List of pre-defined events (to be used in -e): Metrics: bp_misp_flush [BP misp flush L3 topdown metric] branch_mispredicts [Branch mispredicts L2 topdown metric] core_bound [Core bound L2 topdown metric] divider [Divider L3 topdown metric] exe_ports_util [EXE ports util L3 topdown metric] fetch_bandwidth_bound [Fetch bandwidth bound L2 topdown metric] fetch_latency_bound [Fetch latency bound L2 topdown metric] fsu_stall [FSU stall L3 topdown metric] idle_by_icache_miss $ sudo ./perf stat -v -M core_bound sleep 1 Using CPUID 0x00000000480fd010 metric expr (exe_stall_cycle - (mem_stall_anyload + armv8_pmuv3_0@event\=0x7005@)) / cpu_cycles for core_bound found event cpu_cycles found event armv8_pmuv3_0/event=0x7005/ found event exe_stall_cycle found event mem_stall_anyload adding {cpu_cycles -> armv8_pmuv3_0/event=0x7001/ mem_stall_anyload -> armv8_pmuv3_0/event=0x7004/ Control descriptor is not initialized cpu_cycles: 989433 385050 385050 armv8_pmuv3_0/event=0x7005/: 19207 385050 385050 exe_stall_cycle: 900825 385050 385050 mem_stall_anyload: 253516 385050 385050 Performance counter stats for 'sleep': 989,433 cpu_cycles # 0.63 core_bound 19,207 armv8_pmuv3_0/event=0x7005/ 900,825 exe_stall_cycle 253,516 mem_stall_anyload 0.000805809 seconds time elapsed 0.000875000 seconds user 0.000000000 seconds sys perf stat --topdown is not supported, as this requires the CPU PMU to expose (alias) events for the TopDown L1 metrics from sysfs, which arm does not do. To get that to work, we probably need to make perf use the pmu-events cpumap to learn about those alias events. John Garry (5): perf metricgroup: Support printing metrics for arm64 perf metricgroup: Support adding metrics for arm64 perf vendor events arm64: Add Hisi hip08 L1 metrics perf vendor events arm64: Add Hisi hip08 L2 metrics perf vendor events arm64: Add Hisi hip08 L3 metrics .../arch/arm64/hisilicon/hip08/metrics.json | 233 ++++++++++++++++++ tools/perf/util/metricgroup.c | 27 +- 2 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json