Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2700489rwb; Mon, 7 Aug 2023 01:50:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDafCHfR24kMzds4/kHrGFrePnAvwT2r9A3l8416l+v2xumMc/xIV+fjFiHU6bLKC+3bma X-Received: by 2002:a17:90a:9e4:b0:269:55a2:952c with SMTP id 91-20020a17090a09e400b0026955a2952cmr2381212pjo.40.1691398224733; Mon, 07 Aug 2023 01:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691398224; cv=none; d=google.com; s=arc-20160816; b=aKzTKB4G6B96D90eYbBrsKIc3Ctuhv/QASllRHQHH7Kvi+TQzOmoUWGC7fOY6SwIeP XvSdhNHZ/rTWiVjlcTyFEPcQ7Ed+2kpdGu8DP8M9+huygYkoQq0G3OUy6dv9wAh9IYzT AEWD6TFFnl8GT7LXEDNRFx52+srZQNkAd3OnI4W2h0/4yecdiVuFSSOHHl5eME2dgtpx mP+mLLVL8wc7xanEVNcbXLTKbs93Bh4hgtoL34smArMTiWctFoRKWTCpDhhacaMdKda0 l519qTMnYf1oavu4E3chW6jAwc2FEvCte9Sg9f0v8pd2p2O8L+P+uhiszbo0u2zk0PJf uyww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=yB2vdpGxMK6B5kG62AU/YzIuE5xW0g9xoTVTHKGypyA=; fh=7pF9AUGuuVLtftwWy2EJKaooMcBit4LAHr6bHM40jlQ=; b=anmze111v12aKZ0Sfl13Hot6SKVIRpF4eYTfeTjAcATVmGmeQUXFc8lkJua8ChEwdb 0sDqnTT4CFDohi/F7gfDc9cCl6lmKsOomfQbjEueYwSN00Sz6G7OxF3PxN2Wk5Qj7EsX jelP7EvJthddrQ5cjBaidkeivNVvAhboYp0+l/Pfqx4i3sAMqrRvSPym1kTm6rCUoVNf tCLO41nJprEN6xKibTG+uZKxCfQ6qEA8f6ztmR07jmo0IsKb6110pV1UOo3dwbX97Y9X s+eVwrC647Wgwfx7tBQR5+sS2XdYBD376xbPIj3YMahKyjJCayb8QS5h2Pyp/zSmBXvq L1mA== 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 h184-20020a6383c1000000b0053fe93b2d33si5182880pge.201.2023.08.07.01.50.12; Mon, 07 Aug 2023 01:50:24 -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 S231278AbjHGHvs (ORCPT + 99 others); Mon, 7 Aug 2023 03:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbjHGHvo (ORCPT ); Mon, 7 Aug 2023 03:51:44 -0400 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8497510F4; Mon, 7 Aug 2023 00:51:42 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0VpC-045_1691394696; Received: from srmbuffer011165236051.sqa.net(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VpC-045_1691394696) by smtp.aliyun-inc.com; Mon, 07 Aug 2023 15:51:37 +0800 From: Jing Zhang To: John Garry , Ian Rogers Cc: Will Deacon , James Clark , Arnaldo Carvalho de Melo , Mark Rutland , Mike Leach , Leo Yan , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-doc@vger.kernel.org, Zhuo Song , Jing Zhang , Shuai Xue Subject: [PATCH v6 3/7] perf jevents: Support more event fields Date: Mon, 7 Aug 2023 15:51:21 +0800 Message-Id: <1691394685-61240-4-git-send-email-renyu.zj@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1691394685-61240-1-git-send-email-renyu.zj@linux.alibaba.com> References: <1691394685-61240-1-git-send-email-renyu.zj@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,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 The usual event descriptions are "event=xxx" or "config=xxx", while the event descriptions of CMN are "type=xxx, eventid=xxx" or more complex. $cat /sys/bus/event_source/devices/arm_cmn_0/events/hnf_cache_fill type=0x5,eventid=0x3 When adding aliases for events described as "event=xxx" or "config=xxx", EventCode or ConfigCode can be used in the JSON files to describe the events. But "eventid=xxx, type=xxx" cannot be supported at present. If EventCode and ConfigCode is not added in the alias JSON file, the event description will add "event=0" by default. So, even if the event field is added to supplement "eventid=xxx" and "type=xxx", the final parsing result will be "event=0, eventid=xxx, type=xxx". Therefore, when EventCode and ConfigCode are missing in JSON, "event=0" is no longer added by default. EventIdCode and Type are added to the event field, and ConfigCode is moved into the event_field array which can also guarantee its original function. Signed-off-by: Jing Zhang --- tools/perf/pmu-events/jevents.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py index f57a8f2..9c0f63a 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -275,12 +275,6 @@ class JsonEvent: } return table[unit] if unit in table else f'uncore_{unit.lower()}' - eventcode = 0 - if 'EventCode' in jd: - eventcode = int(jd['EventCode'].split(',', 1)[0], 0) - if 'ExtSel' in jd: - eventcode |= int(jd['ExtSel']) << 8 - configcode = int(jd['ConfigCode'], 0) if 'ConfigCode' in jd else None self.name = jd['EventName'].lower() if 'EventName' in jd else None self.topic = '' self.compat = jd.get('Compat') @@ -317,7 +311,15 @@ class JsonEvent: if precise and self.desc and '(Precise Event)' not in self.desc: extra_desc += ' (Must be precise)' if precise == '2' else (' (Precise ' 'event)') - event = f'config={llx(configcode)}' if configcode is not None else f'event={llx(eventcode)}' + eventcode = None + if 'EventCode' in jd: + eventcode = int(jd['EventCode'].split(',', 1)[0], 0) + if 'ExtSel' in jd: + if eventcode is None: + eventcode = int(jd['ExtSel']) << 8 + else: + eventcode |= int(jd['ExtSel']) << 8 + event = f'event={llx(eventcode)}' if eventcode is not None else None event_fields = [ ('AnyThread', 'any='), ('PortMask', 'ch_mask='), @@ -327,10 +329,13 @@ class JsonEvent: ('Invert', 'inv='), ('SampleAfterValue', 'period='), ('UMask', 'umask='), + ('ConfigCode', 'config='), + ('Type', 'type='), + ('EventIdCode', 'eventid='), ] for key, value in event_fields: if key in jd and jd[key] != '0': - event += ',' + value + jd[key] + event = event + ',' + value + jd[key] if event is not None else value + jd[key] if filter: event += f',{filter}' if msr: -- 1.8.3.1