From nobody Sun Feb 8 22:48:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE3DC001DC for ; Sun, 23 Jul 2023 08:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbjGWIWj (ORCPT ); Sun, 23 Jul 2023 04:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjGWIWc (ORCPT ); Sun, 23 Jul 2023 04:22:32 -0400 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DCB910D3; Sun, 23 Jul 2023 01:22:29 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0Vnzn8Vv_1690100543; Received: from srmbuffer011165236051.sqa.net(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0Vnzn8Vv_1690100543) by smtp.aliyun-inc.com; Sun, 23 Jul 2023 16:22:24 +0800 From: Jing Zhang To: John Garry , Ian Rogers Cc: Will Deacon , Mark Rutland , Robin Murphy , James Clark , Mike Leach , Leo Yan , 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, linux-doc@vger.kernel.org, Zhuo Song , Jing Zhang , Shuai Xue Subject: [PATCH v4 2/4] perf jevents: Support more event fields Date: Sun, 23 Jul 2023 16:21:51 +0800 Message-Id: <1690100513-61165-3-git-send-email-renyu.zj@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690100513-61165-1-git-send-email-renyu.zj@linux.alibaba.com> References: <1690100513-61165-1-git-send-email-renyu.zj@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The usual event descriptions are "event=3Dxxx" or "config=3Dxxx", while the event descriptions of CMN are "type=3Dxxx, eventid=3Dxxx" or more complex. $cat /sys/bus/event_source/devices/arm_cmn_0/events/hnf_cache_fill type=3D0x5,eventid=3D0x3 When adding aliases for events described as "event=3Dxxx" or "config=3Dxxx", EventCode or ConfigCode can be used in the JSON files to describe the events. But "eventid=3Dxxx, type=3Dxxx" cannot be supported at present. If EventCode and ConfigCode is not added in the alias JSON file, the event description will add "event=3D0" by default. So, even if the event field is added to supplement "eventid=3Dxxx" and "type=3Dxxx", the final parsing result will be "event=3D0, eventid=3Dxxx, type=3Dxxx". Therefore, when EventCode and ConfigCode are missing in JSON, "event=3D0" is no longer added by default. EventidCode and Type are added to the event field, and ConfigCode is moved into the event field. Signed-off-by: Jing Zhang --- tools/perf/pmu-events/jevents.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jeven= ts.py index 2bcd07c..79c3cfa 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -259,12 +259,6 @@ class JsonEvent: } return table[unit] if unit in table else f'uncore_{unit.lower()}' =20 - eventcode =3D 0 - if 'EventCode' in jd: - eventcode =3D int(jd['EventCode'].split(',', 1)[0], 0) - if 'ExtSel' in jd: - eventcode |=3D int(jd['ExtSel']) << 8 - configcode =3D int(jd['ConfigCode'], 0) if 'ConfigCode' in jd else None self.name =3D jd['EventName'].lower() if 'EventName' in jd else None self.topic =3D '' self.compat =3D jd.get('Compat') @@ -297,7 +291,15 @@ class JsonEvent: if precise and self.desc and '(Precise Event)' not in self.desc: extra_desc +=3D ' (Must be precise)' if precise =3D=3D '2' else (' (= Precise ' 'event)') - event =3D f'config=3D{llx(configcode)}' if configcode is not None else= f'event=3D{llx(eventcode)}' + eventcode =3D None + if 'EventCode' in jd: + eventcode =3D int(jd['EventCode'].split(',', 1)[0], 0) + if 'ExtSel' in jd: + if eventcode is None: + eventcode =3D int(jd['ExtSel']) << 8 + else: + eventcode |=3D int(jd['ExtSel']) << 8 + event =3D f'event=3D{llx(eventcode)}' if eventcode is not None else No= ne event_fields =3D [ ('AnyThread', 'any=3D'), ('PortMask', 'ch_mask=3D'), @@ -307,10 +309,14 @@ class JsonEvent: ('Invert', 'inv=3D'), ('SampleAfterValue', 'period=3D'), ('UMask', 'umask=3D'), + ('ConfigCode', 'config=3D'), + ('EventIdCode', 'eventid=3D'), + ('Type', 'type=3D'), + ('OccupId', 'occupid=3D'), ] for key, value in event_fields: if key in jd and jd[key] !=3D '0': - event +=3D ',' + value + jd[key] + event =3D event + ',' + value + jd[key] if event is not None else = value + jd[key] if filter: event +=3D f',{filter}' if msr: --=20 1.8.3.1