Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp472082rwd; Thu, 8 Jun 2023 03:30:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KJ/9cAf4ijhTfhaIy3a4kh4vsJi9rPxzGUjMPEciF7OXOQDFzEasDp3PPLxB+i4K9SJ9R X-Received: by 2002:a05:6a20:e30a:b0:10c:1b38:c8a4 with SMTP id nb10-20020a056a20e30a00b0010c1b38c8a4mr2974322pzb.31.1686220215749; Thu, 08 Jun 2023 03:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686220215; cv=none; d=google.com; s=arc-20160816; b=BEs3mqKeoKI1MSQtSwF7Hf1G+x9BcEnam8bqnum/DrDRcTg2JQc9v5QerydJIpDag9 BrGDIS/F/qQ0C1igXiXehGxBuXguFOLKDn00zmcR2fK4Ng5sAhuI3+Zv6m+xQxQ7T25S D2QdWuCvF9aBWDK73zMyJ+5VDzZWKqmPdsTp6dgsbVz47qVA3l3LQXN7LLcuiYGeKBbT PQld8HuhPqgqFn7j8vVK/lau9A3lhr25TPmR3R/fd9PEdfMKrJ28a8KB/mNDLCZCPoLA +XLbTR9R6grsehINM7/ccqYWcLL4chaup5HRNAQGe3i4vSQl6CPSKhJ+aawS1FOyh+hI 849A== 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=weZ8a4nQ+bLDfmu0ZMpJGDSa6sWf2YlbEoa9qm2nWyM=; b=T6qdOUU5t2KM0NeykwHxFel3aitc/+ufT2/aSfcbeshWSYqIJPh2AlVfdL/3OBW8lz Uc0/GslUML9cEmrrb/p3Qnzz6GimElf6nmxJ0XasmsxQTwCgcNH1yL3fDbA3tfyLJTz8 UONi4r1m4s5x29bFSL9m0y1+qjy77EU8mrGOBOmFzlb16dJ7cUUGFqPny9QGAArZ7iV9 cDzc7wd6nQiVIuKChIlB2UpMHQm+UepDMTVSepUmNdu3Zwtf3YNzJNDo3JLnjWCWLudw 91vWZbXaK7F09GRA68S1AdtWOIQcUU4Zj7yhbw1r1qkxkuZbKC5A722WCR61d8HZY9iv StNQ== 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 h185-20020a6383c2000000b0053b64127cddsi813220pge.212.2023.06.08.03.30.03; Thu, 08 Jun 2023 03:30:15 -0700 (PDT) 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 S235248AbjFHKLT (ORCPT + 99 others); Thu, 8 Jun 2023 06:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234655AbjFHKLR (ORCPT ); Thu, 8 Jun 2023 06:11:17 -0400 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6431D1FDF; Thu, 8 Jun 2023 03:11:12 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0VkdrSLm_1686219066; Received: from 30.221.148.215(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VkdrSLm_1686219066) by smtp.aliyun-inc.com; Thu, 08 Jun 2023 18:11:07 +0800 Message-ID: <770b7f48-2a5a-1c1b-b26d-bb0cfc3a1b46@linux.alibaba.com> Date: Thu, 8 Jun 2023 18:11:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 2/7] perf metric: Event "Compat" value supports matching multiple identifiers To: Robin Murphy Cc: James Clark , Mike Leach , Leo Yan , Mark Rutland , Ilkka Koskinen , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Zhuo Song , Ian Rogers , Will Deacon , Shuai Xue , John Garry References: <1685438374-33287-1-git-send-email-renyu.zj@linux.alibaba.com> <1685438374-33287-3-git-send-email-renyu.zj@linux.alibaba.com> <452e724b-2a2c-52fd-274b-60db7a7f730e@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.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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/6/7 上午12:27, Robin Murphy 写道: > On 02/06/2023 5:20 pm, John Garry wrote: >> On 01/06/2023 09:58, Jing Zhang wrote: >>>>  From checking the driver, it seems that we have model names "arm_cmn600" and "arm_cmn650". Are you saying that "arm_cmn600X" would match for those? I am most curious about how "arm_cmn600X" matches "arm_cmn650". >>>> >>> Hi John, >>> >>>  From patch #1 we have identifiers "arm_cmn600_0" and "arm_cmn650_0" etc. >> >> ok, I see. Your idea for the cmn driver HW identifier format is odd to me. Your HW identifier is a mix of the HW IP model name (from arm_cmn_device_data.model_name) with some the kernel revision identifier (from cmn_revision). The kernel revision identifier is an enum, and I don't think that it is a good idea to expose enum values through sysfs files. >> >> I assume that there is some ordering requirement for cmn_revision, considering that we have equality operations on the revision in the driver. > > That enum does actually follow the revision identifiers as provided by the hardware (see CMN_CFGM_PID2_REVISION), so I don't see any major issue with putting it into user ABI. And TBH I think I would prefer to just use a numeric value rather than have to maintain yet more tables of strings which given the usage model here would effectively only mangle a matchable value into a different matchable value anyway. > > I am inclined to agree that the mix between part driver-generated-string, part hardware-value looks a little funky. I still need to check with the hardware team exactly how the part number field from PERIPH_ID_0/1 is "configuration-dependent", and whether there might actually be a chance of using that as well. > Thanks Robin. So should we wait to confirm the configuration of the PERIPH_ID_0/1 field before pushing this patch? Or is it acceptable to use "cmn600_r0p0" as an identifier? Looking forward to your suggestion. > One nagging doubt that remains for metrics are any baked-in assumptions which may not always simply depend on the product version - for instance it happens to be the case currently that everything has a fixed flit size of 256 bits, hence the magic "32" in the bandwidth calculations, but if that ever became configurable in some future product, we may potentially have a problem guaranteeing a meaningful calculation. > In this case, we may use "literal" to solve it later. It can use variables in bandwidth calculations. For example, "#slots" can get the value from the file of the current architecture and use it in the metric. >>> The identifier consists of model_name and revision. >>> The compatible value "arm_cmn600;arm_cmn650" can match the identifier "arm_cmn600_0" or "arm_cmn650_0". Maybe the message log >>> is not clear enough. >>> >>> For example in patch #3 the metric "slc_miss_rate" is a generic metric for cmn-any. So we can define: >>> >>> +    { >>> +        "MetricName": "slc_miss_rate", >>> +        "BriefDescription": "The system level cache miss rate include.", >>> +        "MetricGroup": "arm_cmn", >>> +        "MetricExpr": "hnf_cache_miss / hnf_slc_sf_cache_access", >>> +        "ScaleUnit": "100%", >>> +        "Unit": "arm_cmn", >>> +        "Compat": "arm_cmn600;arm_cmn650;arm_cmn700;arm_ci700" >>> +    }, >>> >>> >>> It can match identifiers "arm_cmn600_{0,1,2..X}" or "arm_cmn650_{0,1,2..X}" or "arm_cmn700_{0,1,2..X}" or "arm_ci700_{ 0,1,2..X}". >>> In other words, it can match all identifiers prefixed with “arm_cmn600” or “arm_cmn650” or “arm_cmn700” or “arm_ci700”. >>> >>> If a new model arm_cmn driver with identifier "arm_cmn750_0", it will not be matched, but if a new revision arm_cmn driver with identifier >>> "arm_cmn700_4", it can be matched. >> >> OK, I see what you mean. My confusion came about though your commit message on this same patch, which did not mention cmn650. I assumed that the example event which you were describing was supported for arm_cmn650 and you intentionally omitted it. >> >>> >>> >>>>> Tokens in Unit field are delimited by ';'. >>>> Thanks for taking a stab at solving this problem. >>>> >>>> I have to admit that I am not the biggest fan of having multiple values to match in the "Compat" value possibly for every event. It doesn't really scale. >>>> >>>> I would hope that there are at least some events which we are guaranteed to always be present. From what Robin said on the v2 series, for the implementations which we care about, events are generally added per subsequent version. So we should have some base set of fixed events. > > Note that there's a slight difference between "present" and "valid", e.g. in the current driver-internal aliases, all MTSX events are marked CMN_ANY, meaning they're considered valid on any CMN configuration with an MTSX node, regardless of model. The events don't exist on CMN-600 or CMN-650, but that's because the MTSX itself wasn't a thing yet, so for simplicity we don't have to bother considering the events invalid when we know they will always be non-present and thus filtered anyway. > >>>> If we are confident that we have a fixed set of base set of events, can we ensure that those events would not require this compat string which needs each version explicitly stated? >>>> >>> If we are sure that some events will always exist in subsequent versions, we can set the Compat field to "arm_cmn;arm_ci". After that, >>> whether it is a different model or a different revision of the cmn PMU, it will be compatible. That is, it matches all whose identifier >>> is prefixed with “arm_cmn” or “arm_ci”. >> >> Sure, we could do something like that. Or if we are super-confident that every model and rev will support some event, then we can change perf tool to just not check Compat for that event. > > The majority of events have stayed unchanged since the introduction of their respective node type, so assuming we already have a basic match on the PMU name to know which JSON to be looking at in the first place, I'd imagine the Compat field could be optional, and only needed for events which first appear in a subsequent revision or model, or the fiddly cases like where DVM node events got entirely rewritten in CMN-650. > OK, thanks. Maybe we first need to confirm how to set the identifier format in the driver. Then it will be clearer how to implement Compat matching. Thanks, Jing