* [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
@ 2010-05-10 17:12 Masami Hiramatsu
2010-05-10 17:28 ` Arnaldo Carvalho de Melo
2010-05-18 1:57 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
0 siblings, 2 replies; 16+ messages in thread
From: Masami Hiramatsu @ 2010-05-10 17:12 UTC (permalink / raw)
To: Ingo Molnar, Arnaldo Carvalho de Melo, lkml
Cc: Robert Richter, systemtap, DLE, Masami Hiramatsu,
Arnaldo Carvalho de Melo, Ingo Molnar
Check elfutils version, and if it is old don't compile
CFI analysis code. This allows to compile perf with
old elfutils.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reported-by: Robert Richter <robert.richter@amd.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/probe-finder.c | 4 ++++
tools/perf/util/probe-finder.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 562b144..93583eb 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
if (ret <= 0 || nops == 0) {
pf->fb_ops = NULL;
+#if _ELFUTILS_PREREQ(0, 142)
} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
pf->cfi != NULL) {
Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
(uintmax_t)pf->addr);
return -ENOENT;
}
+#endif
}
/* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
return -EBADF;
}
+#if _ELFUTILS_PREREQ(0, 142)
/* Get the call frame information from this dwarf */
pf.cfi = dwarf_getcfi(dbg);
+#endif
off = 0;
line_list__init(&pf.lcache);
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 66f1980..e1f61dc 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
#include <dwarf.h>
#include <libdw.h>
+#include <version.h>
struct probe_finder {
struct perf_probe_event *pev; /* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
struct list_head lcache; /* Line cache for lazy match */
/* For variable searching */
+#if _ELFUTILS_PREREQ(0, 142)
Dwarf_CFI *cfi; /* Call Frame Information */
+#endif
Dwarf_Op *fb_ops; /* Frame base attribute */
struct perf_probe_arg *pvar; /* Current target variable */
struct kprobe_trace_arg *tvar; /* Current result variable */
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 17:12 [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Masami Hiramatsu
@ 2010-05-10 17:28 ` Arnaldo Carvalho de Melo
2010-05-10 18:36 ` Robert Richter
2010-05-18 1:57 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
1 sibling, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 17:28 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Ingo Molnar, lkml, Robert Richter, systemtap, Roland McGrath, DLE
Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:
> Check elfutils version, and if it is old don't compile
> CFI analysis code. This allows to compile perf with
> old elfutils.
_ELFUTILS_PREREQ was introduced in:
commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
Author: Roland McGrath <roland@redhat.com>
Date: Tue Dec 16 17:03:03 2008 -0800
Which was released in elfutils 0.138, guess this is coverage enough?
Richard, which version is in your machine?
- Arnaldo
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> Reported-by: Robert Richter <robert.richter@amd.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
>
> tools/perf/util/probe-finder.c | 4 ++++
> tools/perf/util/probe-finder.h | 3 +++
> 2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 562b144..93583eb 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
> ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
> if (ret <= 0 || nops == 0) {
> pf->fb_ops = NULL;
> +#if _ELFUTILS_PREREQ(0, 142)
> } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
> pf->cfi != NULL) {
> Dwarf_Frame *frame;
> @@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
> (uintmax_t)pf->addr);
> return -ENOENT;
> }
> +#endif
> }
>
> /* Find each argument */
> @@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
> return -EBADF;
> }
>
> +#if _ELFUTILS_PREREQ(0, 142)
> /* Get the call frame information from this dwarf */
> pf.cfi = dwarf_getcfi(dbg);
> +#endif
>
> off = 0;
> line_list__init(&pf.lcache);
> diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> index 66f1980..e1f61dc 100644
> --- a/tools/perf/util/probe-finder.h
> +++ b/tools/perf/util/probe-finder.h
> @@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
>
> #include <dwarf.h>
> #include <libdw.h>
> +#include <version.h>
>
> struct probe_finder {
> struct perf_probe_event *pev; /* Target probe event */
> @@ -44,7 +45,9 @@ struct probe_finder {
> struct list_head lcache; /* Line cache for lazy match */
>
> /* For variable searching */
> +#if _ELFUTILS_PREREQ(0, 142)
> Dwarf_CFI *cfi; /* Call Frame Information */
> +#endif
> Dwarf_Op *fb_ops; /* Frame base attribute */
> struct perf_probe_arg *pvar; /* Current target variable */
> struct kprobe_trace_arg *tvar; /* Current result variable */
>
>
> --
> Masami Hiramatsu
> e-mail: mhiramat@redhat.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 17:28 ` Arnaldo Carvalho de Melo
@ 2010-05-10 18:36 ` Robert Richter
2010-05-10 18:57 ` Arnaldo Carvalho de Melo
2010-05-10 18:57 ` Masami Hiramatsu
0 siblings, 2 replies; 16+ messages in thread
From: Robert Richter @ 2010-05-10 18:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Masami Hiramatsu, Ingo Molnar, lkml, systemtap, Roland McGrath,
DLE
On 10.05.10 13:28:54, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:
> > Check elfutils version, and if it is old don't compile
> > CFI analysis code. This allows to compile perf with
> > old elfutils.
>
> _ELFUTILS_PREREQ was introduced in:
>
> commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
> Author: Roland McGrath <roland@redhat.com>
> Date: Tue Dec 16 17:03:03 2008 -0800
>
> Which was released in elfutils 0.138, guess this is coverage enough?
> Richard, which version is in your machine?
Right, this does not work, I am using 0.131. As expected,
"_ELFUTILS_PREREQ" is not defined:
gcc -o builtin-probe.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fstack-protector-all -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Iutil/include -Iarch/x86/include -I/usr/include/elfutils -DDWARF_SUPPORT -DNO_NEWT_SUPPORT -DNO_LIBPERL -DSHA1_HEADER='<openssl/sha.h>' builtin-probe.c
In file included from builtin-probe.c:43:
util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined
util/probe-finder.h:47:21: error: missing binary operator before token "("
make: *** [builtin-probe.o] Error 1
Why not create a compile test as for NO_DWARF in tools/perf/Makefile?
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 18:36 ` Robert Richter
@ 2010-05-10 18:57 ` Arnaldo Carvalho de Melo
2010-05-10 18:57 ` Masami Hiramatsu
1 sibling, 0 replies; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 18:57 UTC (permalink / raw)
To: Robert Richter
Cc: Masami Hiramatsu, Ingo Molnar, lkml, systemtap, Roland McGrath,
DLE
Em Mon, May 10, 2010 at 08:36:54PM +0200, Robert Richter escreveu:
> On 10.05.10 13:28:54, Arnaldo Carvalho de Melo wrote:
> > Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:
> > > Check elfutils version, and if it is old don't compile CFI
> > > analysis code. This allows to compile perf with old elfutils.
> > _ELFUTILS_PREREQ was introduced in:
> > commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
> > Author: Roland McGrath <roland@redhat.com>
> > Date: Tue Dec 16 17:03:03 2008 -0800
> > Which was released in elfutils 0.138, guess this is coverage enough?
> > Richard, which version is in your machine?
> Right, this does not work, I am using 0.131. As expected,
> "_ELFUTILS_PREREQ" is not defined:
> util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined
> util/probe-finder.h:47:21: error: missing binary operator before token "("
> make: *** [builtin-probe.o] Error 1
> Why not create a compile test as for NO_DWARF in tools/perf/Makefile?
Right, that would be better.
- Arnaldo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 18:36 ` Robert Richter
2010-05-10 18:57 ` Arnaldo Carvalho de Melo
@ 2010-05-10 18:57 ` Masami Hiramatsu
2010-05-10 19:15 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 16+ messages in thread
From: Masami Hiramatsu @ 2010-05-10 18:57 UTC (permalink / raw)
To: Robert Richter
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, lkml, systemtap,
Roland McGrath, DLE
Robert Richter wrote:
> On 10.05.10 13:28:54, Arnaldo Carvalho de Melo wrote:
>> Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:
>>> Check elfutils version, and if it is old don't compile
>>> CFI analysis code. This allows to compile perf with
>>> old elfutils.
>>
>> _ELFUTILS_PREREQ was introduced in:
>>
>> commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
>> Author: Roland McGrath <roland@redhat.com>
>> Date: Tue Dec 16 17:03:03 2008 -0800
>>
>> Which was released in elfutils 0.138, guess this is coverage enough?
>> Richard, which version is in your machine?
>
> Right, this does not work, I am using 0.131. As expected,
> "_ELFUTILS_PREREQ" is not defined:
>
> gcc -o builtin-probe.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fstack-protector-all -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Iutil/include -Iarch/x86/include -I/usr/include/elfutils -DDWARF_SUPPORT -DNO_NEWT_SUPPORT -DNO_LIBPERL -DSHA1_HEADER='<openssl/sha.h>' builtin-probe.c
> In file included from builtin-probe.c:43:
> util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined
> util/probe-finder.h:47:21: error: missing binary operator before token "("
> make: *** [builtin-probe.o] Error 1
>
> Why not create a compile test as for NO_DWARF in tools/perf/Makefile?
Hmm, ok, version.h is also introduced at the same time.
# git log ./config/version.h.in
commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
Author: Roland McGrath <roland@redhat.com>
Date: Tue Dec 16 17:03:03 2008 -0800
Install elfutils/version.h header for library compatibility checking.
So, I think we'd better set NO_DWARF if the elfutils
is older than 0.138, since we can't check API compatibility
easily.
Thank you,
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 18:57 ` Masami Hiramatsu
@ 2010-05-10 19:15 ` Arnaldo Carvalho de Melo
2010-05-10 19:19 ` Masami Hiramatsu
0 siblings, 1 reply; 16+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 19:15 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Robert Richter, Ingo Molnar, lkml, systemtap, Roland McGrath, DLE
Em Mon, May 10, 2010 at 02:57:34PM -0400, Masami Hiramatsu escreveu:
> Hmm, ok, version.h is also introduced at the same time.
>
> # git log ./config/version.h.in
> commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
> Author: Roland McGrath <roland@redhat.com>
> Date: Tue Dec 16 17:03:03 2008 -0800
>
> Install elfutils/version.h header for library compatibility checking.
>
> So, I think we'd better set NO_DWARF if the elfutils
> is older than 0.138, since we can't check API compatibility
> easily.
Well, for that you can just add some of the code you ifdefed in this
patch into the tools/perf/Makefile test, or better, duplicate the test,
including just the CPI stuff in the new test, and then set NO_DWARF_CFI
and use it as the ifdef condition :-)
- Arnaldo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 19:15 ` Arnaldo Carvalho de Melo
@ 2010-05-10 19:19 ` Masami Hiramatsu
2010-05-11 4:59 ` [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF Masami Hiramatsu
2010-05-11 8:12 ` [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Mark Wielaard
0 siblings, 2 replies; 16+ messages in thread
From: Masami Hiramatsu @ 2010-05-10 19:19 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Robert Richter, Ingo Molnar, lkml, systemtap, Roland McGrath, DLE
Arnaldo Carvalho de Melo wrote:
> Em Mon, May 10, 2010 at 02:57:34PM -0400, Masami Hiramatsu escreveu:
>> Hmm, ok, version.h is also introduced at the same time.
>>
>> # git log ./config/version.h.in
>> commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
>> Author: Roland McGrath <roland@redhat.com>
>> Date: Tue Dec 16 17:03:03 2008 -0800
>>
>> Install elfutils/version.h header for library compatibility checking.
>>
>> So, I think we'd better set NO_DWARF if the elfutils
>> is older than 0.138, since we can't check API compatibility
>> easily.
>
> Well, for that you can just add some of the code you ifdefed in this
> patch into the tools/perf/Makefile test, or better, duplicate the test,
> including just the CPI stuff in the new test, and then set NO_DWARF_CFI
> and use it as the ifdef condition :-)
Hm, I'd like to add just '#ifndef _ELFUTILS_PREREQ;#error;#endif' to
NO_DWARF checking in Makefile, because it's easier to expand to another
API dependency.
Thank you,
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF
2010-05-10 19:19 ` Masami Hiramatsu
@ 2010-05-11 4:59 ` Masami Hiramatsu
2010-05-11 10:41 ` Robert Richter
2010-05-12 8:40 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-05-11 8:12 ` [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Mark Wielaard
1 sibling, 2 replies; 16+ messages in thread
From: Masami Hiramatsu @ 2010-05-11 4:59 UTC (permalink / raw)
To: Ingo Molnar, Arnaldo Carvalho de Melo, lkml
Cc: Robert Richter, systemtap, DLE, Masami Hiramatsu,
Arnaldo Carvalho de Melo, Ingo Molnar
Check whether elfutils is older than 0.138 (from which version checking
routine has been introduced). And if so, set NO_DWARF because it is hard
to check the API dependency without version checking.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reported-by: Robert Richter <robert.richter@amd.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
tools/perf/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0ef5cfe..b28bb73 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -506,8 +506,8 @@ PERFLIBS = $(LIB_FILE)
-include config.mak
ifndef NO_DWARF
-ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
- msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/libdw-dev);
+ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo '\#include <version.h>'; echo '\#ifndef _ELFUTILS_PREREQ'; echo '\#error'; echo '\#endif'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
NO_DWARF := 1
endif # Dwarf support
endif # NO_DWARF
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 19:19 ` Masami Hiramatsu
2010-05-11 4:59 ` [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF Masami Hiramatsu
@ 2010-05-11 8:12 ` Mark Wielaard
1 sibling, 0 replies; 16+ messages in thread
From: Mark Wielaard @ 2010-05-11 8:12 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Arnaldo Carvalho de Melo, Robert Richter, Ingo Molnar, lkml,
systemtap, Roland McGrath, DLE
On Mon, 2010-05-10 at 15:19 -0400, Masami Hiramatsu wrote:
> Hm, I'd like to add just '#ifndef _ELFUTILS_PREREQ;#error;#endif' to
> NO_DWARF checking in Makefile, because it's easier to expand to another
> API dependency.
You might want to check systemtap/dwarf-wrappers.h which handles missing
_ELFUTILS_PREREQ, so you can use it as if it is always defined. That
said, 0.138 is pretty old (latest is 0.147), so just requiring something
fresh might not be a bad thing.
Cheers,
Mark
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF
2010-05-11 4:59 ` [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF Masami Hiramatsu
@ 2010-05-11 10:41 ` Robert Richter
2010-05-12 8:40 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
1 sibling, 0 replies; 16+ messages in thread
From: Robert Richter @ 2010-05-11 10:41 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Ingo Molnar, Arnaldo Carvalho de Melo, lkml, systemtap, DLE
On 11.05.10 00:59:53, Masami Hiramatsu wrote:
> Check whether elfutils is older than 0.138 (from which version checking
> routine has been introduced). And if so, set NO_DWARF because it is hard
> to check the API dependency without version checking.
This works for me, now the DWARF_SUPPORT macro is undefined and a
warning is generated:
Makefile:510: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Thanks,
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* [tip:perf/core] perf probe: Check older elfutils and set NO_DWARF
2010-05-11 4:59 ` [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF Masami Hiramatsu
2010-05-11 10:41 ` Robert Richter
@ 2010-05-12 8:40 ` tip-bot for Masami Hiramatsu
1 sibling, 0 replies; 16+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2010-05-12 8:40 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, robert.richter, tglx, mhiramat,
mingo
Commit-ID: 6b3c4ef50441e85dc9b2c9b67e95e8ad1185c15e
Gitweb: http://git.kernel.org/tip/6b3c4ef50441e85dc9b2c9b67e95e8ad1185c15e
Author: Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Tue, 11 May 2010 00:59:53 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 11 May 2010 12:43:11 -0300
perf probe: Check older elfutils and set NO_DWARF
Check whether elfutils is older than 0.138 (from which version checking
routine has been introduced). And if so, set NO_DWARF because it is hard
to check the API dependency without version checking.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reported-by: Robert Richter <robert.richter@amd.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <20100511045953.9913.19485.stgit@localhost6.localdomain6>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0ef5cfe..b28bb73 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -506,8 +506,8 @@ PERFLIBS = $(LIB_FILE)
-include config.mak
ifndef NO_DWARF
-ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
- msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/libdw-dev);
+ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo '\#include <version.h>'; echo '\#ifndef _ELFUTILS_PREREQ'; echo '\#error'; echo '\#endif'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
NO_DWARF := 1
endif # Dwarf support
endif # NO_DWARF
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf probe: Don't compile CFI related code if elfutils is old
2010-05-10 17:12 [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Masami Hiramatsu
2010-05-10 17:28 ` Arnaldo Carvalho de Melo
@ 2010-05-18 1:57 ` tip-bot for Masami Hiramatsu
2010-05-18 9:35 ` Robert Richter
1 sibling, 1 reply; 16+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2010-05-18 1:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, eranian, hpa, mingo, robert.richter, tglx,
mhiramat, mingo
Commit-ID: 7752f1b096e13991f20b59fd11ba73da3809d93c
Gitweb: http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
Author: Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 10 May 2010 13:12:07 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 May 2010 22:13:51 -0300
perf probe: Don't compile CFI related code if elfutils is old
Check elfutils version, and if it is old don't compile CFI analysis code. This
allows to compile perf with old elfutils.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Tested-by: Stephane Eranian <eranian@google.com>
Reported-by: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <20100510171207.26029.97604.stgit@localhost6.localdomain6>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-finder.c | 4 ++++
tools/perf/util/probe-finder.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 562b144..93583eb 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
if (ret <= 0 || nops == 0) {
pf->fb_ops = NULL;
+#if _ELFUTILS_PREREQ(0, 142)
} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
pf->cfi != NULL) {
Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
(uintmax_t)pf->addr);
return -ENOENT;
}
+#endif
}
/* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
return -EBADF;
}
+#if _ELFUTILS_PREREQ(0, 142)
/* Get the call frame information from this dwarf */
pf.cfi = dwarf_getcfi(dbg);
+#endif
off = 0;
line_list__init(&pf.lcache);
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 66f1980..e1f61dc 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
#include <dwarf.h>
#include <libdw.h>
+#include <version.h>
struct probe_finder {
struct perf_probe_event *pev; /* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
struct list_head lcache; /* Line cache for lazy match */
/* For variable searching */
+#if _ELFUTILS_PREREQ(0, 142)
Dwarf_CFI *cfi; /* Call Frame Information */
+#endif
Dwarf_Op *fb_ops; /* Frame base attribute */
struct perf_probe_arg *pvar; /* Current target variable */
struct kprobe_trace_arg *tvar; /* Current result variable */
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [tip:perf/core] perf probe: Don't compile CFI related code if elfutils is old
2010-05-18 1:57 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
@ 2010-05-18 9:35 ` Robert Richter
2010-05-18 9:39 ` Stephane Eranian
0 siblings, 1 reply; 16+ messages in thread
From: Robert Richter @ 2010-05-18 9:35 UTC (permalink / raw)
To: mingo@redhat.com, hpa@zytor.com, eranian@google.com,
linux-kernel@vger.kernel.org, acme@redhat.com, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu
Cc: linux-tip-commits@vger.kernel.org
On 17.05.10 21:57:38, tip-bot for Masami Hiramatsu wrote:
> Commit-ID: 7752f1b096e13991f20b59fd11ba73da3809d93c
> Gitweb: http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
> Author: Masami Hiramatsu <mhiramat@redhat.com>
> AuthorDate: Mon, 10 May 2010 13:12:07 -0400
> Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
> CommitDate: Mon, 17 May 2010 22:13:51 -0300
>
> perf probe: Don't compile CFI related code if elfutils is old
>
> Check elfutils version, and if it is old don't compile CFI analysis code. This
> allows to compile perf with old elfutils.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> Tested-by: Stephane Eranian <eranian@google.com>
> Reported-by: Robert Richter <robert.richter@amd.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> LKML-Reference: <20100510171207.26029.97604.stgit@localhost6.localdomain6>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
I think this patch is not needed as we came up with an alternative
solution with commit:
6b3c4ef perf probe: Check older elfutils and set NO_DWARF
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [tip:perf/core] perf probe: Don't compile CFI related code if elfutils is old
2010-05-18 9:35 ` Robert Richter
@ 2010-05-18 9:39 ` Stephane Eranian
2010-05-18 10:18 ` Robert Richter
2010-05-18 14:03 ` acme
0 siblings, 2 replies; 16+ messages in thread
From: Stephane Eranian @ 2010-05-18 9:39 UTC (permalink / raw)
To: Robert Richter
Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
acme@redhat.com, tglx@linutronix.de, mhiramat@redhat.com,
mingo@elte.hu, linux-tip-commits@vger.kernel.org
On Tue, May 18, 2010 at 11:35 AM, Robert Richter <robert.richter@amd.com> wrote:
> On 17.05.10 21:57:38, tip-bot for Masami Hiramatsu wrote:
>> Commit-ID: 7752f1b096e13991f20b59fd11ba73da3809d93c
>> Gitweb: http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
>> Author: Masami Hiramatsu <mhiramat@redhat.com>
>> AuthorDate: Mon, 10 May 2010 13:12:07 -0400
>> Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
>> CommitDate: Mon, 17 May 2010 22:13:51 -0300
>>
>> perf probe: Don't compile CFI related code if elfutils is old
>>
>> Check elfutils version, and if it is old don't compile CFI analysis code. This
>> allows to compile perf with old elfutils.
>>
>> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
>> Tested-by: Stephane Eranian <eranian@google.com>
>> Reported-by: Robert Richter <robert.richter@amd.com>
>> Cc: Ingo Molnar <mingo@elte.hu>
>> LKML-Reference: <20100510171207.26029.97604.stgit@localhost6.localdomain6>
>> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>> ---
>
> I think this patch is not needed as we came up with an alternative
> solution with commit:
>
> 6b3c4ef perf probe: Check older elfutils and set NO_DWARF
>
But I am compiling tip, so this patch is in and I still got the problem.
It is because the test program does not check for Dwarf_CFI so it
assumes you have the right version of libdw.
If I understand Masami's patch, you can still compile dwarf support
in despite the lack of Dwarf_CFI.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [tip:perf/core] perf probe: Don't compile CFI related code if elfutils is old
2010-05-18 9:39 ` Stephane Eranian
@ 2010-05-18 10:18 ` Robert Richter
2010-05-18 14:03 ` acme
1 sibling, 0 replies; 16+ messages in thread
From: Robert Richter @ 2010-05-18 10:18 UTC (permalink / raw)
To: Stephane Eranian
Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
acme@redhat.com, tglx@linutronix.de, mhiramat@redhat.com,
mingo@elte.hu, linux-tip-commits@vger.kernel.org
On 18.05.10 05:39:58, Stephane Eranian wrote:
> If I understand Masami's patch, you can still compile dwarf support
> in despite the lack of Dwarf_CFI.
I see, so the #if macros are effectively needed only for versions 138
to 141.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [tip:perf/core] perf probe: Don't compile CFI related code if elfutils is old
2010-05-18 9:39 ` Stephane Eranian
2010-05-18 10:18 ` Robert Richter
@ 2010-05-18 14:03 ` acme
1 sibling, 0 replies; 16+ messages in thread
From: acme @ 2010-05-18 14:03 UTC (permalink / raw)
To: Stephane Eranian
Cc: Robert Richter, mingo@redhat.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu,
linux-tip-commits@vger.kernel.org
Em Tue, May 18, 2010 at 11:39:58AM +0200, Stephane Eranian escreveu:
> On Tue, May 18, 2010 at 11:35 AM, Robert Richter <robert.richter@amd.com> wrote:
> > On 17.05.10 21:57:38, tip-bot for Masami Hiramatsu wrote:
> >> Commit-ID: 7752f1b096e13991f20b59fd11ba73da3809d93c
> >> Gitweb: http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
> >> Author: Masami Hiramatsu <mhiramat@redhat.com>
> >> AuthorDate: Mon, 10 May 2010 13:12:07 -0400
> >> Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
> >> CommitDate: Mon, 17 May 2010 22:13:51 -0300
> >> perf probe: Don't compile CFI related code if elfutils is old
> >> Check elfutils version, and if it is old don't compile CFI analysis code. This
> >> allows to compile perf with old elfutils.
> >> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> >> Tested-by: Stephane Eranian <eranian@google.com>
> >> Reported-by: Robert Richter <robert.richter@amd.com>
> >> Cc: Ingo Molnar <mingo@elte.hu>
> >> LKML-Reference: <20100510171207.26029.97604.stgit@localhost6.localdomain6>
> >> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > I think this patch is not needed as we came up with an alternative
> > solution with commit:
> > 6b3c4ef perf probe: Check older elfutils and set NO_DWARF
Yeah, that was confusing, my understanding was that 6b3c4ef superseeded
7752f1b, but it was needed in addition to it, as can be seen by
Stephane's report.
6b3c4ef worked for you because it used the heavy hammer, by not noticing
the _ELFUTILS_PREREQ macro it decided that the elfutils version
installed was way too old, so disable everything related to it, i.e.
perf probe will work just with /proc/kallsyms. I.e. your version of
elfutils was <= 0.138, that is when the PREREQ macro was introduced.
But Stephanes is > 0.138 _but_ < 0.142, that is when Dwarf_CFI appeared,
so he can use the PREREQ macro to build only removing the code that
depends on Dwarf_CFI being available.
> But I am compiling tip, so this patch is in and I still got the problem.
> It is because the test program does not check for Dwarf_CFI so it
> assumes you have the right version of libdw.
>
> If I understand Masami's patch, you can still compile dwarf support
> in despite the lack of Dwarf_CFI.
Right.
- Arnaldo
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-05-18 14:04 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 17:12 [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Masami Hiramatsu
2010-05-10 17:28 ` Arnaldo Carvalho de Melo
2010-05-10 18:36 ` Robert Richter
2010-05-10 18:57 ` Arnaldo Carvalho de Melo
2010-05-10 18:57 ` Masami Hiramatsu
2010-05-10 19:15 ` Arnaldo Carvalho de Melo
2010-05-10 19:19 ` Masami Hiramatsu
2010-05-11 4:59 ` [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF Masami Hiramatsu
2010-05-11 10:41 ` Robert Richter
2010-05-12 8:40 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-05-11 8:12 ` [PATCH -tip] perf probe: Don't compile CFI related code if elfutils is old Mark Wielaard
2010-05-18 1:57 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-05-18 9:35 ` Robert Richter
2010-05-18 9:39 ` Stephane Eranian
2010-05-18 10:18 ` Robert Richter
2010-05-18 14:03 ` acme
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).