Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1861992rwo; Sun, 23 Jul 2023 02:13:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlE+0s3E0z8Nz5SbvQNGvUz5uI3lfzfXULAF6fZtaDd7m/AAC3lBRzU0Q4h7KduFj1SGwcnG X-Received: by 2002:a17:907:2bcb:b0:98e:f13:e908 with SMTP id gv11-20020a1709072bcb00b0098e0f13e908mr6087291ejc.60.1690103618576; Sun, 23 Jul 2023 02:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690103618; cv=none; d=google.com; s=arc-20160816; b=EVMlS9VubbY6cCvWzK1EEZvkdeb8UQwhFPC09pKhKv4ikiEG8me+B4HOCmL5lZgZ8k SUo0Y/i8/JFQOcjVdTkzQYL7AdUkNgkwj7i0fFEz0ZAAx+Jq8fQLiLnqAG7g/L8hYTrP WmCmMwzy2WaVSxhotfDIzskLrRM9XDyHuBC8a8ObdaJOoc13VMLVcYSrTKzK2IT8C0o7 tJi/1R+5K5m+hofuKuu3AOiFXO4/lckgusK70QLCm4ck7dGEvlYBqSfzfdWy35p8Ahxb 68SHiPtnVZqVcWsM5HY/AnsaMrWXp1s7G86kRJ9aOAUOqsFiw0fiMiCRsmxG2pUYvIsf bfKg== 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=MLC4ayKAfSNtbtQE4A0pa9bZjZCmmkPzk06GCqzrIiI=; fh=eOu1KI7Hso2e/GDSxGFBosdiY3Bqk8zRJrvUK8bVCkE=; b=Yy1yTR/eti58KggDR+CkH63/9oIWBsTKHoozmFqzNEQakWbv/b8aZgcRifpOYer4lM wHvS1FPQduoLtfvSMe1oGukTkG0zpUkgfjfR+JtJTFh6kK08fg6AtxVFlrTyo262TxZ/ b29kJb8OPZ5rkTIz80E8AsoeX/jjEHEQn6wfdJgWuZ3GMSmQiX6KC/IgGoXSjVPd5JFY dmZIuJ0CIpeCq6jSHejy8lEvtN0tPw6J5wPT+kX9pSzSLU3pDqxk7u51p89UoeXCHhC6 x7dX1YEh5iTSacocSCJWHI3hsY75sxzjfysnb9QomlmQj6PlQ0pEoAjckggBxUielTZ3 7ZGQ== 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 xa15-20020a170907b9cf00b009930e13beb8si5072012ejc.952.2023.07.23.02.13.15; Sun, 23 Jul 2023 02:13:38 -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 S229907AbjGWIWg (ORCPT + 99 others); Sun, 23 Jul 2023 04:22:36 -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> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,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 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. 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/jevents.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()}' - 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') @@ -297,7 +291,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='), @@ -307,10 +309,14 @@ class JsonEvent: ('Invert', 'inv='), ('SampleAfterValue', 'period='), ('UMask', 'umask='), + ('ConfigCode', 'config='), + ('EventIdCode', 'eventid='), + ('Type', 'type='), + ('OccupId', 'occupid='), ] 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