* [PATCH] perf probe: Fix bug in perf probe with global variables
@ 2015-04-25 8:08 He Kuang
2015-04-26 0:56 ` Masami Hiramatsu
2015-05-01 10:15 ` [tip:perf/urgent] perf probe: Fix bug with global variables handling tip-bot for He Kuang
0 siblings, 2 replies; 4+ messages in thread
From: He Kuang @ 2015-04-25 8:08 UTC (permalink / raw)
To: masami.hiramatsu.pt, acme, a.p.zijlstra, mingo, paulus
Cc: wangnan0, linux-kernel
There are missing curly braces which causes find_variable() return wrong
value when probing with global variables.
This problem can be reproduced as following:
$ perf probe -v --add='generic_perform_write global_variable_for_test'
...
Try to find probe point from debuginfo.
Probe point found: generic_perform_write+0
Searching 'global_variable_for_test' variable in context.
An error occurred in debuginfo analysis (-2).
Error: Failed to add events. Reason: No such file or directory (Code: -2)
After this patch:
$ perf probe -v --add='generic_perform_write global_variable_for_test'
...
Converting variable global_variable_for_test into trace event.
global_variable_for_test type is int.
Found 1 probe_trace_events.
Opening /sys/kernel/debug/tracing/kprobe_events write=1
Added new event:
Writing event: p:probe/generic_perform_write _stext+1237464
global_variable_for_test=@global_variable_for_test+0:s32
probe:generic_perform_write (on generic_perform_write with
global_variable_for_test)
You can now use it in all perf tools, such as:
perf record -e probe:generic_perform_write -aR sleep 1
Signed-off-by: He Kuang <hekuang@huawei.com>
---
tools/perf/util/probe-finder.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 44554c3..1c3cc07 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -578,10 +578,12 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
/* Search child die for local variables and parameters. */
if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) {
/* Search again in global variables */
- if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die))
+ if (!die_find_variable_at(&pf->cu_die, pf->pvar->var,
+ 0, &vr_die)) {
pr_warning("Failed to find '%s' in this function.\n",
pf->pvar->var);
ret = -ENOENT;
+ }
}
if (ret >= 0)
ret = convert_variable(&vr_die, pf);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf probe: Fix bug in perf probe with global variables
2015-04-25 8:08 [PATCH] perf probe: Fix bug in perf probe with global variables He Kuang
@ 2015-04-26 0:56 ` Masami Hiramatsu
2015-04-27 16:38 ` Arnaldo Carvalho de Melo
2015-05-01 10:15 ` [tip:perf/urgent] perf probe: Fix bug with global variables handling tip-bot for He Kuang
1 sibling, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2015-04-26 0:56 UTC (permalink / raw)
To: He Kuang; +Cc: acme, a.p.zijlstra, mingo, paulus, wangnan0, linux-kernel
(2015/04/25 17:08), He Kuang wrote:
> There are missing curly braces which causes find_variable() return wrong
> value when probing with global variables.
>
> This problem can be reproduced as following:
>
> $ perf probe -v --add='generic_perform_write global_variable_for_test'
> ...
> Try to find probe point from debuginfo.
> Probe point found: generic_perform_write+0
> Searching 'global_variable_for_test' variable in context.
> An error occurred in debuginfo analysis (-2).
> Error: Failed to add events. Reason: No such file or directory (Code: -2)
>
> After this patch:
>
> $ perf probe -v --add='generic_perform_write global_variable_for_test'
> ...
> Converting variable global_variable_for_test into trace event.
> global_variable_for_test type is int.
> Found 1 probe_trace_events.
> Opening /sys/kernel/debug/tracing/kprobe_events write=1
> Added new event:
> Writing event: p:probe/generic_perform_write _stext+1237464
> global_variable_for_test=@global_variable_for_test+0:s32
> probe:generic_perform_write (on generic_perform_write with
> global_variable_for_test)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe:generic_perform_write -aR sleep 1
Oops, that's my fault! :(
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thank you!!
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
> tools/perf/util/probe-finder.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 44554c3..1c3cc07 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -578,10 +578,12 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
> /* Search child die for local variables and parameters. */
> if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) {
> /* Search again in global variables */
> - if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die))
> + if (!die_find_variable_at(&pf->cu_die, pf->pvar->var,
> + 0, &vr_die)) {
> pr_warning("Failed to find '%s' in this function.\n",
> pf->pvar->var);
> ret = -ENOENT;
> + }
> }
> if (ret >= 0)
> ret = convert_variable(&vr_die, pf);
>
--
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf probe: Fix bug in perf probe with global variables
2015-04-26 0:56 ` Masami Hiramatsu
@ 2015-04-27 16:38 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-04-27 16:38 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: He Kuang, a.p.zijlstra, mingo, paulus, wangnan0, linux-kernel
Em Sun, Apr 26, 2015 at 09:56:06AM +0900, Masami Hiramatsu escreveu:
> (2015/04/25 17:08), He Kuang wrote:
> > There are missing curly braces which causes find_variable() return wrong
> > value when probing with global variables.
> >
> > This problem can be reproduced as following:
> >
> > $ perf probe -v --add='generic_perform_write global_variable_for_test'
> > ...
> > Try to find probe point from debuginfo.
> > Probe point found: generic_perform_write+0
> > Searching 'global_variable_for_test' variable in context.
> > An error occurred in debuginfo analysis (-2).
> > Error: Failed to add events. Reason: No such file or directory (Code: -2)
> >
> > After this patch:
> >
> > $ perf probe -v --add='generic_perform_write global_variable_for_test'
> > ...
> > Converting variable global_variable_for_test into trace event.
> > global_variable_for_test type is int.
> > Found 1 probe_trace_events.
> > Opening /sys/kernel/debug/tracing/kprobe_events write=1
> > Added new event:
> > Writing event: p:probe/generic_perform_write _stext+1237464
> > global_variable_for_test=@global_variable_for_test+0:s32
> > probe:generic_perform_write (on generic_perform_write with
> > global_variable_for_test)
> >
> > You can now use it in all perf tools, such as:
> >
> > perf record -e probe:generic_perform_write -aR sleep 1
>
> Oops, that's my fault! :(
>
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>
> Thank you!!
Thanks, applied to perf/urgent.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/urgent] perf probe: Fix bug with global variables handling
2015-04-25 8:08 [PATCH] perf probe: Fix bug in perf probe with global variables He Kuang
2015-04-26 0:56 ` Masami Hiramatsu
@ 2015-05-01 10:15 ` tip-bot for He Kuang
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for He Kuang @ 2015-05-01 10:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, a.p.zijlstra, paulus, mingo, tglx, hpa, linux-kernel,
masami.hiramatsu.pt, hekuang, wangnan0
Commit-ID: d13855ef18e1852b2c4dc86ddf5759c5b34628cb
Gitweb: http://git.kernel.org/tip/d13855ef18e1852b2c4dc86ddf5759c5b34628cb
Author: He Kuang <hekuang@huawei.com>
AuthorDate: Sat, 25 Apr 2015 16:08:58 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 27 Apr 2015 13:57:29 -0300
perf probe: Fix bug with global variables handling
There are missing curly braces which causes find_variable() return wrong
value when probing with global variables.
This problem can be reproduced as following:
$ perf probe -v --add='generic_perform_write global_variable_for_test'
...
Try to find probe point from debuginfo.
Probe point found: generic_perform_write+0
Searching 'global_variable_for_test' variable in context.
An error occurred in debuginfo analysis (-2).
Error: Failed to add events. Reason: No such file or directory (Code: -2)
After this patch:
$ perf probe -v --add='generic_perform_write global_variable_for_test'
...
Converting variable global_variable_for_test into trace event.
global_variable_for_test type is int.
Found 1 probe_trace_events.
Opening /sys/kernel/debug/tracing/kprobe_events write=1
Added new event:
Writing event: p:probe/generic_perform_write _stext+1237464
global_variable_for_test=@global_variable_for_test+0:s32
probe:generic_perform_write (on generic_perform_write with
global_variable_for_test)
You can now use it in all perf tools, such as:
perf record -e probe:generic_perform_write -aR sleep 1
Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1429949338-18678-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-finder.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 44554c3..1c3cc07 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -578,10 +578,12 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
/* Search child die for local variables and parameters. */
if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) {
/* Search again in global variables */
- if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die))
+ if (!die_find_variable_at(&pf->cu_die, pf->pvar->var,
+ 0, &vr_die)) {
pr_warning("Failed to find '%s' in this function.\n",
pf->pvar->var);
ret = -ENOENT;
+ }
}
if (ret >= 0)
ret = convert_variable(&vr_die, pf);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-01 10:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 8:08 [PATCH] perf probe: Fix bug in perf probe with global variables He Kuang
2015-04-26 0:56 ` Masami Hiramatsu
2015-04-27 16:38 ` Arnaldo Carvalho de Melo
2015-05-01 10:15 ` [tip:perf/urgent] perf probe: Fix bug with global variables handling tip-bot for He Kuang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).