From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: ak@kernel.org, ak@linux.intel.com, andi@firstfloor.org,
linux-perf-users@vger.kernel.org
Subject: [PATCH v3 7/9] perf config: Add core.hybrid-merge to configure event merging
Date: Wed, 16 Sep 2026 16:46:50 -0700 [thread overview]
Message-ID: <20260916234652.439778-8-irogers@google.com> (raw)
In-Reply-To: <20260916234652.439778-1-irogers@google.com>
Provide a core.hybrid-merge configuration option in .perfconfig
to allow enabling hybrid event aggregation by default, avoiding
the need to pass --hybrid-merge explicitly on every invocation.
The config value is a default rather than an explicit request, so with
--hierarchy it is ignored with a warning, while giving both
--hierarchy and --hybrid-merge on the command line remains an error.
perf stat has its own merging options for counting, the sampling
core.hybrid-merge deliberately doesn't alter it and its
--hybrid-merge must still be given explicitly.
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
tools/perf/Documentation/perf-config.txt | 8 ++++++++
tools/perf/builtin-report.c | 16 +++++++++++-----
tools/perf/builtin-top.c | 22 +++++++++++++++-------
tools/perf/util/config.c | 10 ++++++++++
4 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 9b223f892829..73a320861dc1 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -217,6 +217,14 @@ core.*::
Sets a timeout (in milliseconds) for parsing 'addr2line'
output. The default timeout is 5s.
+ hybrid-merge::
+ Merge matching events from all hybrid core PMUs into one display
+ by default. For example, if a wildcard expands to run on both p-cores and
+ e-cores, this aggregates them into a single view. This applies to
+ 'perf report' and 'perf top', it is ignored with '--hierarchy' and
+ doesn't alter 'perf stat' where '--hybrid-merge' must be given
+ explicitly.
+
tui.*, gtk.*::
Subcommands that can be configured here are 'top', 'report' and 'annotate'.
These values are booleans, for example:
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index bda4836fc524..30c6664507a5 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1324,6 +1324,7 @@ int cmd_report(int argc, const char **argv)
int branch_mode = -1;
int last_key = 0;
bool branch_call_mode = false;
+ bool hybrid_merge_set = false;
#define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent"
static const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
CALLCHAIN_REPORT_HELP
@@ -1460,8 +1461,8 @@ int cmd_report(int argc, const char **argv)
parse_branch_mode),
OPT_BOOLEAN(0, "branch-history", &branch_call_mode,
"add last branch records to call history"),
- OPT_BOOLEAN(0, "hybrid-merge", &symbol_conf.hybrid_merge,
- "merge the same event across hybrid core PMUs"),
+ OPT_BOOLEAN_SET(0, "hybrid-merge", &symbol_conf.hybrid_merge, &hybrid_merge_set,
+ "merge the same event across hybrid core PMUs"),
OPT_STRING(0, "objdump", &objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
OPT_STRING(0, "addr2line", &addr2line_path, "path",
@@ -1562,9 +1563,14 @@ int cmd_report(int argc, const char **argv)
}
if (symbol_conf.report_hierarchy && symbol_conf.hybrid_merge) {
- pr_err("Error: --hierarchy and --hybrid-merge are mutually exclusive.\n");
- ret = -EINVAL;
- goto exit;
+ if (hybrid_merge_set) {
+ pr_err("Error: --hierarchy and --hybrid-merge are mutually exclusive.\n");
+ ret = -EINVAL;
+ goto exit;
+ }
+ /* A config file default shouldn't fail an explicit option. */
+ pr_warning("core.hybrid-merge ignored: --hierarchy cannot display merged hybrid events\n");
+ symbol_conf.hybrid_merge = false;
}
if (disassembler_style) {
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 3bb3337f1244..02b76f6bd0bd 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1314,9 +1314,11 @@ static int __cmd_top(struct perf_top *top)
}
/*
- * Use global stat_config that is zero meaning aggr_mode is AGGR_NONE
- * and hybrid_merge is false.
+ * Use global stat_config that is zero meaning aggr_mode is AGGR_NONE.
+ * Merging affects the event names as merged events share a name, all
+ * other stat_config behavior is unwanted here.
*/
+ stat_config.hybrid_merge = symbol_conf.hybrid_merge;
evlist__uniquify_evsel_names(top->evlist, &stat_config);
ret = perf_top__start_counters(top);
if (ret)
@@ -1493,6 +1495,7 @@ int cmd_top(int argc, const char **argv)
.evlistp = &top.evlist,
};
bool branch_call_mode = false;
+ bool hybrid_merge_set = false;
struct record_opts *opts = &top.record_opts;
struct target *target = &opts->target;
const char *disassembler_style = NULL, *objdump_path = NULL, *addr2line_path = NULL;
@@ -1500,8 +1503,8 @@ int cmd_top(int argc, const char **argv)
OPT_CALLBACK('e', "event", &parse_events_option_args, "event",
"event selector. use 'perf list' to list available events",
parse_events_option),
- OPT_BOOLEAN(0, "hybrid-merge", &symbol_conf.hybrid_merge,
- "merge the same event across hybrid core PMUs"),
+ OPT_BOOLEAN_SET(0, "hybrid-merge", &symbol_conf.hybrid_merge, &hybrid_merge_set,
+ "merge the same event across hybrid core PMUs"),
OPT_CALLBACK(0, "filter", &top.evlist, "filter",
"event filter", parse_filter),
OPT_U64('c', "count", &opts->user_interval, "event period to sample"),
@@ -1691,9 +1694,14 @@ int cmd_top(int argc, const char **argv)
usage_with_options(top_usage, options);
if (symbol_conf.report_hierarchy && symbol_conf.hybrid_merge) {
- pr_err("Error: --hierarchy and --hybrid-merge are mutually exclusive.\n");
- status = -EINVAL;
- goto out_put_evlist;
+ if (hybrid_merge_set) {
+ pr_err("Error: --hierarchy and --hybrid-merge are mutually exclusive.\n");
+ status = -EINVAL;
+ goto out_put_evlist;
+ }
+ /* A config file default shouldn't fail an explicit option. */
+ pr_warning("core.hybrid-merge ignored: --hierarchy cannot display merged hybrid events\n");
+ symbol_conf.hybrid_merge = false;
}
if (disassembler_style) {
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index b2972c35c1ec..8fe43b032e9a 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -470,6 +470,16 @@ static int perf_default_core_config(const char *var, const char *value)
if (!strcmp(var, "core.addr2line-disable-warn"))
symbol_conf.addr2line_disable_warn = perf_config_bool(var, value);
+ if (!strcmp(var, "core.hybrid-merge")) {
+ /*
+ * Note, this is for sampling tools like perf report and top.
+ * perf stat has its own merging options and the
+ * stat_config.hybrid_merge of "perf stat --hybrid-merge" is
+ * deliberately not set here.
+ */
+ symbol_conf.hybrid_merge = perf_config_bool(var, value);
+ }
+
/* Add other config variables here. */
return 0;
}
--
2.55.0.1082.g2b9226bbc0-goog
next prev parent reply other threads:[~2026-09-16 23:47 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 6:52 [PATCH v2 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-16 6:52 ` [PATCH v2 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-16 7:02 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-16 7:04 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-16 7:04 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-16 6:59 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-16 7:06 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-16 7:01 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 7/9] perf config: Add core.hybrid-merge to configure event merging Ian Rogers
2026-09-16 6:59 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-16 7:04 ` sashiko-bot
2026-09-16 6:52 ` [PATCH v2 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-16 7:08 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-16 23:46 ` [PATCH v3 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-16 23:58 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-16 23:57 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-16 23:57 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-16 23:48 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-16 23:53 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-16 23:53 ` sashiko-bot
2026-09-16 23:46 ` Ian Rogers [this message]
2026-09-16 23:57 ` [PATCH v3 7/9] perf config: Add core.hybrid-merge to configure event merging sashiko-bot
2026-09-16 23:46 ` [PATCH v3 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-16 23:53 ` sashiko-bot
2026-09-16 23:46 ` [PATCH v3 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-16 23:57 ` sashiko-bot
2026-09-17 5:06 ` [PATCH v4 0/9] perf report/top: Add opt-in --hybrid-merge Ian Rogers
2026-09-17 5:07 ` [PATCH v4 1/9] perf evlist: Implement evlist__can_merge_hybrid using first_wildcard_match Ian Rogers
2026-09-17 5:14 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 2/9] perf ui hist: Add support for aggregated total_period and merging entries Ian Rogers
2026-09-17 5:16 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 3/9] perf tools: Expose opt-in --hybrid-merge Ian Rogers
2026-09-17 5:16 ` sashiko-bot
2026-09-18 20:31 ` Arnaldo Carvalho de Melo
2026-09-18 20:51 ` Ian Rogers
2026-09-17 5:07 ` [PATCH v4 4/9] perf Documentation: Add tip for hybrid event merging Ian Rogers
2026-09-17 5:10 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 5/9] perf evlist: Toggle merged_hybrid_group properly in enable/disable Ian Rogers
2026-09-17 5:13 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 6/9] perf tools: Add TUI hints for --hybrid-merge Ian Rogers
2026-09-17 5:14 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 7/9] perf config: Add core.hybrid-merge to configure event merging Ian Rogers
2026-09-17 5:16 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 8/9] perf test: Expand tests for --hybrid-merge Ian Rogers
2026-09-17 5:18 ` sashiko-bot
2026-09-17 5:07 ` [PATCH v4 9/9] perf test: Isolate test suite from user .perfconfig natively Ian Rogers
2026-09-17 5:17 ` sashiko-bot
2026-09-18 20:40 ` [PATCH v4 0/9] perf report/top: Add opt-in --hybrid-merge Arnaldo Carvalho de Melo
2026-09-18 21:58 ` Arnaldo Carvalho de Melo
2026-09-18 22:07 ` Ian Rogers
2026-09-18 22:11 ` Ian Rogers
2026-09-18 23:04 ` Arnaldo Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916234652.439778-8-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=ak@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox