public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] perf addr2line: Rework disable_add2line_warn
@ 2026-03-25 12:06 Thomas Richter
  2026-03-25 12:06 ` [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn Thomas Richter
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Thomas Richter @ 2026-03-25 12:06 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo

Introduce configurable addr2line_disable_warn entry in the .perfconfig
file. Clean up addr2line configuration.

Patch 1:
   Rename disable_add2line_warn to addr2line_disable_warn (with 'r')
   and start name with prefix addr2line_ to make it consistent with
   other addr2line_xxx configuration parameters.
Patch 2:
   Enable symbol_conf::addr2line_disable_warn set via config file.
Patch 3:
   Remove global variable addr2line_timeout_ms and make it a member
   of struct::symbol_conf.

Thomas Richter (3):
  perf config: Rename symbol_conf::disable_add2line_warn
  perf config: Make symbol_conf::addr2line_disable_warn configurable
  perf addr2line: Remove global variable addr2line_timeout_ms

 tools/perf/builtin-diff.c     |  4 ++--
 tools/perf/util/addr2line.c   | 20 ++++++++++----------
 tools/perf/util/addr2line.h   |  2 --
 tools/perf/util/block-info.c  |  2 +-
 tools/perf/util/config.c      |  6 ++++--
 tools/perf/util/libbfd.c      |  2 +-
 tools/perf/util/symbol_conf.h |  3 ++-
 7 files changed, 20 insertions(+), 19 deletions(-)

-- 
2.53.0


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

* [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn
  2026-03-25 12:06 [PATCH 0/3] perf addr2line: Rework disable_add2line_warn Thomas Richter
@ 2026-03-25 12:06 ` Thomas Richter
  2026-03-25 15:02   ` Ian Rogers
  2026-03-25 12:06 ` [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable Thomas Richter
  2026-03-25 12:06 ` [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms Thomas Richter
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Richter @ 2026-03-25 12:06 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter

Rename member symbol_conf::disable_add2line_warn to
symbol_conf::addr2line_disable_warn to make it consistent with other
addr2line_xxx constants.
No functional change.

Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/builtin-diff.c     |  4 ++--
 tools/perf/util/addr2line.c   | 12 ++++++------
 tools/perf/util/block-info.c  |  2 +-
 tools/perf/util/libbfd.c      |  2 +-
 tools/perf/util/symbol_conf.h |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 59bf1f72d12e..8a93e56f4a7e 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1353,7 +1353,7 @@ static int cycles_printf(struct hist_entry *he, struct hist_entry *pair,
 	/*
 	 * Avoid printing the warning "addr2line_init failed for ..."
 	 */
-	symbol_conf.disable_add2line_warn = true;
+	symbol_conf.addr2line_disable_warn = true;
 
 	bi = block_he->block_info;
 
@@ -1987,7 +1987,7 @@ int cmd_diff(int argc, const char **argv)
 
 	if (compute == COMPUTE_STREAM) {
 		symbol_conf.show_branchflag_count = true;
-		symbol_conf.disable_add2line_warn = true;
+		symbol_conf.addr2line_disable_warn = true;
 		callchain_param.mode = CHAIN_FLAT;
 		callchain_param.key = CCKEY_SRCLINE;
 		callchain_param.branch_callstack = 1;
diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
index 31c0391fffa3..e9f084db0802 100644
--- a/tools/perf/util/addr2line.c
+++ b/tools/perf/util/addr2line.c
@@ -123,7 +123,7 @@ static enum cmd_a2l_style cmd_addr2line_configure(struct child_process *a2l, con
 			lines = 3;
 			pr_debug3("Detected binutils addr2line style\n");
 		} else {
-			if (!symbol_conf.disable_add2line_warn) {
+			if (!symbol_conf.addr2line_disable_warn) {
 				char *output = NULL;
 				size_t output_len;
 
@@ -310,7 +310,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 	}
 
 	if (a2l == NULL) {
-		if (!symbol_conf.disable_add2line_warn)
+		if (!symbol_conf.addr2line_disable_warn)
 			pr_warning("%s %s: addr2line_subprocess_init failed\n", __func__, dso_name);
 		goto out;
 	}
@@ -330,7 +330,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 	len = snprintf(buf, sizeof(buf), "%016"PRIx64"\n,\n", addr);
 	written = len > 0 ? write(a2l->in, buf, len) : -1;
 	if (written != len) {
-		if (!symbol_conf.disable_add2line_warn)
+		if (!symbol_conf.addr2line_disable_warn)
 			pr_warning("%s %s: could not send request\n", __func__, dso_name);
 		goto out;
 	}
@@ -339,7 +339,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 	switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
 				      &record_function, &record_filename, &record_line_nr)) {
 	case -1:
-		if (!symbol_conf.disable_add2line_warn)
+		if (!symbol_conf.addr2line_disable_warn)
 			pr_warning("%s %s: could not read first record\n", __func__, dso_name);
 		goto out;
 	case 0:
@@ -355,7 +355,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 					      /*addr=*/1, /*first=*/true,
 					      NULL, NULL, NULL)) {
 		case -1:
-			if (!symbol_conf.disable_add2line_warn)
+			if (!symbol_conf.addr2line_disable_warn)
 				pr_warning("%s %s: could not read sentinel record\n",
 					   __func__, dso_name);
 			break;
@@ -363,7 +363,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 			/* The sentinel as expected. */
 			break;
 		default:
-			if (!symbol_conf.disable_add2line_warn)
+			if (!symbol_conf.addr2line_disable_warn)
 				pr_warning("%s %s: unexpected record instead of sentinel",
 					   __func__, dso_name);
 			break;
diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c
index 649392bee7ed..8d3a9a661f26 100644
--- a/tools/perf/util/block-info.c
+++ b/tools/perf/util/block-info.c
@@ -303,7 +303,7 @@ static int block_range_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 	char buf[128];
 	char *start_line, *end_line;
 
-	symbol_conf.disable_add2line_warn = true;
+	symbol_conf.addr2line_disable_warn = true;
 
 	start_line = map__srcline(he->ms.map, bi->sym->start + bi->start,
 				  he->ms.sym);
diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c
index 63ea3fb53e77..c1c12308cc12 100644
--- a/tools/perf/util/libbfd.c
+++ b/tools/perf/util/libbfd.c
@@ -233,7 +233,7 @@ int libbfd__addr2line(const char *dso_name, u64 addr,
 	}
 
 	if (a2l == NULL) {
-		if (!symbol_conf.disable_add2line_warn)
+		if (!symbol_conf.addr2line_disable_warn)
 			pr_warning("addr2line_init failed for %s\n", dso_name);
 		return 0;
 	}
diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
index 71bb17372a6c..ff229942fbb1 100644
--- a/tools/perf/util/symbol_conf.h
+++ b/tools/perf/util/symbol_conf.h
@@ -51,7 +51,7 @@ struct symbol_conf {
 			report_block,
 			report_individual_block,
 			inline_name,
-			disable_add2line_warn,
+			addr2line_disable_warn,
 			no_buildid_mmap2,
 			guest_code,
 			lazy_load_kernel_maps,
-- 
2.53.0


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

* [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable
  2026-03-25 12:06 [PATCH 0/3] perf addr2line: Rework disable_add2line_warn Thomas Richter
  2026-03-25 12:06 ` [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn Thomas Richter
@ 2026-03-25 12:06 ` Thomas Richter
  2026-03-25 15:03   ` Ian Rogers
  2026-04-02  0:01   ` Namhyung Kim
  2026-03-25 12:06 ` [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms Thomas Richter
  2 siblings, 2 replies; 10+ messages in thread
From: Thomas Richter @ 2026-03-25 12:06 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter

Make symbol_conf::addr2line_disable_warn configurable by reading
the perfconfig file. Use section core and addr2line-disable-warn =
value.

Example:
 # perf config -l
 core.addr2line-timeout=500
 core.addr2line-disable-warn=1
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
---
 tools/perf/util/config.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 0452fbc6c085..31541e03aab7 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -461,6 +461,9 @@ static int perf_default_core_config(const char *var, const char *value)
 	if (!strcmp(var, "core.addr2line-timeout"))
 		addr2line_timeout_ms = strtoul(value, NULL, 10);
 
+	if (!strcmp(var, "core.addr2line-disable-warn"))
+		symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);
+
 	/* Add other config variables here. */
 	return 0;
 }
-- 
2.53.0


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

* [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms
  2026-03-25 12:06 [PATCH 0/3] perf addr2line: Rework disable_add2line_warn Thomas Richter
  2026-03-25 12:06 ` [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn Thomas Richter
  2026-03-25 12:06 ` [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable Thomas Richter
@ 2026-03-25 12:06 ` Thomas Richter
  2026-03-25 15:05   ` Ian Rogers
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Richter @ 2026-03-25 12:06 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter

Remove global variable addr2line_timeout_ms and add is as member
to symbol_conf structure. No functional change.

Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/util/addr2line.c   | 8 ++++----
 tools/perf/util/addr2line.h   | 2 --
 tools/perf/util/config.c      | 3 +--
 tools/perf/util/symbol_conf.h | 1 +
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
index e9f084db0802..1b7f66ece570 100644
--- a/tools/perf/util/addr2line.c
+++ b/tools/perf/util/addr2line.c
@@ -18,9 +18,6 @@
 
 #define MAX_INLINE_NEST 1024
 
-/* If addr2line doesn't return data for 5 seconds then timeout. */
-int addr2line_timeout_ms = 5 * 1000;
-
 static int filename_split(char *filename, unsigned int *line_nr)
 {
 	char *sep;
@@ -87,6 +84,9 @@ static struct child_process *addr2line_subprocess_init(const char *addr2line_pat
 		return NULL;
 	}
 
+	if (!symbol_conf.addr2line_timeout_ms)
+		symbol_conf.addr2line_timeout_ms = 5 * 1000;
+
 	return a2l;
 }
 
@@ -335,7 +335,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
 		goto out;
 	}
 	io__init(&io, a2l->out, buf, sizeof(buf));
-	io.timeout_ms = addr2line_timeout_ms;
+	io.timeout_ms = symbol_conf.addr2line_timeout_ms;
 	switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
 				      &record_function, &record_filename, &record_line_nr)) {
 	case -1:
diff --git a/tools/perf/util/addr2line.h b/tools/perf/util/addr2line.h
index d35a47ba8dab..75989a92f16b 100644
--- a/tools/perf/util/addr2line.h
+++ b/tools/perf/util/addr2line.h
@@ -8,8 +8,6 @@ struct dso;
 struct inline_node;
 struct symbol;
 
-extern int addr2line_timeout_ms;
-
 int cmd__addr2line(const char *dso_name, u64 addr,
 		   char **file, unsigned int *line_nr,
 		   struct dso *dso,
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 31541e03aab7..573b3a3f5999 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -19,7 +19,6 @@
 #include "util/hist.h"  /* perf_hist_config */
 #include "util/stat.h"  /* perf_stat__set_big_num */
 #include "util/evsel.h"  /* evsel__hw_names, evsel__use_bpf_counters */
-#include "util/addr2line.h"  /* addr2line_timeout_ms */
 #include "srcline.h"
 #include "build-id.h"
 #include "debug.h"
@@ -459,7 +458,7 @@ static int perf_default_core_config(const char *var, const char *value)
 		proc_map_timeout = strtoul(value, NULL, 10);
 
 	if (!strcmp(var, "core.addr2line-timeout"))
-		addr2line_timeout_ms = strtoul(value, NULL, 10);
+		symbol_conf.addr2line_timeout_ms = strtoul(value, NULL, 10);
 
 	if (!strcmp(var, "core.addr2line-disable-warn"))
 		symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);
diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
index ff229942fbb1..c86f4c0ca46b 100644
--- a/tools/perf/util/symbol_conf.h
+++ b/tools/perf/util/symbol_conf.h
@@ -80,6 +80,7 @@ struct symbol_conf {
 			*bt_stop_list_str;
 	const char		*addr2line_path;
 	enum a2l_style	addr2line_style[MAX_A2L_STYLE];
+	int             addr2line_timeout_ms;
 	unsigned long	time_quantum;
        struct strlist	*dso_list,
 			*comm_list,
-- 
2.53.0


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

* Re: [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn
  2026-03-25 12:06 ` [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn Thomas Richter
@ 2026-03-25 15:02   ` Ian Rogers
  2026-04-01 20:13     ` Ian Rogers
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Rogers @ 2026-03-25 15:02 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	agordeev, gor, sumanthk, hca, japo

On Wed, Mar 25, 2026 at 5:06 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> Rename member symbol_conf::disable_add2line_warn to
> symbol_conf::addr2line_disable_warn to make it consistent with other
> addr2line_xxx constants.
> No functional change.
>
> Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
> Cc: Ian Rogers <irogers@google.com>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/builtin-diff.c     |  4 ++--
>  tools/perf/util/addr2line.c   | 12 ++++++------
>  tools/perf/util/block-info.c  |  2 +-
>  tools/perf/util/libbfd.c      |  2 +-
>  tools/perf/util/symbol_conf.h |  2 +-
>  5 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
> index 59bf1f72d12e..8a93e56f4a7e 100644
> --- a/tools/perf/builtin-diff.c
> +++ b/tools/perf/builtin-diff.c
> @@ -1353,7 +1353,7 @@ static int cycles_printf(struct hist_entry *he, struct hist_entry *pair,
>         /*
>          * Avoid printing the warning "addr2line_init failed for ..."
>          */
> -       symbol_conf.disable_add2line_warn = true;
> +       symbol_conf.addr2line_disable_warn = true;
>
>         bi = block_he->block_info;
>
> @@ -1987,7 +1987,7 @@ int cmd_diff(int argc, const char **argv)
>
>         if (compute == COMPUTE_STREAM) {
>                 symbol_conf.show_branchflag_count = true;
> -               symbol_conf.disable_add2line_warn = true;
> +               symbol_conf.addr2line_disable_warn = true;
>                 callchain_param.mode = CHAIN_FLAT;
>                 callchain_param.key = CCKEY_SRCLINE;
>                 callchain_param.branch_callstack = 1;
> diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
> index 31c0391fffa3..e9f084db0802 100644
> --- a/tools/perf/util/addr2line.c
> +++ b/tools/perf/util/addr2line.c
> @@ -123,7 +123,7 @@ static enum cmd_a2l_style cmd_addr2line_configure(struct child_process *a2l, con
>                         lines = 3;
>                         pr_debug3("Detected binutils addr2line style\n");
>                 } else {
> -                       if (!symbol_conf.disable_add2line_warn) {
> +                       if (!symbol_conf.addr2line_disable_warn) {
>                                 char *output = NULL;
>                                 size_t output_len;
>
> @@ -310,7 +310,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>         }
>
>         if (a2l == NULL) {
> -               if (!symbol_conf.disable_add2line_warn)
> +               if (!symbol_conf.addr2line_disable_warn)
>                         pr_warning("%s %s: addr2line_subprocess_init failed\n", __func__, dso_name);
>                 goto out;
>         }
> @@ -330,7 +330,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>         len = snprintf(buf, sizeof(buf), "%016"PRIx64"\n,\n", addr);
>         written = len > 0 ? write(a2l->in, buf, len) : -1;
>         if (written != len) {
> -               if (!symbol_conf.disable_add2line_warn)
> +               if (!symbol_conf.addr2line_disable_warn)
>                         pr_warning("%s %s: could not send request\n", __func__, dso_name);
>                 goto out;
>         }
> @@ -339,7 +339,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>         switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
>                                       &record_function, &record_filename, &record_line_nr)) {
>         case -1:
> -               if (!symbol_conf.disable_add2line_warn)
> +               if (!symbol_conf.addr2line_disable_warn)
>                         pr_warning("%s %s: could not read first record\n", __func__, dso_name);
>                 goto out;
>         case 0:
> @@ -355,7 +355,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>                                               /*addr=*/1, /*first=*/true,
>                                               NULL, NULL, NULL)) {
>                 case -1:
> -                       if (!symbol_conf.disable_add2line_warn)
> +                       if (!symbol_conf.addr2line_disable_warn)
>                                 pr_warning("%s %s: could not read sentinel record\n",
>                                            __func__, dso_name);
>                         break;
> @@ -363,7 +363,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>                         /* The sentinel as expected. */
>                         break;
>                 default:
> -                       if (!symbol_conf.disable_add2line_warn)
> +                       if (!symbol_conf.addr2line_disable_warn)
>                                 pr_warning("%s %s: unexpected record instead of sentinel",
>                                            __func__, dso_name);
>                         break;
> diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c
> index 649392bee7ed..8d3a9a661f26 100644
> --- a/tools/perf/util/block-info.c
> +++ b/tools/perf/util/block-info.c
> @@ -303,7 +303,7 @@ static int block_range_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
>         char buf[128];
>         char *start_line, *end_line;
>
> -       symbol_conf.disable_add2line_warn = true;
> +       symbol_conf.addr2line_disable_warn = true;
>
>         start_line = map__srcline(he->ms.map, bi->sym->start + bi->start,
>                                   he->ms.sym);
> diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c
> index 63ea3fb53e77..c1c12308cc12 100644
> --- a/tools/perf/util/libbfd.c
> +++ b/tools/perf/util/libbfd.c
> @@ -233,7 +233,7 @@ int libbfd__addr2line(const char *dso_name, u64 addr,
>         }
>
>         if (a2l == NULL) {
> -               if (!symbol_conf.disable_add2line_warn)
> +               if (!symbol_conf.addr2line_disable_warn)
>                         pr_warning("addr2line_init failed for %s\n", dso_name);
>                 return 0;
>         }
> diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
> index 71bb17372a6c..ff229942fbb1 100644
> --- a/tools/perf/util/symbol_conf.h
> +++ b/tools/perf/util/symbol_conf.h
> @@ -51,7 +51,7 @@ struct symbol_conf {
>                         report_block,
>                         report_individual_block,
>                         inline_name,
> -                       disable_add2line_warn,
> +                       addr2line_disable_warn,
>                         no_buildid_mmap2,
>                         guest_code,
>                         lazy_load_kernel_maps,
> --
> 2.53.0
>

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

* Re: [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable
  2026-03-25 12:06 ` [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable Thomas Richter
@ 2026-03-25 15:03   ` Ian Rogers
  2026-04-02  0:01   ` Namhyung Kim
  1 sibling, 0 replies; 10+ messages in thread
From: Ian Rogers @ 2026-03-25 15:03 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	agordeev, gor, sumanthk, hca, japo

On Wed, Mar 25, 2026 at 5:06 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> Make symbol_conf::addr2line_disable_warn configurable by reading
> the perfconfig file. Use section core and addr2line-disable-warn =
> value.
>
> Example:
>  # perf config -l
>  core.addr2line-timeout=500
>  core.addr2line-disable-warn=1
>  #
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Cc: Ian Rogers <irogers@google.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/config.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 0452fbc6c085..31541e03aab7 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -461,6 +461,9 @@ static int perf_default_core_config(const char *var, const char *value)
>         if (!strcmp(var, "core.addr2line-timeout"))
>                 addr2line_timeout_ms = strtoul(value, NULL, 10);
>
> +       if (!strcmp(var, "core.addr2line-disable-warn"))
> +               symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);
> +
>         /* Add other config variables here. */
>         return 0;
>  }
> --
> 2.53.0
>

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

* Re: [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms
  2026-03-25 12:06 ` [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms Thomas Richter
@ 2026-03-25 15:05   ` Ian Rogers
  2026-04-02  0:03     ` Namhyung Kim
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Rogers @ 2026-03-25 15:05 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	agordeev, gor, sumanthk, hca, japo

On Wed, Mar 25, 2026 at 5:06 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> Remove global variable addr2line_timeout_ms and add is as member
> to symbol_conf structure. No functional change.
>
> Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
> Cc: Ian Rogers <irogers@google.com>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>

I'm a bit curious about the no functional change and the Fixes tag :-)
I think the trend for addr2line is to use libdw. The forking of both
objdump and addr2line is quite brittle and slow.

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/addr2line.c   | 8 ++++----
>  tools/perf/util/addr2line.h   | 2 --
>  tools/perf/util/config.c      | 3 +--
>  tools/perf/util/symbol_conf.h | 1 +
>  4 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
> index e9f084db0802..1b7f66ece570 100644
> --- a/tools/perf/util/addr2line.c
> +++ b/tools/perf/util/addr2line.c
> @@ -18,9 +18,6 @@
>
>  #define MAX_INLINE_NEST 1024
>
> -/* If addr2line doesn't return data for 5 seconds then timeout. */
> -int addr2line_timeout_ms = 5 * 1000;
> -
>  static int filename_split(char *filename, unsigned int *line_nr)
>  {
>         char *sep;
> @@ -87,6 +84,9 @@ static struct child_process *addr2line_subprocess_init(const char *addr2line_pat
>                 return NULL;
>         }
>
> +       if (!symbol_conf.addr2line_timeout_ms)
> +               symbol_conf.addr2line_timeout_ms = 5 * 1000;
> +
>         return a2l;
>  }
>
> @@ -335,7 +335,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
>                 goto out;
>         }
>         io__init(&io, a2l->out, buf, sizeof(buf));
> -       io.timeout_ms = addr2line_timeout_ms;
> +       io.timeout_ms = symbol_conf.addr2line_timeout_ms;
>         switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
>                                       &record_function, &record_filename, &record_line_nr)) {
>         case -1:
> diff --git a/tools/perf/util/addr2line.h b/tools/perf/util/addr2line.h
> index d35a47ba8dab..75989a92f16b 100644
> --- a/tools/perf/util/addr2line.h
> +++ b/tools/perf/util/addr2line.h
> @@ -8,8 +8,6 @@ struct dso;
>  struct inline_node;
>  struct symbol;
>
> -extern int addr2line_timeout_ms;
> -
>  int cmd__addr2line(const char *dso_name, u64 addr,
>                    char **file, unsigned int *line_nr,
>                    struct dso *dso,
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 31541e03aab7..573b3a3f5999 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -19,7 +19,6 @@
>  #include "util/hist.h"  /* perf_hist_config */
>  #include "util/stat.h"  /* perf_stat__set_big_num */
>  #include "util/evsel.h"  /* evsel__hw_names, evsel__use_bpf_counters */
> -#include "util/addr2line.h"  /* addr2line_timeout_ms */
>  #include "srcline.h"
>  #include "build-id.h"
>  #include "debug.h"
> @@ -459,7 +458,7 @@ static int perf_default_core_config(const char *var, const char *value)
>                 proc_map_timeout = strtoul(value, NULL, 10);
>
>         if (!strcmp(var, "core.addr2line-timeout"))
> -               addr2line_timeout_ms = strtoul(value, NULL, 10);
> +               symbol_conf.addr2line_timeout_ms = strtoul(value, NULL, 10);
>
>         if (!strcmp(var, "core.addr2line-disable-warn"))
>                 symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);
> diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
> index ff229942fbb1..c86f4c0ca46b 100644
> --- a/tools/perf/util/symbol_conf.h
> +++ b/tools/perf/util/symbol_conf.h
> @@ -80,6 +80,7 @@ struct symbol_conf {
>                         *bt_stop_list_str;
>         const char              *addr2line_path;
>         enum a2l_style  addr2line_style[MAX_A2L_STYLE];
> +       int             addr2line_timeout_ms;
>         unsigned long   time_quantum;
>         struct strlist  *dso_list,
>                         *comm_list,
> --
> 2.53.0
>

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

* Re: [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn
  2026-03-25 15:02   ` Ian Rogers
@ 2026-04-01 20:13     ` Ian Rogers
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Rogers @ 2026-04-01 20:13 UTC (permalink / raw)
  To: namhyung, acme
  Cc: linux-kernel, linux-s390, linux-perf-users, agordeev, gor,
	sumanthk, hca, japo, Thomas Richter

On Wed, Mar 25, 2026 at 8:02 AM Ian Rogers <irogers@google.com> wrote:
>
> On Wed, Mar 25, 2026 at 5:06 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
> >
> > Rename member symbol_conf::disable_add2line_warn to
> > symbol_conf::addr2line_disable_warn to make it consistent with other
> > addr2line_xxx constants.
> > No functional change.
> >
> > Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
> > Cc: Ian Rogers <irogers@google.com>
> > Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
>
> Reviewed-by: Ian Rogers <irogers@google.com>

Ping. Thanks,
Ian

> Thanks,
> Ian
>
> > ---
> >  tools/perf/builtin-diff.c     |  4 ++--
> >  tools/perf/util/addr2line.c   | 12 ++++++------
> >  tools/perf/util/block-info.c  |  2 +-
> >  tools/perf/util/libbfd.c      |  2 +-
> >  tools/perf/util/symbol_conf.h |  2 +-
> >  5 files changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
> > index 59bf1f72d12e..8a93e56f4a7e 100644
> > --- a/tools/perf/builtin-diff.c
> > +++ b/tools/perf/builtin-diff.c
> > @@ -1353,7 +1353,7 @@ static int cycles_printf(struct hist_entry *he, struct hist_entry *pair,
> >         /*
> >          * Avoid printing the warning "addr2line_init failed for ..."
> >          */
> > -       symbol_conf.disable_add2line_warn = true;
> > +       symbol_conf.addr2line_disable_warn = true;
> >
> >         bi = block_he->block_info;
> >
> > @@ -1987,7 +1987,7 @@ int cmd_diff(int argc, const char **argv)
> >
> >         if (compute == COMPUTE_STREAM) {
> >                 symbol_conf.show_branchflag_count = true;
> > -               symbol_conf.disable_add2line_warn = true;
> > +               symbol_conf.addr2line_disable_warn = true;
> >                 callchain_param.mode = CHAIN_FLAT;
> >                 callchain_param.key = CCKEY_SRCLINE;
> >                 callchain_param.branch_callstack = 1;
> > diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
> > index 31c0391fffa3..e9f084db0802 100644
> > --- a/tools/perf/util/addr2line.c
> > +++ b/tools/perf/util/addr2line.c
> > @@ -123,7 +123,7 @@ static enum cmd_a2l_style cmd_addr2line_configure(struct child_process *a2l, con
> >                         lines = 3;
> >                         pr_debug3("Detected binutils addr2line style\n");
> >                 } else {
> > -                       if (!symbol_conf.disable_add2line_warn) {
> > +                       if (!symbol_conf.addr2line_disable_warn) {
> >                                 char *output = NULL;
> >                                 size_t output_len;
> >
> > @@ -310,7 +310,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >         }
> >
> >         if (a2l == NULL) {
> > -               if (!symbol_conf.disable_add2line_warn)
> > +               if (!symbol_conf.addr2line_disable_warn)
> >                         pr_warning("%s %s: addr2line_subprocess_init failed\n", __func__, dso_name);
> >                 goto out;
> >         }
> > @@ -330,7 +330,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >         len = snprintf(buf, sizeof(buf), "%016"PRIx64"\n,\n", addr);
> >         written = len > 0 ? write(a2l->in, buf, len) : -1;
> >         if (written != len) {
> > -               if (!symbol_conf.disable_add2line_warn)
> > +               if (!symbol_conf.addr2line_disable_warn)
> >                         pr_warning("%s %s: could not send request\n", __func__, dso_name);
> >                 goto out;
> >         }
> > @@ -339,7 +339,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >         switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
> >                                       &record_function, &record_filename, &record_line_nr)) {
> >         case -1:
> > -               if (!symbol_conf.disable_add2line_warn)
> > +               if (!symbol_conf.addr2line_disable_warn)
> >                         pr_warning("%s %s: could not read first record\n", __func__, dso_name);
> >                 goto out;
> >         case 0:
> > @@ -355,7 +355,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >                                               /*addr=*/1, /*first=*/true,
> >                                               NULL, NULL, NULL)) {
> >                 case -1:
> > -                       if (!symbol_conf.disable_add2line_warn)
> > +                       if (!symbol_conf.addr2line_disable_warn)
> >                                 pr_warning("%s %s: could not read sentinel record\n",
> >                                            __func__, dso_name);
> >                         break;
> > @@ -363,7 +363,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >                         /* The sentinel as expected. */
> >                         break;
> >                 default:
> > -                       if (!symbol_conf.disable_add2line_warn)
> > +                       if (!symbol_conf.addr2line_disable_warn)
> >                                 pr_warning("%s %s: unexpected record instead of sentinel",
> >                                            __func__, dso_name);
> >                         break;
> > diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c
> > index 649392bee7ed..8d3a9a661f26 100644
> > --- a/tools/perf/util/block-info.c
> > +++ b/tools/perf/util/block-info.c
> > @@ -303,7 +303,7 @@ static int block_range_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
> >         char buf[128];
> >         char *start_line, *end_line;
> >
> > -       symbol_conf.disable_add2line_warn = true;
> > +       symbol_conf.addr2line_disable_warn = true;
> >
> >         start_line = map__srcline(he->ms.map, bi->sym->start + bi->start,
> >                                   he->ms.sym);
> > diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c
> > index 63ea3fb53e77..c1c12308cc12 100644
> > --- a/tools/perf/util/libbfd.c
> > +++ b/tools/perf/util/libbfd.c
> > @@ -233,7 +233,7 @@ int libbfd__addr2line(const char *dso_name, u64 addr,
> >         }
> >
> >         if (a2l == NULL) {
> > -               if (!symbol_conf.disable_add2line_warn)
> > +               if (!symbol_conf.addr2line_disable_warn)
> >                         pr_warning("addr2line_init failed for %s\n", dso_name);
> >                 return 0;
> >         }
> > diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
> > index 71bb17372a6c..ff229942fbb1 100644
> > --- a/tools/perf/util/symbol_conf.h
> > +++ b/tools/perf/util/symbol_conf.h
> > @@ -51,7 +51,7 @@ struct symbol_conf {
> >                         report_block,
> >                         report_individual_block,
> >                         inline_name,
> > -                       disable_add2line_warn,
> > +                       addr2line_disable_warn,
> >                         no_buildid_mmap2,
> >                         guest_code,
> >                         lazy_load_kernel_maps,
> > --
> > 2.53.0
> >

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

* Re: [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable
  2026-03-25 12:06 ` [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable Thomas Richter
  2026-03-25 15:03   ` Ian Rogers
@ 2026-04-02  0:01   ` Namhyung Kim
  1 sibling, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2026-04-02  0:01 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, irogers,
	agordeev, gor, sumanthk, hca, japo

On Wed, Mar 25, 2026 at 01:06:25PM +0100, Thomas Richter wrote:
> Make symbol_conf::addr2line_disable_warn configurable by reading
> the perfconfig file. Use section core and addr2line-disable-warn =
> value.
> 
> Example:
>  # perf config -l
>  core.addr2line-timeout=500
>  core.addr2line-disable-warn=1
>  #
> 
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Cc: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/config.c | 3 +++
>  1 file changed, 3 insertions(+)

Can you please update Documentation/perf-config.txt as well?

> 
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 0452fbc6c085..31541e03aab7 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -461,6 +461,9 @@ static int perf_default_core_config(const char *var, const char *value)
>  	if (!strcmp(var, "core.addr2line-timeout"))
>  		addr2line_timeout_ms = strtoul(value, NULL, 10);
>  
> +	if (!strcmp(var, "core.addr2line-disable-warn"))
> +		symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);

Sashiko review: Please use perf_config_bool().

Thanks,
Namhyung

> +
>  	/* Add other config variables here. */
>  	return 0;
>  }
> -- 
> 2.53.0
> 

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

* Re: [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms
  2026-03-25 15:05   ` Ian Rogers
@ 2026-04-02  0:03     ` Namhyung Kim
  0 siblings, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2026-04-02  0:03 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Thomas Richter, linux-kernel, linux-s390, linux-perf-users, acme,
	agordeev, gor, sumanthk, hca, japo

On Wed, Mar 25, 2026 at 08:05:22AM -0700, Ian Rogers wrote:
> On Wed, Mar 25, 2026 at 5:06 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
> >
> > Remove global variable addr2line_timeout_ms and add is as member
> > to symbol_conf structure. No functional change.
> >
> > Fixes: 257046a36750a ("perf srcline: Fallback between addr2line implementations")
> > Cc: Ian Rogers <irogers@google.com>
> > Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> 
> I'm a bit curious about the no functional change and the Fixes tag :-)

Right, it should belong somewhere else.


> I think the trend for addr2line is to use libdw. The forking of both
> objdump and addr2line is quite brittle and slow.
> 
> Reviewed-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian
> 
> > ---
> >  tools/perf/util/addr2line.c   | 8 ++++----
> >  tools/perf/util/addr2line.h   | 2 --
> >  tools/perf/util/config.c      | 3 +--
> >  tools/perf/util/symbol_conf.h | 1 +
> >  4 files changed, 6 insertions(+), 8 deletions(-)
> >
> > diff --git a/tools/perf/util/addr2line.c b/tools/perf/util/addr2line.c
> > index e9f084db0802..1b7f66ece570 100644
> > --- a/tools/perf/util/addr2line.c
> > +++ b/tools/perf/util/addr2line.c
> > @@ -18,9 +18,6 @@
> >
> >  #define MAX_INLINE_NEST 1024
> >
> > -/* If addr2line doesn't return data for 5 seconds then timeout. */
> > -int addr2line_timeout_ms = 5 * 1000;
> > -
> >  static int filename_split(char *filename, unsigned int *line_nr)
> >  {
> >         char *sep;
> > @@ -87,6 +84,9 @@ static struct child_process *addr2line_subprocess_init(const char *addr2line_pat
> >                 return NULL;
> >         }
> >
> > +       if (!symbol_conf.addr2line_timeout_ms)
> > +               symbol_conf.addr2line_timeout_ms = 5 * 1000;

Please put this in the util/symbol.c where the symbol_conf is defined.

Thanks,
Namhyung


> > +
> >         return a2l;
> >  }
> >
> > @@ -335,7 +335,7 @@ int cmd__addr2line(const char *dso_name, u64 addr,
> >                 goto out;
> >         }
> >         io__init(&io, a2l->out, buf, sizeof(buf));
> > -       io.timeout_ms = addr2line_timeout_ms;
> > +       io.timeout_ms = symbol_conf.addr2line_timeout_ms;
> >         switch (read_addr2line_record(&io, cmd_a2l_style, dso_name, addr, /*first=*/true,
> >                                       &record_function, &record_filename, &record_line_nr)) {
> >         case -1:
> > diff --git a/tools/perf/util/addr2line.h b/tools/perf/util/addr2line.h
> > index d35a47ba8dab..75989a92f16b 100644
> > --- a/tools/perf/util/addr2line.h
> > +++ b/tools/perf/util/addr2line.h
> > @@ -8,8 +8,6 @@ struct dso;
> >  struct inline_node;
> >  struct symbol;
> >
> > -extern int addr2line_timeout_ms;
> > -
> >  int cmd__addr2line(const char *dso_name, u64 addr,
> >                    char **file, unsigned int *line_nr,
> >                    struct dso *dso,
> > diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> > index 31541e03aab7..573b3a3f5999 100644
> > --- a/tools/perf/util/config.c
> > +++ b/tools/perf/util/config.c
> > @@ -19,7 +19,6 @@
> >  #include "util/hist.h"  /* perf_hist_config */
> >  #include "util/stat.h"  /* perf_stat__set_big_num */
> >  #include "util/evsel.h"  /* evsel__hw_names, evsel__use_bpf_counters */
> > -#include "util/addr2line.h"  /* addr2line_timeout_ms */
> >  #include "srcline.h"
> >  #include "build-id.h"
> >  #include "debug.h"
> > @@ -459,7 +458,7 @@ static int perf_default_core_config(const char *var, const char *value)
> >                 proc_map_timeout = strtoul(value, NULL, 10);
> >
> >         if (!strcmp(var, "core.addr2line-timeout"))
> > -               addr2line_timeout_ms = strtoul(value, NULL, 10);
> > +               symbol_conf.addr2line_timeout_ms = strtoul(value, NULL, 10);
> >
> >         if (!strcmp(var, "core.addr2line-disable-warn"))
> >                 symbol_conf.addr2line_disable_warn = strtoul(value, NULL, 10);
> > diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_conf.h
> > index ff229942fbb1..c86f4c0ca46b 100644
> > --- a/tools/perf/util/symbol_conf.h
> > +++ b/tools/perf/util/symbol_conf.h
> > @@ -80,6 +80,7 @@ struct symbol_conf {
> >                         *bt_stop_list_str;
> >         const char              *addr2line_path;
> >         enum a2l_style  addr2line_style[MAX_A2L_STYLE];
> > +       int             addr2line_timeout_ms;
> >         unsigned long   time_quantum;
> >         struct strlist  *dso_list,
> >                         *comm_list,
> > --
> > 2.53.0
> >

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

end of thread, other threads:[~2026-04-02  0:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 12:06 [PATCH 0/3] perf addr2line: Rework disable_add2line_warn Thomas Richter
2026-03-25 12:06 ` [PATCH 1/3] perf config: Rename symbol_conf::disable_add2line_warn Thomas Richter
2026-03-25 15:02   ` Ian Rogers
2026-04-01 20:13     ` Ian Rogers
2026-03-25 12:06 ` [PATCH 2/3] perf config: Make symbol_conf::addr2line_disable_warn configurable Thomas Richter
2026-03-25 15:03   ` Ian Rogers
2026-04-02  0:01   ` Namhyung Kim
2026-03-25 12:06 ` [PATCH 3/3] perf addr2line: Remove global variable addr2line_timeout_ms Thomas Richter
2026-03-25 15:05   ` Ian Rogers
2026-04-02  0:03     ` Namhyung Kim

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