Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v1 0/2] perf annotate: Fix source option behavior and
@ 2026-08-18 14:40 Kohei Enju
  2026-08-18 14:40 ` [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation Kohei Enju
  2026-08-18 14:40 ` [PATCH v1 2/2] perf annotate: Honor explicit --source option Kohei Enju
  0 siblings, 2 replies; 5+ messages in thread
From: Kohei Enju @ 2026-08-18 14:40 UTC (permalink / raw)
  To: linux-perf-users
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Kohei Enju

Source annotation has been disabled by default since e201757f7a0a ("perf
annotate: Fix source code annotate with objdump"), but the documentation
still describes the old default. Also, an explicit --source does not
currently override annotate.hide_src_code.

Update the documentation and make explicit --source/--no-source take
precedence over the configuration.

Kohei Enju (2):
  perf config: Fix annotate.hide_src_code documentation
  perf annotate: Honor explicit --source option

 tools/perf/Documentation/perf-annotate.txt  | 4 ++--
 tools/perf/Documentation/perf-config.txt    | 6 +++---
 tools/perf/Documentation/perf-report.txt    | 4 ++--
 tools/perf/Documentation/perf-top.txt       | 4 ++--
 tools/perf/Documentation/perfconfig.example | 2 +-
 tools/perf/builtin-annotate.c               | 7 +++++--
 tools/perf/builtin-report.c                 | 7 +++++--
 tools/perf/builtin-top.c                    | 7 +++++--
 8 files changed, 25 insertions(+), 16 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation
  2026-08-18 14:40 [PATCH v1 0/2] perf annotate: Fix source option behavior and Kohei Enju
@ 2026-08-18 14:40 ` Kohei Enju
  2026-08-18 16:05   ` sashiko-bot
  2026-08-18 14:40 ` [PATCH v1 2/2] perf annotate: Honor explicit --source option Kohei Enju
  1 sibling, 1 reply; 5+ messages in thread
From: Kohei Enju @ 2026-08-18 14:40 UTC (permalink / raw)
  To: linux-perf-users
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Kohei Enju

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1909 bytes --]

annotate.hide_src_code defaults to true since commit e201757f7a0a ("perf
annotate: Fix source code annotate with objdump"), but the perf config
documentation still describes the default as false in a few places.

Update the documented default and the example.

Signed-off-by: Kohei Enju <kohei@enjuk.jp>
---
 tools/perf/Documentation/perf-config.txt    | 6 +++---
 tools/perf/Documentation/perfconfig.example | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 9b223f892829..589bc7f36012 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -96,7 +96,7 @@ Given a $HOME/.perfconfig like this:
 
 	[annotate]
 		# Defaults
-		hide_src_code = false
+		hide_src_code = true
 		use_offset = true
 		jump_arrows = true
 		show_nr_jumps = false
@@ -126,7 +126,7 @@ Given a $HOME/.perfconfig like this:
 		skip-empty = true
 
 
-You can hide source code of annotate feature setting the config to false with
+You can hide source code of annotate feature setting the config to true with
 
 	% perf config annotate.hide_src_code=true
 
@@ -291,7 +291,7 @@ annotate.*::
 		│        mov    (%rdi),%rdx
 
 		But if this option is 'false', source code of the part
-		can be also printed as below. Default is 'false'.
+		can be also printed as below. Default is 'true'.
 
 		│      struct rb_node *rb_next(const struct rb_node *node)
 		│      {
diff --git a/tools/perf/Documentation/perfconfig.example b/tools/perf/Documentation/perfconfig.example
index 2b477c1d1efe..f9c202a25fa0 100644
--- a/tools/perf/Documentation/perfconfig.example
+++ b/tools/perf/Documentation/perfconfig.example
@@ -23,7 +23,7 @@
 [annotate]
 
 	# Defaults
-	hide_src_code = false
+	hide_src_code = true
 	use_offset = true
 	jump_arrows = true
 	show_nr_jumps = false
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] perf annotate: Honor explicit --source option
  2026-08-18 14:40 [PATCH v1 0/2] perf annotate: Fix source option behavior and Kohei Enju
  2026-08-18 14:40 ` [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation Kohei Enju
@ 2026-08-18 14:40 ` Kohei Enju
  2026-08-18 16:10   ` sashiko-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Kohei Enju @ 2026-08-18 14:40 UTC (permalink / raw)
  To: linux-perf-users
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Kohei Enju

Source annotation is hidden by default to avoid forcing objdump -S, but
currently an explicit --source doesn't override annotate.hide_src_code.

In TUI mode, source code can be shown later with the 's' hotkey, which
re-runs annotation with hide_src_code cleared. In --stdio/--stdio2 mode,
there is no such interactive fallback, so --source did not show source
code unless users also set annotate.hide_src_code=false globally in
advance.

Track whether --source/--no-source was specified and synchronize
hide_src_code only in that case.

Fixes: e201757f7a0a ("perf annotate: Fix source code annotate with objdump")
Signed-off-by: Kohei Enju <kohei@enjuk.jp>
---
 tools/perf/Documentation/perf-annotate.txt | 4 ++--
 tools/perf/Documentation/perf-report.txt   | 4 ++--
 tools/perf/Documentation/perf-top.txt      | 4 ++--
 tools/perf/builtin-annotate.c              | 7 +++++--
 tools/perf/builtin-report.c                | 7 +++++--
 tools/perf/builtin-top.c                   | 7 +++++--
 6 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index a688738809c4..dc5866cf6666 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -107,8 +107,8 @@ include::itrace.txt[]
 --show-total-period:: Show a column with the sum of periods.
 
 --source::
-	Interleave source code with assembly code. Enabled by default,
-	disable with --no-source.
+	Interleave source code with assembly code. This may use objdump and be
+	slower than the default disassembly. Disable with --no-source.
 
 --symfs=<directory[,layout]>::
         Look for files with symbols relative to this directory. The optional
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 22f87eaa3279..d494b9a37663 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -388,8 +388,8 @@ OPTIONS
 --disassembler-style=:: Set disassembler style for objdump.
 
 --source::
-	Interleave source code with assembly code. Enabled by default,
-	disable with --no-source.
+	Interleave source code with assembly code. This may use objdump and be
+	slower than the default disassembly. Disable with --no-source.
 
 --asm-raw::
 	Show raw instruction encoding of assembly instructions.
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index af3e4230c72f..0e5372988a1f 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -178,8 +178,8 @@ Default is to monitor all CPUS.
         with different file system layout.
 
 --source::
-	Interleave source code with assembly code. Enabled by default,
-	disable with --no-source.
+	Interleave source code with assembly code. This may use objdump and be
+	slower than the default disassembly. Disable with --no-source.
 
 --asm-raw::
 	Show raw instruction encoding of assembly instructions.
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 8a0eb30eac24..cb8ce851a81e 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -692,6 +692,7 @@ static const char * const annotate_usage[] = {
 int cmd_annotate(int argc, const char **argv)
 {
 	struct perf_annotate annotate = {};
+	bool source_set = false;
 	struct perf_data data = {
 		.mode  = PERF_DATA_MODE_READ,
 	};
@@ -738,8 +739,8 @@ int cmd_annotate(int argc, const char **argv)
 	OPT_STRING('C', "cpu", &annotate.cpu_list, "cpu", "list of cpus to profile"),
 	OPT_CALLBACK(0, "symfs", NULL, "directory[,layout]", SYMFS_HELP,
 		     symbol__config_symfs),
-	OPT_BOOLEAN(0, "source", &annotate_opts.annotate_src,
-		    "Interleave source code with assembly code (default)"),
+	OPT_BOOLEAN_SET(0, "source", &annotate_opts.annotate_src, &source_set,
+			"Interleave source code with assembly code"),
 	OPT_BOOLEAN(0, "asm-raw", &annotate_opts.show_asm_raw,
 		    "Display raw encoding of assembly instructions (default)"),
 	OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
@@ -798,6 +799,8 @@ int cmd_annotate(int argc, const char **argv)
 	annotation_config__init();
 
 	argc = parse_options(argc, argv, options, annotate_usage, 0);
+	if (source_set)
+		annotate_opts.hide_src_code = !annotate_opts.annotate_src;
 	if (argc) {
 		/*
 		 * Special case: if there's an argument left then assume that
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index dd1309c32094..cfd611ca6ffe 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1306,6 +1306,7 @@ int cmd_report(int argc, const char **argv)
 	struct itrace_synth_opts itrace_synth_opts = { .set = 0, };
 	struct stat st;
 	bool has_br_stack = false;
+	bool source_set = false;
 	int branch_mode = -1;
 	int last_key = 0;
 	bool branch_call_mode = false;
@@ -1420,8 +1421,8 @@ int cmd_report(int argc, const char **argv)
 		   "only consider these parallelism levels (cpu set format)"),
 	OPT_BOOLEAN('I', "show-info", &report.show_full_info,
 		    "Display extended information about perf.data file"),
-	OPT_BOOLEAN(0, "source", &annotate_opts.annotate_src,
-		    "Interleave source code with assembly code (default)"),
+	OPT_BOOLEAN_SET(0, "source", &annotate_opts.annotate_src, &source_set,
+			"Interleave source code with assembly code"),
 	OPT_BOOLEAN(0, "asm-raw", &annotate_opts.show_asm_raw,
 		    "Display raw encoding of assembly instructions (default)"),
 	OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
@@ -1853,6 +1854,8 @@ int cmd_report(int argc, const char **argv)
 			symbol_conf.priv_size += sizeof(u32);
 		}
 		annotation_config__init();
+		if (source_set)
+			annotate_opts.hide_src_code = !annotate_opts.annotate_src;
 	}
 
 	if (symbol__init(perf_session__env(session)) < 0)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 1211401616ee..cc06e7332e47 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1483,6 +1483,7 @@ int cmd_top(int argc, const char **argv)
 		.evlistp = &top.evlist,
 	};
 	bool branch_call_mode = false;
+	bool source_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;
@@ -1566,8 +1567,8 @@ int cmd_top(int argc, const char **argv)
 		   "only consider symbols in these comms"),
 	OPT_STRING(0, "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
 		   "only consider these symbols"),
-	OPT_BOOLEAN(0, "source", &annotate_opts.annotate_src,
-		    "Interleave source code with assembly code (default)"),
+	OPT_BOOLEAN_SET(0, "source", &annotate_opts.annotate_src, &source_set,
+			"Interleave source code with assembly code"),
 	OPT_BOOLEAN(0, "asm-raw", &annotate_opts.show_asm_raw,
 		    "Display raw encoding of assembly instructions (default)"),
 	OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
@@ -1851,6 +1852,8 @@ int cmd_top(int argc, const char **argv)
 		goto out_delete_evlist;
 
 	annotation_config__init();
+	if (source_set)
+		annotate_opts.hide_src_code = !annotate_opts.annotate_src;
 
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
 	status = symbol__init(NULL);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation
  2026-08-18 14:40 ` [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation Kohei Enju
@ 2026-08-18 16:05   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-08-18 16:05 UTC (permalink / raw)
  To: Kohei Enju; +Cc: linux-perf-users

> annotate.hide_src_code defaults to true since commit e201757f7a0a ("perf
> annotate: Fix source code annotate with objdump"), but the perf config
> documentation still describes the default as false in a few places.
> 
> Update the documented default and the example.
> 
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818144149.101248-1-kohei@enjuk.jp?part=1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/2] perf annotate: Honor explicit --source option
  2026-08-18 14:40 ` [PATCH v1 2/2] perf annotate: Honor explicit --source option Kohei Enju
@ 2026-08-18 16:10   ` sashiko-bot
  0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-08-18 16:10 UTC (permalink / raw)
  To: Kohei Enju; +Cc: linux-perf-users

> Source annotation is hidden by default to avoid forcing objdump -S, but
> currently an explicit --source doesn't override annotate.hide_src_code.
> 
> In TUI mode, source code can be shown later with the 's' hotkey, which
> re-runs annotation with hide_src_code cleared. In --stdio/--stdio2 mode,
> there is no such interactive fallback, so --source did not show source
> code unless users also set annotate.hide_src_code=false globally in
> advance.
> 
> Track whether --source/--no-source was specified and synchronize
> hide_src_code only in that case.
> 
> Fixes: e201757f7a0a ("perf annotate: Fix source code annotate with objdump")
> Signed-off-by: Kohei Enju <kohei@enjuk.jp>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818144149.101248-1-kohei@enjuk.jp?part=2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-18 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 14:40 [PATCH v1 0/2] perf annotate: Fix source option behavior and Kohei Enju
2026-08-18 14:40 ` [PATCH v1 1/2] perf config: Fix annotate.hide_src_code documentation Kohei Enju
2026-08-18 16:05   ` sashiko-bot
2026-08-18 14:40 ` [PATCH v1 2/2] perf annotate: Honor explicit --source option Kohei Enju
2026-08-18 16:10   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox