]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf addr2line: Remove global variable addr2line_timeout_ms
authorThomas Richter <tmricht@linux.ibm.com>
Tue, 7 Apr 2026 10:08:35 +0000 (12:08 +0200)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 8 Apr 2026 17:28:49 +0000 (10:28 -0700)
Remove global variable addr2line_timeout_ms and add it as a member
to symbol_conf structure.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
[namhyung: move the initialization to util/symbol.c]
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/addr2line.c
tools/perf/util/addr2line.h
tools/perf/util/config.c
tools/perf/util/symbol.c
tools/perf/util/symbol_conf.h

index e9f084db0802bbe54d18226f50fb148a4e087ee2..4b0d349ed334b5ce69f76cea0db643f8e2ca4c66 100644 (file)
@@ -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;
@@ -335,7 +332,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:
index d35a47ba8dabf90a99ee6c0b094ccdbf79ba6e64..75989a92f16b1174f36783c491b90454d965d975 100644 (file)
@@ -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,
index 8e30def2b1f7affd834d343818c284665c875112..087002fb1b9bc8a84ebe13246e244ec4c3bfe5ca 100644 (file)
@@ -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 = perf_config_bool(var, value);
index b4b30675688dbda5bf39ecf1faef6c5ec12ae287..94745a12973f859c41f1cd35126196b1fb5efc8a 100644 (file)
@@ -69,6 +69,7 @@ struct symbol_conf symbol_conf = {
        .event_group            = true,
        .inline_name            = true,
        .res_sample             = 0,
+       .addr2line_timeout_ms   = 5 * 1000,
 };
 
 struct map_list_node {
index 21a1f096d4f0d0ca937f052502ace5a4d5541cf1..6cd454d7c98e6b094864b22047054b5b56c761da 100644 (file)
@@ -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,