Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2176392rwl; Fri, 6 Jan 2023 03:01:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtH1EWXksdBAaUWeyWyN0qQRGvdAtpshgv7IDpgwqzP8T0ZT/t6OajfB8pFJf5T0KukkCRD X-Received: by 2002:a05:6a20:499d:b0:b2:5a0f:605c with SMTP id fs29-20020a056a20499d00b000b25a0f605cmr59971999pzb.50.1673002886382; Fri, 06 Jan 2023 03:01:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673002886; cv=none; d=google.com; s=arc-20160816; b=B1BKpbiETnd37rXr53q1Rgaze+eeWpbd3sHhlDrvvr+gwmWy+MTmGaIZ+O3zV5RRK4 mIBdiwZzHwiBAc1B4LOsssGye7iOgWEHZhdETde9YfjyrX/D1wzQikj08lX1BdnmA9Cs 5JcVNA63zUk0LX0FRUzORZaUZKhoXNGDsJ6xjRvrUYyU7UY+8k+VwLjC0yIC5G61w10E ouTkiGEYVPgQpuxaWrGrekijwK8QsgRRZf/qcs6oDdDuy7zGNwBilM2WZC4Zwu8xuV0H gZehgUEmpP8jtmWdKJY8cyDUjsONtV2Gil8P7p0BXjQztV8zv29rcakTalcjXG7bdIYI GURQ== 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=NbuL5o88848kMoTQ+zGMkiDG/cGFwlhC7IzbtH0515w=; b=tEflkcTQW+8FAtqmaHPW3sQyQ9cuNqBt+iTninjciPX1qYFa6ePZ8rk7qm5kX3/skH EwCX0yAugEAhLuEYkBfvULf8m/jeH2KWGuYQicxMxxHxfZjNLqIIT/DICYjULyiEoTyI ppdHlGe5g6b09oTrOFKX8wMTyQpk6PS5pIdNxc/vX8/zHfJXU6YqeKyLCndBdZzX1mSm n7fZc6b9oRn6ZMhtJitJjeHOf0KFNsxzJ07K337EHfJjGgrYnUItHeRfU2VfQiXeIC1V o+rQEKcgNOGhuAGGUqmXEH042SuElNKZ6gkSjSq0xF5e84vDj26JamYmdXYPMpOfu+k1 lOnA== 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 b9-20020a63d809000000b0047895cb23d2si1096573pgh.646.2023.01.06.03.01.19; Fri, 06 Jan 2023 03:01:26 -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 S230047AbjAFKer (ORCPT + 54 others); Fri, 6 Jan 2023 05:34:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbjAFKep (ORCPT ); Fri, 6 Jan 2023 05:34:45 -0500 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB9D69B37; Fri, 6 Jan 2023 02:34:43 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0VZ--e1q_1673001277; Received: from 30.221.147.58(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VZ--e1q_1673001277) by smtp.aliyun-inc.com; Fri, 06 Jan 2023 18:34:39 +0800 Message-ID: <7c85c49d-ce6c-cadb-dea3-56dbfa43086c@linux.alibaba.com> Date: Fri, 6 Jan 2023 18:34:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v5 1/6] perf vendor events arm64: Add topdown L1 metrics for neoverse-n2 To: John Garry , Ian Rogers Cc: 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: <1672745976-2800146-1-git-send-email-renyu.zj@linux.alibaba.com> <1672745976-2800146-2-git-send-email-renyu.zj@linux.alibaba.com> <5c5716e5-b2ff-67cd-b608-4eeffa7e04bc@oracle.com> <1f3d53cb-4160-e29d-3934-d6a488d9fd49@linux.alibaba.com> <7aa225df-af25-a6be-9bef-c965488ba43a@oracle.com> <00bf227a-75ce-c63c-c740-89b8d2b27e1c@oracle.com> <6971b848-2754-6909-d36b-ea80fe157e95@oracle.com> From: Jing Zhang In-Reply-To: <6971b848-2754-6909-d36b-ea80fe157e95@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 在 2023/1/6 下午6:14, John Garry 写道: > On 05/01/2023 21:13, Ian Rogers wrote: >>>> This may be a feasible idea. The value of slots comes from the register PMMIR_EL1, which I can read in >>>> /sys/bus/event_source/device/armv8_pmuv3_*/caps/slots. But how do I replace the slots in MetricExpr with the >>>> read slots values? Currently I understand that parameters in metricExpr only support events and constants. >>>> >>> Maybe during runtime we could create a pseudo metric/event for SLOT. >> For Intel we do this by just having a different constant for each >> architecture. It is fairly easy to add a new "literal", so you could >> add a #slots in expr__get_literal: >> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/expr.c?h=perf*core*n407__;LyM!!ACWV5N9M2RV99hQ!IHcZFuFaLdQDQvVOnHVlbbME2S4aW8GohWUkydlejpi7ifFz61r7RutGXReRt0d88X_vDfkTySCiuD2PqOA$  Populating it would be the challenge ???? Yes! I was thinking the same as you, I found this method from the SMT_on variable in icl_metrics.json, then I tried it and it worked, so excited! > > Thanks for the pointer. I think that the challenge in populating it really comes down to whether we would really want to make this generic. > > I suppose that for arm64 we could have a method which accesses this PMMIR_EL1 register, while for other archs we could have a weak function which just returns NAN. If other archs want to use this key expr, they can add their own method. > Now I have to use this method, because I just found out that neoverse-n2 has been changed to neoverse-n2-v2, merging n2 and v2. The slots of n2 are 5, and the slots of v2 are 8. I will release the v6 patch and put the metric in the sbsa.json file. The metrics in sbsa.json is only applicable to arm64, so even if x86 cannot get the slots value, there will be no conflict. > Out of curiosity, do you know if x86 has such a capability to get this slot info from HW? >