From nobody Thu Dec 18 05:17:45 2025 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 3163DEE49A0 for ; Wed, 23 Aug 2023 08:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233881AbjHWIRk (ORCPT ); Wed, 23 Aug 2023 04:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbjHWIKa (ORCPT ); Wed, 23 Aug 2023 04:10:30 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B604B170B for ; Wed, 23 Aug 2023 01:09:02 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d7494be34f8so4032125276.2 for ; Wed, 23 Aug 2023 01:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692778142; x=1693382942; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=C6U9uX7oueEa74oKkTWivvvrk8HCA+9h1GuvSCMbKhg=; b=yYBx+R1t3YglroUDquFlny5PlT0/aBcphI7ulqGgCebp/Xag8513iO+DA4YohB1M68 AFz1suo0C9rZnRvui20Xe72kfNTMmIu7g6QtXrHn1TB3VGKBTRX71nEYmTUUYAbR/gU4 SZFs/Ydsi6hcuVx2nkLsUPcWzWZ4b/EnHyKDEf41901rH8E10S6caRq598UreQktJ3Za lR8w91RZJpiUZFIL2S5ji3PK3nfiJH5FspBrjS+9jNs86vIZfXyRMYl6CeuMD02rqv/q 20UO5G3oOfzVEGpBkijVk/ONmRUTWDZwoWKdBDVZz2rgK3eGsw5/fR+HEi71w4A24vIX jdrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692778142; x=1693382942; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=C6U9uX7oueEa74oKkTWivvvrk8HCA+9h1GuvSCMbKhg=; b=bzw9yOosHM7kdYl2p3xBKl9e7XwO5vF9kVHCVTLUdBa1Udb2aToOpFzVfAw3OdHjYo cgPTbIcBn35UQtszSqhbeUX6QfckZbiDB5r5lXQN5ayKv72Mgk6hMxrMZNjkPU3CsGUp CfdKsBSPwCgcmWUxegQiKJ+j1yR/qDO8oXm0BkFAtawaZZycUwxuwSs+hu6UASMMcFVU TuacKtEpYr6adNEONbRMiXmYNpxCdmnwxWhatogpRkNbuPqNh7rqb2o+hBYX0NvN3EF5 fXJQxMAh1AY5zqNObKDDrBWk7edR7yB0cxq2dlvun/aD3CUrWyvHv0EtBADaTkWD+9GA qqVA== X-Gm-Message-State: AOJu0YxFPCQxplv7Sd2bHgD+blpnEA0tv1bDTV8lxrW8ZODYgyihNPVM oE25GnPrp+WmSuZh0JwcODNX8tnBdMxP X-Google-Smtp-Source: AGHT+IF+h2Y7UaGBjXYnwj4OgVWOQbrCL2WVLcle/ISoLrnwQb8UJvCD3OrXshSwu2NK2chRprariTSNBdBT X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:3971:e84:f508:9a36]) (user=irogers job=sendgmr) by 2002:a25:c0d4:0:b0:d77:df8a:389a with SMTP id c203-20020a25c0d4000000b00d77df8a389amr3089ybf.3.1692778142011; Wed, 23 Aug 2023 01:09:02 -0700 (PDT) Date: Wed, 23 Aug 2023 01:08:15 -0700 In-Reply-To: <20230823080828.1460376-1-irogers@google.com> Message-Id: <20230823080828.1460376-13-irogers@google.com> Mime-Version: 1.0 References: <20230823080828.1460376-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog Subject: [PATCH v1 12/25] perf jevents: Group events by PMU From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , James Clark , Kan Liang , John Garry , Kajol Jain , Jing Zhang , Ravi Bangoria , Rob Herring , Gaosheng Cui , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Prior to this change a cpuid would map to a list of events where the PMU would be encoded alongside the event information. This change breaks apart each group of events so that there is a group per PMU. A new table is added with the PMU's name and the list of events, the original table now holding an array of these per PMU tables. These changes are to make it easier to get per PMU information about events, rather than the current approach of scanning all events. The perf binary size with BPF skeletons on x86 is reduced by about 1%. The unidentified PMU is now always expanded to "cpu". Signed-off-by: Ian Rogers --- tools/perf/pmu-events/jevents.py | 181 +++++++++++++++++++++++-------- tools/perf/tests/pmu-events.c | 30 +++-- 2 files changed, 154 insertions(+), 57 deletions(-) diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jeven= ts.py index aae5334099b1..1ad20140114c 100755 --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -42,7 +42,7 @@ _metricgroups =3D {} # Order specific JsonEvent attributes will be visited. _json_event_attributes =3D [ # cmp_sevent related attributes. - 'name', 'pmu', 'topic', 'desc', + 'name', 'topic', 'desc', # Seems useful, put it early. 'event', # Short things in alphabetical order. @@ -53,7 +53,7 @@ _json_event_attributes =3D [ =20 # Attributes that are in pmu_metric rather than pmu_event. _json_metric_attributes =3D [ - 'pmu', 'metric_name', 'metric_group', 'metric_expr', 'metric_threshold= ', + 'metric_name', 'metric_group', 'metric_expr', 'metric_threshold', 'desc', 'long_desc', 'unit', 'compat', 'metricgroup_no_group', 'default_metricgroup_name', 'aggr_mode', 'event_grouping' ] @@ -252,7 +252,7 @@ class JsonEvent: def unit_to_pmu(unit: str) -> Optional[str]: """Convert a JSON Unit to Linux PMU name.""" if not unit: - return None + return 'cpu' # Comment brought over from jevents.c: # it's not realistic to keep adding these, we need something more sc= alable ... table =3D { @@ -343,10 +343,13 @@ class JsonEvent: self.desc +=3D extra_desc if self.long_desc and extra_desc: self.long_desc +=3D extra_desc - if self.pmu: - if self.desc and not self.desc.endswith('. '): - self.desc +=3D '. ' - self.desc =3D (self.desc if self.desc else '') + ('Unit: ' + self.pm= u + ' ') + if self.pmu and self.pmu !=3D 'cpu': + if not self.desc: + self.desc =3D 'Unit: ' + self.pmu + else: + if not self.desc.endswith('. '): + self.desc +=3D '. ' + self.desc +=3D 'Unit: ' + self.pmu if arch_std: if arch_std.lower() in _arch_std_events: event =3D _arch_std_events[arch_std.lower()].event @@ -437,13 +440,13 @@ def add_events_table_entries(item: os.DirEntry, topic= : str) -> None: def print_pending_events() -> None: """Optionally close events table.""" =20 - def event_cmp_key(j: JsonEvent) -> Tuple[bool, str, str, str, str]: + def event_cmp_key(j: JsonEvent) -> Tuple[str, str, bool, str, str]: def fix_none(s: Optional[str]) -> str: if s is None: return '' return s =20 - return (j.desc is not None, fix_none(j.topic), fix_none(j.name), fix_n= one(j.pmu), + return (fix_none(j.pmu).replace(',','_'), fix_none(j.name), j.desc is = not None, fix_none(j.topic), fix_none(j.metric_name)) =20 global _pending_events @@ -458,13 +461,36 @@ def print_pending_events() -> None: global event_tables _event_tables.append(_pending_events_tblname) =20 - _args.output_file.write( - f'static const struct compact_pmu_event {_pending_events_tblname}[] = =3D {{\n') - + first =3D True + last_pmu =3D None + pmus =3D set() for event in sorted(_pending_events, key=3Devent_cmp_key): + if event.pmu !=3D last_pmu: + if not first: + _args.output_file.write('};\n') + pmu_name =3D event.pmu.replace(',', '_') + _args.output_file.write( + f'static const struct compact_pmu_event {_pending_events_tblname= }_{pmu_name}[] =3D {{\n') + first =3D False + last_pmu =3D event.pmu + pmus.add((event.pmu, pmu_name)) + _args.output_file.write(event.to_c_string(metric=3DFalse)) _pending_events =3D [] =20 + _args.output_file.write(f""" +}}; + +const struct pmu_table_entry {_pending_events_tblname}[] =3D {{ +""") + for (pmu, tbl_pmu) in sorted(pmus): + pmu_name =3D f"{pmu}\\000" + _args.output_file.write(f"""{{ + .entries =3D {_pending_events_tblname}_{tbl_pmu}, + .num_entries =3D ARRAY_SIZE({_pending_events_tblname}_{tbl_pmu}), + .pmu_name =3D {{ {_bcs.offsets[pmu_name]} /* {pmu_name} */ }}, +}}, +""") _args.output_file.write('};\n\n') =20 def print_pending_metrics() -> None: @@ -490,13 +516,36 @@ def print_pending_metrics() -> None: global metric_tables _metric_tables.append(_pending_metrics_tblname) =20 - _args.output_file.write( - f'static const struct compact_pmu_event {_pending_metrics_tblname}[]= =3D {{\n') - + first =3D True + last_pmu =3D None + pmus =3D set() for metric in sorted(_pending_metrics, key=3Dmetric_cmp_key): + if metric.pmu !=3D last_pmu: + if not first: + _args.output_file.write('};\n') + pmu_name =3D metric.pmu.replace(',', '_') + _args.output_file.write( + f'static const struct compact_pmu_event {_pending_metrics_tblnam= e}_{pmu_name}[] =3D {{\n') + first =3D False + last_pmu =3D metric.pmu + pmus.add((metric.pmu, pmu_name)) + _args.output_file.write(metric.to_c_string(metric=3DTrue)) _pending_metrics =3D [] =20 + _args.output_file.write(f""" +}}; + +const struct pmu_table_entry {_pending_metrics_tblname}[] =3D {{ +""") + for (pmu, tbl_pmu) in sorted(pmus): + pmu_name =3D f"{pmu}\\000" + _args.output_file.write(f"""{{ + .entries =3D {_pending_metrics_tblname}_{tbl_pmu}, + .num_entries =3D ARRAY_SIZE({_pending_metrics_tblname}_{tbl_pmu}), + .pmu_name =3D {{ {_bcs.offsets[pmu_name]} /* {pmu_name} */ }}, +}}, +""") _args.output_file.write('};\n\n') =20 def get_topic(topic: str) -> str: @@ -532,6 +581,8 @@ def preprocess_one_file(parents: Sequence[str], item: o= s.DirEntry) -> None: =20 topic =3D get_topic(item.name) for event in read_json_events(item.path, topic): + pmu_name =3D f"{event.pmu}\\000" + _bcs.add(pmu_name) if event.name: _bcs.add(event.build_c_string(metric=3DFalse)) if event.metric_name: @@ -577,14 +628,14 @@ def print_mapping_table(archs: Sequence[str]) -> None: _args.output_file.write(""" /* Struct used to make the PMU event table implementation opaque to caller= s. */ struct pmu_events_table { - const struct compact_pmu_event *entries; - size_t length; + const struct pmu_table_entry *pmus; + uint32_t num_pmus; }; =20 /* Struct used to make the PMU metric table implementation opaque to calle= rs. */ struct pmu_metrics_table { - const struct compact_pmu_event *entries; - size_t length; + const struct pmu_table_entry *pmus; + uint32_t num_pmus; }; =20 /* @@ -614,12 +665,12 @@ const struct pmu_events_map pmu_events_map[] =3D { \t.arch =3D "testarch", \t.cpuid =3D "testcpu", \t.event_table =3D { -\t\t.entries =3D pmu_events__test_soc_cpu, -\t\t.length =3D ARRAY_SIZE(pmu_events__test_soc_cpu), +\t\t.pmus =3D pmu_events__test_soc_cpu, +\t\t.num_pmus =3D ARRAY_SIZE(pmu_events__test_soc_cpu), \t}, \t.metric_table =3D { -\t\t.entries =3D pmu_metrics__test_soc_cpu, -\t\t.length =3D ARRAY_SIZE(pmu_metrics__test_soc_cpu), +\t\t.pmus =3D pmu_metrics__test_soc_cpu, +\t\t.num_pmus =3D ARRAY_SIZE(pmu_metrics__test_soc_cpu), \t} }, """) @@ -649,12 +700,12 @@ const struct pmu_events_map pmu_events_map[] =3D { \t.arch =3D "{arch}", \t.cpuid =3D "{cpuid}", \t.event_table =3D {{ -\t\t.entries =3D {event_tblname}, -\t\t.length =3D {event_size} +\t\t.pmus =3D {event_tblname}, +\t\t.num_pmus =3D {event_size} \t}}, \t.metric_table =3D {{ -\t\t.entries =3D {metric_tblname}, -\t\t.length =3D {metric_size} +\t\t.pmus =3D {metric_tblname}, +\t\t.num_pmus =3D {metric_size} \t}} }}, """) @@ -685,15 +736,15 @@ static const struct pmu_sys_events pmu_sys_event_tabl= es[] =3D { for tblname in _sys_event_tables: _args.output_file.write(f"""\t{{ \t\t.event_table =3D {{ -\t\t\t.entries =3D {tblname}, -\t\t\t.length =3D ARRAY_SIZE({tblname}) +\t\t\t.pmus =3D {tblname}, +\t\t\t.num_pmus =3D ARRAY_SIZE({tblname}) \t\t}},""") metric_tblname =3D _sys_event_table_to_metric_table_mapping[tblname] if metric_tblname in _sys_metric_tables: _args.output_file.write(f""" \t\t.metric_table =3D {{ -\t\t\t.entries =3D {metric_tblname}, -\t\t\t.length =3D ARRAY_SIZE({metric_tblname}) +\t\t\t.pmus =3D {metric_tblname}, +\t\t\t.num_pmus =3D ARRAY_SIZE({metric_tblname}) \t\t}},""") printed_metric_tables.append(metric_tblname) _args.output_file.write(f""" @@ -753,18 +804,56 @@ static void decompress_metric(int offset, struct pmu_= metric *pm) _args.output_file.write('\twhile (*p++);') _args.output_file.write("""} =20 +static int pmu_events_table__for_each_event_pmu(const struct pmu_events_ta= ble *table, + const struct pmu_table_ent= ry *pmu, + pmu_event_iter_fn fn, + void *data) +{ + int ret; + struct pmu_event pe =3D { + .pmu =3D &big_c_string[pmu->pmu_name.offset], + }; + + for (uint32_t i =3D 0; i < pmu->num_entries; i++) { + decompress_event(pmu->entries[i].offset, &pe); + if (!pe.name) + continue; + ret =3D fn(&pe, table, data); + if (ret) + return ret; + } + return 0; + } + int pmu_events_table__for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn, void *data) { - for (size_t i =3D 0; i < table->length; i++) { - struct pmu_event pe; - int ret; + for (size_t i =3D 0; i < table->num_pmus; i++) { + int ret =3D pmu_events_table__for_each_event_pmu(table, &t= able->pmus[i], + fn, data); =20 - decompress_event(table->entries[i].offset, &pe); - if (!pe.name) + if (ret) + return ret; + } + return 0; +} + +static int pmu_metrics_table__for_each_metric_pmu(const struct pmu_metrics= _table *table, + const struct pmu_table_ent= ry *pmu, + pmu_metric_iter_fn fn, + void *data) +{ + int ret; + struct pmu_metric pm =3D { + .pmu =3D &big_c_string[pmu->pmu_name.offset], + }; + + for (uint32_t i =3D 0; i < pmu->num_entries; i++) { + decompress_metric(pmu->entries[i].offset, &pm); + if (!pm.metric_expr) continue; - ret =3D fn(&pe, table, data); + ret =3D fn(&pm, table, data); if (ret) return ret; } @@ -775,14 +864,10 @@ int pmu_metrics_table__for_each_metric(const struct p= mu_metrics_table *table, pmu_metric_iter_fn fn, void *data) { - for (size_t i =3D 0; i < table->length; i++) { - struct pmu_metric pm; - int ret; + for (size_t i =3D 0; i < table->num_pmus; i++) { + int ret =3D pmu_metrics_table__for_each_metric_pmu(table, = &table->pmus[i], + fn, data); =20 - decompress_metric(table->entries[i].offset, &pm); - if (!pm.metric_expr) - continue; - ret =3D fn(&pm, table, data); if (ret) return ret; } @@ -1010,7 +1095,13 @@ such as "arm/cortex-a34".''', #include =20 struct compact_pmu_event { - int offset; + int offset; +}; + +struct pmu_table_entry { + const struct compact_pmu_event *entries; + uint32_t num_entries; + struct compact_pmu_event pmu_name; }; =20 """) diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index 5f541eadc088..0b6efabc3d20 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -44,6 +44,7 @@ struct perf_pmu_test_pmu { =20 static const struct perf_pmu_test_event bp_l1_btb_correct =3D { .event =3D { + .pmu =3D "cpu", .name =3D "bp_l1_btb_correct", .event =3D "event=3D0x8a", .desc =3D "L1 BTB Correction", @@ -55,6 +56,7 @@ static const struct perf_pmu_test_event bp_l1_btb_correct= =3D { =20 static const struct perf_pmu_test_event bp_l2_btb_correct =3D { .event =3D { + .pmu =3D "cpu", .name =3D "bp_l2_btb_correct", .event =3D "event=3D0x8b", .desc =3D "L2 BTB Correction", @@ -66,6 +68,7 @@ static const struct perf_pmu_test_event bp_l2_btb_correct= =3D { =20 static const struct perf_pmu_test_event segment_reg_loads_any =3D { .event =3D { + .pmu =3D "cpu", .name =3D "segment_reg_loads.any", .event =3D "event=3D0x6,period=3D200000,umask=3D0x80", .desc =3D "Number of segment register loads", @@ -77,6 +80,7 @@ static const struct perf_pmu_test_event segment_reg_loads= _any =3D { =20 static const struct perf_pmu_test_event dispatch_blocked_any =3D { .event =3D { + .pmu =3D "cpu", .name =3D "dispatch_blocked.any", .event =3D "event=3D0x9,period=3D200000,umask=3D0x20", .desc =3D "Memory cluster signals to block micro-op dispatch for any rea= son", @@ -88,6 +92,7 @@ static const struct perf_pmu_test_event dispatch_blocked_= any =3D { =20 static const struct perf_pmu_test_event eist_trans =3D { .event =3D { + .pmu =3D "cpu", .name =3D "eist_trans", .event =3D "event=3D0x3a,period=3D200000,umask=3D0x0", .desc =3D "Number of Enhanced Intel SpeedStep(R) Technology (EIST) trans= itions", @@ -99,6 +104,7 @@ static const struct perf_pmu_test_event eist_trans =3D { =20 static const struct perf_pmu_test_event l3_cache_rd =3D { .event =3D { + .pmu =3D "cpu", .name =3D "l3_cache_rd", .event =3D "event=3D0x40", .desc =3D "L3 cache access, read", @@ -123,7 +129,7 @@ static const struct perf_pmu_test_event uncore_hisi_ddr= c_flux_wcmd =3D { .event =3D { .name =3D "uncore_hisi_ddrc.flux_wcmd", .event =3D "event=3D0x2", - .desc =3D "DDRC write commands. Unit: hisi_sccl,ddrc ", + .desc =3D "DDRC write commands. Unit: hisi_sccl,ddrc", .topic =3D "uncore", .long_desc =3D "DDRC write commands", .pmu =3D "hisi_sccl,ddrc", @@ -137,7 +143,7 @@ static const struct perf_pmu_test_event unc_cbo_xsnp_re= sponse_miss_eviction =3D { .event =3D { .name =3D "unc_cbo_xsnp_response.miss_eviction", .event =3D "event=3D0x22,umask=3D0x81", - .desc =3D "A cross-core snoop resulted from L3 Eviction which misses in = some processor core. Unit: uncore_cbox ", + .desc =3D "A cross-core snoop resulted from L3 Eviction which misses in = some processor core. Unit: uncore_cbox", .topic =3D "uncore", .long_desc =3D "A cross-core snoop resulted from L3 Eviction which misse= s in some processor core", .pmu =3D "uncore_cbox", @@ -151,7 +157,7 @@ static const struct perf_pmu_test_event uncore_hyphen = =3D { .event =3D { .name =3D "event-hyphen", .event =3D "event=3D0xe0,umask=3D0x00", - .desc =3D "UNC_CBO_HYPHEN. Unit: uncore_cbox ", + .desc =3D "UNC_CBO_HYPHEN. Unit: uncore_cbox", .topic =3D "uncore", .long_desc =3D "UNC_CBO_HYPHEN", .pmu =3D "uncore_cbox", @@ -165,7 +171,7 @@ static const struct perf_pmu_test_event uncore_two_hyph= =3D { .event =3D { .name =3D "event-two-hyph", .event =3D "event=3D0xc0,umask=3D0x00", - .desc =3D "UNC_CBO_TWO_HYPH. Unit: uncore_cbox ", + .desc =3D "UNC_CBO_TWO_HYPH. Unit: uncore_cbox", .topic =3D "uncore", .long_desc =3D "UNC_CBO_TWO_HYPH", .pmu =3D "uncore_cbox", @@ -179,7 +185,7 @@ static const struct perf_pmu_test_event uncore_hisi_l3c= _rd_hit_cpipe =3D { .event =3D { .name =3D "uncore_hisi_l3c.rd_hit_cpipe", .event =3D "event=3D0x7", - .desc =3D "Total read hits. Unit: hisi_sccl,l3c ", + .desc =3D "Total read hits. Unit: hisi_sccl,l3c", .topic =3D "uncore", .long_desc =3D "Total read hits", .pmu =3D "hisi_sccl,l3c", @@ -193,7 +199,7 @@ static const struct perf_pmu_test_event uncore_imc_free= _running_cache_miss =3D { .event =3D { .name =3D "uncore_imc_free_running.cache_miss", .event =3D "event=3D0x12", - .desc =3D "Total cache misses. Unit: uncore_imc_free_running ", + .desc =3D "Total cache misses. Unit: uncore_imc_free_running", .topic =3D "uncore", .long_desc =3D "Total cache misses", .pmu =3D "uncore_imc_free_running", @@ -207,7 +213,7 @@ static const struct perf_pmu_test_event uncore_imc_cach= e_hits =3D { .event =3D { .name =3D "uncore_imc.cache_hits", .event =3D "event=3D0x34", - .desc =3D "Total cache hits. Unit: uncore_imc ", + .desc =3D "Total cache hits. Unit: uncore_imc", .topic =3D "uncore", .long_desc =3D "Total cache hits", .pmu =3D "uncore_imc", @@ -232,13 +238,13 @@ static const struct perf_pmu_test_event sys_ddr_pmu_w= rite_cycles =3D { .event =3D { .name =3D "sys_ddr_pmu.write_cycles", .event =3D "event=3D0x2b", - .desc =3D "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ", + .desc =3D "ddr write-cycles event. Unit: uncore_sys_ddr_pmu", .topic =3D "uncore", .pmu =3D "uncore_sys_ddr_pmu", .compat =3D "v8", }, .alias_str =3D "event=3D0x2b", - .alias_long_desc =3D "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ", + .alias_long_desc =3D "ddr write-cycles event. Unit: uncore_sys_ddr_pmu", .matching_pmu =3D "uncore_sys_ddr_pmu", }; =20 @@ -246,13 +252,13 @@ static const struct perf_pmu_test_event sys_ccn_pmu_r= ead_cycles =3D { .event =3D { .name =3D "sys_ccn_pmu.read_cycles", .event =3D "config=3D0x2c", - .desc =3D "ccn read-cycles event. Unit: uncore_sys_ccn_pmu ", + .desc =3D "ccn read-cycles event. Unit: uncore_sys_ccn_pmu", .topic =3D "uncore", .pmu =3D "uncore_sys_ccn_pmu", .compat =3D "0x01", }, .alias_str =3D "config=3D0x2c", - .alias_long_desc =3D "ccn read-cycles event. Unit: uncore_sys_ccn_pmu ", + .alias_long_desc =3D "ccn read-cycles event. Unit: uncore_sys_ccn_pmu", .matching_pmu =3D "uncore_sys_ccn_pmu", }; =20 @@ -403,7 +409,7 @@ static int test__pmu_event_table_core_callback(const st= ruct pmu_event *pe, struct perf_pmu_test_event const **test_event_table; bool found =3D false; =20 - if (pe->pmu) + if (strcmp(pe->pmu, "cpu")) test_event_table =3D &uncore_events[0]; else test_event_table =3D &core_events[0]; --=20 2.42.0.rc1.204.g551eb34607-goog