Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp373215rwb; Thu, 1 Dec 2022 03:22:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4kYcR6Tvop8OqFqNbgD68s25jM3R6jXwEPe17ibjaneN33bZsK6hfeWb+wqiF21tcxwnwI X-Received: by 2002:aa7:87c7:0:b0:562:a27a:4a84 with SMTP id i7-20020aa787c7000000b00562a27a4a84mr49072499pfo.50.1669893756745; Thu, 01 Dec 2022 03:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669893756; cv=none; d=google.com; s=arc-20160816; b=hS7cBIWaniefCdcQu7Y+Zm8jQQjUdK5dvMOdqWVooi2kYdyrNwqQud4CPoFKNwWhvy Qp3oIvqrtQiBY0/RZtbrh8Fp/dTX3MB3HUtcV+m42D2epUvC5+rQeIe29ZDK696QTH26 jnZmUbIx7LKvlCOly17BIww+vq3JJ4RjOvirpsAJ0170AklMZR4GqLbTyDKRgaFkTy2b YFzRRsphfhgWZX2yUnQRaeZTgBGZHpU5DysdOAfz+gCJZh0iBlVbuFY6qsgXplu7QnD+ y+6bfjYTU5s2uDojScbMC1KfcCVsdy7SUZduWN3BpVMW2QmC3/LotF9/pCq35lr85Sxn r4sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=ufHwKzEMEH8aF1qxh8z0jHVGQpifflOc5DCKt7ijvoM=; b=c0xupHZzDLpz5hQEQWGQRTHGYUMNb8NGly2hcZn8Sxu9GUT6Czu7fmDbLKackM0YVc ZIJwEYzWKx16i4pKXHEm7GI6SbZdj8AB1z1L577x6v9msCqtBI6q0PbDs8hzkKYrL7Jp WcDIRbgBlv9RzNPR/6QRL9f52/L2+dM9pP6HrNwdbDc58airji5G0zYj51Kjm/Vdo+Mw jVzYKVRgEGnvpXvafbaHv6hq9zcxixCXq/Fc5DdXTgzbeeNKQExWsHMbFzdBkt0PlMMu jS19QKaIqjK9XYtwRi3mPJvlC5rBz8Qge0pUbAapsbuxUkSlRZ1lp5cr2eNfxlhH3Pq2 hvFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a63d207000000b0046fabcb7bacsi3865397pgg.823.2022.12.01.03.22.25; Thu, 01 Dec 2022 03:22:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbiLALPA (ORCPT + 82 others); Thu, 1 Dec 2022 06:15:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiLALOY (ORCPT ); Thu, 1 Dec 2022 06:14:24 -0500 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D17FC25EB9; Thu, 1 Dec 2022 03:08:42 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R601e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=renyu.zj@linux.alibaba.com;NM=0;PH=DS;RN=20;SR=0;TI=SMTPD_---0VW8ayfo_1669892916; Received: from 30.221.148.106(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VW8ayfo_1669892916) by smtp.aliyun-inc.com; Thu, 01 Dec 2022 19:08:38 +0800 Message-ID: <1a7fc9da-2589-1835-716f-d52027f0ecda@linux.alibaba.com> Date: Thu, 1 Dec 2022 19:08:33 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH v3 5/6] perf vendor events arm64: Add PE utilization metrics for neoverse-n2 To: Ian Rogers Cc: John Garry , Xing Zhengjun , Will Deacon , James Clark , Mike Leach , Leo Yan , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andrew Kilroy , Shuai Xue , Zhuo Song References: <1668411720-3581-1-git-send-email-renyu.zj@linux.alibaba.com> <1669310088-13482-1-git-send-email-renyu.zj@linux.alibaba.com> <1669310088-13482-6-git-send-email-renyu.zj@linux.alibaba.com> From: Jing Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/12/1 上午2:58, Ian Rogers 写道: > On Thu, Nov 24, 2022 at 9:15 AM Jing Zhang wrote: >> >> Add PE utilization related metrics. >> >> Signed-off-by: Jing Zhang >> --- >> .../arch/arm64/arm/neoverse-n2/metrics.json | 45 ++++++++++++++++++++++ >> 1 file changed, 45 insertions(+) >> >> diff --git a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json >> index 23c7d62..7b54819 100644 >> --- a/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json >> +++ b/tools/perf/pmu-events/arch/arm64/arm/neoverse-n2/metrics.json >> @@ -189,5 +189,50 @@ >> "MetricGroup": "Branch", >> "MetricName": "branch_miss_pred_rate", >> "ScaleUnit": "100%" >> + }, >> + { >> + "MetricExpr": "instructions / CPU_CYCLES", >> + "PublicDescription": "The average number of instructions executed for each cycle.", >> + "BriefDescription": "Instructions per cycle", >> + "MetricGroup": "PEutilization", >> + "MetricName": "ipc" >> + }, > > A related useful metric is percentage of peak, so if the peak IPC is 8 > (usually a constant related to the number of functional units) then > you can just compute the ratio of IPC with this. > Glad to discuss these with you. The peak ipc value of neoverse-n2 is 5. Maybe I should add an ipc_rate metric? >> + { >> + "MetricExpr": "INST_RETIRED / CPU_CYCLES", >> + "PublicDescription": "Architecturally executed Instructions Per Cycle (IPC)", >> + "BriefDescription": "Architecturally executed Instructions Per Cycle (IPC)", > > > The duplicated descriptions are unnecessary. Drop the public one for > consistency with what we do for Intel: > https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.py#L299 > Sounds good, will do. >> + "MetricGroup": "PEutilization", >> + "MetricName": "retired_ipc" >> + }, >> + { >> + "MetricExpr": "INST_SPEC / CPU_CYCLES", >> + "PublicDescription": "Speculatively executed Instructions Per Cycle (IPC)", >> + "BriefDescription": "Speculatively executed Instructions Per Cycle (IPC)", >> + "MetricGroup": "PEutilization", >> + "MetricName": "spec_ipc" >> + }, >> + { >> + "MetricExpr": "OP_RETIRED / OP_SPEC", >> + "PublicDescription": "Fraction of operations retired", >> + "BriefDescription": "Fraction of operations retired", > > Would instructions be clearer than operations here? > operation and instruction are different. OP_RETIRED counts any operation (not instruction) that has been architecturally executed, For example, speculatively executed operations that have been abandoned for a branch mispredict will not be counted. So I think operation might be more accurate. >> + "MetricGroup": "PEutilization", >> + "MetricName": "retired_rate", >> + "ScaleUnit": "100%" >> + }, >> + { >> + "MetricExpr": "1 - OP_RETIRED / OP_SPEC", > > Should OP_RETIRED be greater than OP_SPEC? In which case won't this > metric be negative? > OP_RETIRED will not be greater than OP_SPEC. OP_SPEC counts any operation that has been speculatively executed. OP_SPEC is a superset of the OP_RETIRED event. There is a description about OP_SPEC and OP_RETIRED in this neoverse-n2 document. Link: https://documentation-service.arm.com/static/62cfe21e31ea212bb6627393?token= >> + "PublicDescription": "Fraction of operations wasted", >> + "BriefDescription": "Fraction of operations wasted", >> + "MetricGroup": "PEutilization", >> + "MetricName": "wasted_rate", >> + "ScaleUnit": "100%" >> + }, >> + { >> + "MetricExpr": "OP_RETIRED / OP_SPEC * (1 - (STALL_SLOT - CPU_CYCLES) / (CPU_CYCLES * 5))", >> + "PublicDescription": "Utilization of CPU", >> + "BriefDescription": "Utilization of CPU", > > Some more detail in the description would be useful. > Ok, I'll describe it in more detail. CPU_utilization reflects the truly effective ratio of operation executed by the CPU, which means that misprediction and stall are not included. Note that stall_slot minus cpu_cycles is a correction to the stall_slot error count. >> + "MetricGroup": "PEutilization", >> + "MetricName": "cpu_utilization", >> + "ScaleUnit": "100%" >> } >> ] >> -- >> 1.8.3.1 >>