Skip to content

Commit 7b36614

Browse files
committed
perf report: Fix switching to another perf.data file
In the TUI the 's' hotkey can be used to switch to another perf.data file in the current directory, but that got broken in Fixes: b01141f ("perf annotate: Initialize the priv are in symbol__new()"), that would show this once another file was chosen: ┌─Fatal Error─────────────────────────────────────┐ │Annotation needs to be init before symbol__init()│ │ │ │ │ │Press any key... │ └─────────────────────────────────────────────────┘ Fix it by just silently bailing out if symbol__annotation_init() was already called, just like is done with symbol__init(), i.e. they are done just once at session start, not when switching to a new perf.data file. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Martin Liška <mliska@suse.cz> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> Cc: Thomas Richter <tmricht@linux.vnet.ibm.com> Cc: Wang Nan <wangnan0@huawei.com> Fixes: b01141f ("perf annotate: Initialize the priv are in symbol__new()") Link: https://lkml.kernel.org/n/tip-ogppdtpzfax7y1h6gjdv5s6u@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4f75f1c commit 7b36614

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎tools/perf/util/symbol.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,16 +2091,14 @@ static bool symbol__read_kptr_restrict(void)
20912091

20922092
int symbol__annotation_init(void)
20932093
{
2094+
if (symbol_conf.init_annotation)
2095+
return 0;
2096+
20942097
if (symbol_conf.initialized) {
20952098
pr_err("Annotation needs to be init before symbol__init()\n");
20962099
return -1;
20972100
}
20982101

2099-
if (symbol_conf.init_annotation) {
2100-
pr_warning("Annotation being initialized multiple times\n");
2101-
return 0;
2102-
}
2103-
21042102
symbol_conf.priv_size += sizeof(struct annotation);
21052103
symbol_conf.init_annotation = true;
21062104
return 0;

0 commit comments

Comments
 (0)