* [PATCH 1/2] perf, tools: Fix crash while reading old perf.data @ 2014-11-21 21:37 Andi Kleen 2014-11-21 21:38 ` [PATCH 2/2] perf, tools: Allow to force redirect pr_debug to stderr Andi Kleen 2014-11-25 9:53 ` [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Jiri Olsa 0 siblings, 2 replies; 4+ messages in thread From: Andi Kleen @ 2014-11-21 21:37 UTC (permalink / raw) To: acme; +Cc: jolsa, linux-kernel, namhyung, Andi Kleen From: Andi Kleen <ak@linux.intel.com> In some cases when reading perf.data generated by much older perf I got segfaults with dso->long_name being zero. This patch fixes them for me. Haven't tracked down the exact cause. I assume it's some error path that doesn't set it. Signed-off-by: Andi Kleen <ak@linux.intel.com> --- tools/perf/util/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 52e9490..6266041 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1106,7 +1106,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine, if (__machine__create_kernel_maps(machine, kernel) < 0) goto out_problem; - if (strstr(dso->long_name, "vmlinux")) + if (dso->long_name && strstr(dso->long_name, "vmlinux")) dso__set_short_name(dso, "[kernel.vmlinux]", false); machine__set_kernel_mmap_len(machine, event); -- 1.9.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] perf, tools: Allow to force redirect pr_debug to stderr. 2014-11-21 21:37 [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Andi Kleen @ 2014-11-21 21:38 ` Andi Kleen 2014-12-08 6:50 ` [tip:perf/core] perf " tip-bot for Andi Kleen 2014-11-25 9:53 ` [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Jiri Olsa 1 sibling, 1 reply; 4+ messages in thread From: Andi Kleen @ 2014-11-21 21:38 UTC (permalink / raw) To: acme; +Cc: jolsa, linux-kernel, namhyung, Andi Kleen From: Andi Kleen <ak@linux.intel.com> When debugging the tui browser I find it useful to redirect the debug log into a file. Currently it's always forced to the message line. Add an option to force it to stderr. Then it can be easily redirected. Signed-off-by: Andi Kleen <ak@linux.intel.com> --- tools/perf/util/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index ba357f3..ad60b2f 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -19,13 +19,14 @@ int verbose; bool dump_trace = false, quiet = false; int debug_ordered_events; +static int redirect_to_stderr; static int _eprintf(int level, int var, const char *fmt, va_list args) { int ret = 0; if (var >= level) { - if (use_browser >= 1) + if (use_browser >= 1 && !redirect_to_stderr) ui_helpline__vshow(fmt, args); else ret = vfprintf(stderr, fmt, args); @@ -145,6 +146,7 @@ static struct debug_variable { } debug_variables[] = { { .name = "verbose", .ptr = &verbose }, { .name = "ordered-events", .ptr = &debug_ordered_events}, + { .name = "stderr", .ptr = &redirect_to_stderr}, { .name = NULL, } }; -- 1.9.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] perf tools: Allow to force redirect pr_debug to stderr. 2014-11-21 21:38 ` [PATCH 2/2] perf, tools: Allow to force redirect pr_debug to stderr Andi Kleen @ 2014-12-08 6:50 ` tip-bot for Andi Kleen 0 siblings, 0 replies; 4+ messages in thread From: tip-bot for Andi Kleen @ 2014-12-08 6:50 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, namhyung, jolsa, acme, mingo, hpa, tglx, ak Commit-ID: f78eaef0e0493f6068777a246b9c4d9d5cf2b7aa Gitweb: http://git.kernel.org/tip/f78eaef0e0493f6068777a246b9c4d9d5cf2b7aa Author: Andi Kleen <ak@linux.intel.com> AuthorDate: Fri, 21 Nov 2014 13:38:00 -0800 Committer: Arnaldo Carvalho de Melo <acme@redhat.com> CommitDate: Mon, 24 Nov 2014 18:03:48 -0300 perf tools: Allow to force redirect pr_debug to stderr. When debugging the tui browser I find it useful to redirect the debug log into a file. Currently it's always forced to the message line. Add an option to force it to stderr. Then it can be easily redirected. Example: [root@zoo ~]# perf --debug stderr report -vv 2> /tmp/debug [root@zoo ~]# tail /tmp/debug dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory dso open failed, mmap: No such file or directory Using /root/.debug/.build-id/4e/841948927029fb650132253642d5dbb2c1fb93 for symbols Failed to open /tmp/perf-8831.map, continuing without symbols Failed to open /tmp/perf-12721.map, continuing without symbols Failed to open /tmp/perf-6966.map, continuing without symbols Failed to open /tmp/perf-8802.map, continuing without symbols [root@zoo ~]# Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1416605880-25055-2-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/util/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index ba357f3..ad60b2f 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -19,13 +19,14 @@ int verbose; bool dump_trace = false, quiet = false; int debug_ordered_events; +static int redirect_to_stderr; static int _eprintf(int level, int var, const char *fmt, va_list args) { int ret = 0; if (var >= level) { - if (use_browser >= 1) + if (use_browser >= 1 && !redirect_to_stderr) ui_helpline__vshow(fmt, args); else ret = vfprintf(stderr, fmt, args); @@ -145,6 +146,7 @@ static struct debug_variable { } debug_variables[] = { { .name = "verbose", .ptr = &verbose }, { .name = "ordered-events", .ptr = &debug_ordered_events}, + { .name = "stderr", .ptr = &redirect_to_stderr}, { .name = NULL, } }; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] perf, tools: Fix crash while reading old perf.data 2014-11-21 21:37 [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Andi Kleen 2014-11-21 21:38 ` [PATCH 2/2] perf, tools: Allow to force redirect pr_debug to stderr Andi Kleen @ 2014-11-25 9:53 ` Jiri Olsa 1 sibling, 0 replies; 4+ messages in thread From: Jiri Olsa @ 2014-11-25 9:53 UTC (permalink / raw) To: Andi Kleen; +Cc: acme, linux-kernel, namhyung, Andi Kleen On Fri, Nov 21, 2014 at 01:37:59PM -0800, Andi Kleen wrote: > From: Andi Kleen <ak@linux.intel.com> > > In some cases when reading perf.data generated by much > older perf I got segfaults with dso->long_name being zero. > This patch fixes them for me. > > Haven't tracked down the exact cause. I assume it's > some error path that doesn't set it. Any chance this patch fixies it for you? 330dfa224fcc perf tools: Fix segfault due to invalid kernel dso access it's on latest acme/perf/core jirka > > Signed-off-by: Andi Kleen <ak@linux.intel.com> > --- > tools/perf/util/machine.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index 52e9490..6266041 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -1106,7 +1106,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine, > if (__machine__create_kernel_maps(machine, kernel) < 0) > goto out_problem; > > - if (strstr(dso->long_name, "vmlinux")) > + if (dso->long_name && strstr(dso->long_name, "vmlinux")) > dso__set_short_name(dso, "[kernel.vmlinux]", false); > > machine__set_kernel_mmap_len(machine, event); > -- > 1.9.3 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-08 6:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-11-21 21:37 [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Andi Kleen 2014-11-21 21:38 ` [PATCH 2/2] perf, tools: Allow to force redirect pr_debug to stderr Andi Kleen 2014-12-08 6:50 ` [tip:perf/core] perf " tip-bot for Andi Kleen 2014-11-25 9:53 ` [PATCH 1/2] perf, tools: Fix crash while reading old perf.data Jiri Olsa
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®