Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6392410rwl; Mon, 9 Jan 2023 07:49:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXuiRELc4gY7TxGBcowHuRrsVRyyf3fa5DFT/pzaQGv5sZGDEJzU2usaes/VTXoyJdXfVLWs X-Received: by 2002:a05:6402:646:b0:499:b582:8414 with SMTP id u6-20020a056402064600b00499b5828414mr3904489edx.8.1673279372370; Mon, 09 Jan 2023 07:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673279372; cv=none; d=google.com; s=arc-20160816; b=ZvxmBcz7Ds7VF+edxRVSzwrFjLukxDHOyvcEFEPa7p0zWwNF8xpQOn4exzFLKeu36J gPLBffjnLOSZ/Hi2/si5xvm20+wyJrwIXyMd0PBtXX2PtDEudaAJWl9JfVfYJUNp7ZMQ yVSjJZIZW6u32PvtocH2s5Y+UxcX96d5VpoU08NKsKsCcbfhhvAPlBncxSHFjgboIELt A8pkau9l3dR5ZKSadAwujQE+nuMJyrGPe94v3W0xsYV6ECl5Ml306hiveLvs61R0DWjj yUWZfdpP+ehaN6herbxpLX/c5fGylMkvIJ1/1xryL979gI0lWXe+bZcov7UEoOxisHJg j39Q== 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:content-language:subject:user-agent:mime-version :date:message-id; bh=3m1IDkzRqeHnZfSNHsUuscZausYkM6X0InMcJ8Viiqs=; b=cTZ+ybIHVCdz1MSHJUZD3ZBzlhm4WVRRWO2TCJFwMPeS6AsGKUW2PAbc3ljp/iaiEo ep2VMtlLsmqYONpGrpHsqN8GP79NqhV/TqkpM3dYPexxCgyAVkKrVRtXes+ikjOVrjTW LTTZhpQySfFU7fMpk0f/NZ1NLLnOLxRXkj2Y1OBGZanOGRNwy4PTDfY6lDzQ/693crzy +VO0ItCcFdNibFLJbI2wKMhlPDl/uHmtdwCcWmNpNkfP3IkmDEnjOcGW4gsmR/+uAwA+ 6uy18+NPy3bTq0MlynchpTQpFSLENogugNZq8Fw7x9zt0mWao5IfG6/fKoE0cL9zLTRe f27A== 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ae10-20020a17090725ca00b007c1852c08f0si10365314ejc.658.2023.01.09.07.49.09; Mon, 09 Jan 2023 07:49:32 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236470AbjAIPjv (ORCPT + 53 others); Mon, 9 Jan 2023 10:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237535AbjAIPjJ (ORCPT ); Mon, 9 Jan 2023 10:39:09 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B670261473; Mon, 9 Jan 2023 07:35:36 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB57C1042; Mon, 9 Jan 2023 07:35:43 -0800 (PST) Received: from [10.57.37.91] (unknown [10.57.37.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 113593F587; Mon, 9 Jan 2023 07:34:58 -0800 (PST) Message-ID: Date: Mon, 9 Jan 2023 15:34:57 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v5 1/6] perf vendor events arm64: Add topdown L1 metrics for neoverse-n2 Content-Language: en-US To: John Garry , Ian Rogers , Jing Zhang Cc: Xing Zhengjun , Will Deacon , 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: James Clark 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=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 06/01/2023 10:14, John Garry wrote: > 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 ???? > > 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. > I wonder if it would be worthwhile and even more generic to add some sort of int containing file accessor construct. It could also have support for a default value when the file doesn't exist. For example: "MetricExpr": "ITLB / {file:///caps/slots(5)}" It gets a bit fiddly because you might want to support absolute paths and paths relative to whatever PMU is being used. But it could prevent having to add some custom identifier and glue code for every possible file that just has an integer in it. It also wouldn't be possible to support the case where the file has bitfields in it that need to be extracted, so maybe we shouldn't do it. James