Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp816690rwb; Thu, 27 Jul 2023 23:34:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlF0M1FAFq1kHNk2SN+11nsk3dG+3hSWw8NphIJT+bk3B9Xu8ksVer5Inyjw+dBlLhyw3v39 X-Received: by 2002:a17:902:9b94:b0:1b8:6cab:db7f with SMTP id y20-20020a1709029b9400b001b86cabdb7fmr662963plp.53.1690526040207; Thu, 27 Jul 2023 23:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690526040; cv=none; d=google.com; s=arc-20160816; b=u0MjjOXPwY0IHCKl1k81ZZz0FlMOF+G+0Czy9YT9jqkO9/O/iuOm9OC4UNWI7faqTs gi83NnByf2xkA56LuJQVsXCe3EOlkYqeC4ycR6Lwqlqw5VN//YV+zqcPC71JSq8gxM7v R15mKW7DzjSUcOnlrvcsq/hFL+KTPBNgHzU0PxflVBjZLgjZ2OYYam9b74q+7S4zkDHz XQVXkNXfIjDE0/m0ddKRZE/p2FMLWB/P/ihjox5GLkVPg+B1VkoyY6BfuHvUU5IBUN45 GHdifvhhADF5re2rerWGfjTaaZmyq3cUNHKnYTSI8y2/0yx6oMHKzW3JKX+BRtVUy2rT UWpw== 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=6JOIFq++GFBr55qsbUomW9uDlSkbtTxkzfQq3YEDQ7Q=; b=XGeyWJPDOf9SFH1k649wDS9gh5MaLDjr88oWPBP/0ClWRc08IBW2S0pkxDuCIbEjse YZqWE+mvWD4/V7tLp0IXm4bzzlRkS4H56IgHX7TUOKJSgwjd0nKF9bC61Pfs2Sg05oot XQahq25XxN3RZCWGRti6G16QtzpLUvRgjigviU1fLNMc7EoOzmDtii+DzDiWluBlkdkK NigrcAESHnOOnVieNCB/7Q9G7Vq5sz43kBZRmjzBmEt2nsM2NiUXwAca1p9Y71nzkGc4 TwxKSQ7LNfYH87hLzo60BOZ7XaYeRioPP8/vKMeTSLiRBopZjr4T8Jw2H1MoiNqgs/1N Jbew== 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 i2-20020a170902eb4200b001b87b17cfb4si287499pli.392.2023.07.27.23.33.48; Thu, 27 Jul 2023 23:34:00 -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 S233445AbjG1GRj (ORCPT + 99 others); Fri, 28 Jul 2023 02:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbjG1GRg (ORCPT ); Fri, 28 Jul 2023 02:17:36 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14BE8272D; Thu, 27 Jul 2023 23:17:34 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R281e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VoOxEIG_1690525050; Received: from srmbuffer011165236051.sqa.net(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VoOxEIG_1690525050) by smtp.aliyun-inc.com; Fri, 28 Jul 2023 14:17:30 +0800 From: Jing Zhang To: John Garry , Ian Rogers Cc: Will Deacon , Mark Rutland , Robin Murphy , Ilkka Koskinen , Namhyung Kim , Arnaldo Carvalho de Melo , 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 v5 2/5] perf jevents: Support more event fields Date: Fri, 28 Jul 2023 14:17:17 +0800 Message-Id: <1690525040-77423-3-git-send-email-renyu.zj@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690525040-77423-1-git-send-email-renyu.zj@linux.alibaba.com> References: <1690525040-77423-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_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED, 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