* [GIT PULL 0/4] perf/core improvements and fixes
@ 2015-11-25 19:46 Arnaldo Carvalho de Melo
2015-11-25 19:46 ` [PATCH 1/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Arnaldo Carvalho de Melo
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-25 19:46 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexei Starovoitov, David Ahern, Jiri Olsa, Masami Hiramatsu,
Michael Petlan, Namhyung Kim, Peter Zijlstra, pi3orama,
Steven Rostedt, Wang Nan, Zefan Li
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Hi,
Please consider pulling, this is on top of my previous
perf-core-for-mingo pull request.
- Arnaldo
The following changes since commit 646a6e846c4dc3812c614fd061603b6db5b8d380:
perf callchain: Add missing parent_val initialization (2015-11-23 18:31:25 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-2
for you to fetch changes up to d8ad6a15cc3a364de6c8010378adc3fb06ce3ff1:
tools lib bpf: Don't do a feature check when cleaning (2015-11-25 16:38:13 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Fix to free temporal Dwarf_Frame correctly in 'perf probe', fixing a
regression introduced in perf/core that prevented, at least, adding
an uprobe collecting function parameter values (Masami Hiramatsu)
- Fix output of %llu for 64 bit values read on 32 bit machines in
libtraceevent (Steven Rostedt)
Developer visible:
- Clean CFLAGS and LDFLAGS for fixdep in tools/build (Wang Nan)
- Don't do a feature check when cleaning tools/lib/bpf (Wang Nan)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Masami Hiramatsu (1):
perf probe: Fix to free temporal Dwarf_Frame correctly
Steven Rostedt (1):
tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines
Wang Nan (2):
tools build: Clean CFLAGS and LDFLAGS for fixdep
tools lib bpf: Don't do a feature check when cleaning
tools/build/Makefile.include | 2 +-
tools/lib/bpf/Makefile | 10 ++++++++++
tools/lib/traceevent/event-parse.c | 5 ++---
tools/perf/util/probe-finder.c | 13 ++++++-------
4 files changed, 19 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-11-25 19:46 ` Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 2/4] perf probe: Fix to free temporal Dwarf_Frame correctly Arnaldo Carvalho de Melo
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-25 19:46 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Steven Rostedt, stable, Arnaldo Carvalho de Melo
From: Steven Rostedt <rostedt@goodmis.org>
When a long value is read on 32 bit machines for 64 bit output, the
parsing needs to change "%lu" into "%llu", as the value is read
natively.
Unfortunately, if "%llu" is already there, the code will add another "l"
to it and fail to parse it properly.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20151116172516.4b79b109@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 2a912df6771b..68276f35e323 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -4968,13 +4968,12 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
sizeof(long) != 8) {
char *p;
- ls = 2;
/* make %l into %ll */
- p = strchr(format, 'l');
- if (p)
+ if (ls == 1 && (p = strchr(format, 'l')))
memmove(p+1, p, strlen(p)+1);
else if (strcmp(format, "%p") == 0)
strcpy(format, "0x%llx");
+ ls = 2;
}
switch (ls) {
case -2:
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] perf probe: Fix to free temporal Dwarf_Frame correctly
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-25 19:46 ` [PATCH 1/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Arnaldo Carvalho de Melo
@ 2015-11-25 19:47 ` Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 3/4] tools build: Clean CFLAGS and LDFLAGS for fixdep Arnaldo Carvalho de Melo
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-25 19:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Masami Hiramatsu, Adrian Hunter, David Ahern,
Jiri Olsa, Namhyung Kim, Peter Zijlstra, Wang Nan,
Arnaldo Carvalho de Melo
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
The commit 05c8d802fa52 ("perf probe: Fix to free temporal Dwarf_Frame")
tried to fix the memory leak of Dwarf_Frame, but it released the frame
at wrong point. Since the dwarf_frame_cfa(frame, &pf->fb_ops, &nops) can
return an address inside the frame data structure to pf->fb_ops, we can
not release the frame before using pf->fb_ops.
This reverts the commit and releases the frame afterwards (right before
returning from call_probe_finder) correctly.
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Reported-by: Michael Petlan <mpetlan@redhat.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 05c8d802fa52 ("perf probe: Fix to free temporal Dwarf_Frame")
LPU-Reference: 20151125103432.1473.31009.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-finder.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 1cab05a3831e..2be10fb27172 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -654,6 +654,7 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
{
Dwarf_Attribute fb_attr;
+ Dwarf_Frame *frame = NULL;
size_t nops;
int ret;
@@ -683,26 +684,24 @@ static int call_probe_finder(Dwarf_Die *sc_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;
- ret = 0;
#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 = NULL;
if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
pr_warning("Failed to get call frame on 0x%jx\n",
(uintmax_t)pf->addr);
- ret = -ENOENT;
+ free(frame);
+ return -ENOENT;
}
- free(frame);
#endif
}
/* Call finder's callback handler */
- if (ret >= 0)
- ret = pf->callback(sc_die, pf);
+ ret = pf->callback(sc_die, pf);
- /* *pf->fb_ops will be cached in libdw. Don't free it. */
+ /* Since *pf->fb_ops can be a part of frame. we should free it here. */
+ free(frame);
pf->fb_ops = NULL;
return ret;
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] tools build: Clean CFLAGS and LDFLAGS for fixdep
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-25 19:46 ` [PATCH 1/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 2/4] perf probe: Fix to free temporal Dwarf_Frame correctly Arnaldo Carvalho de Melo
@ 2015-11-25 19:47 ` Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 4/4] tools lib bpf: Don't do a feature check when cleaning Arnaldo Carvalho de Melo
2015-11-26 8:15 ` [GIT PULL 0/4] perf/core improvements and fixes Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-25 19:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Wang Nan, Alexei Starovoitov, Masami Hiramatsu,
Zefan Li, pi3orama, Arnaldo Carvalho de Melo
From: Wang Nan <wangnan0@huawei.com>
Sometimes passing variables to tools/build is dangerous. For example, on
my platform there is a gcc problem (gcc 4.8.1):
It passes the stackprotector-all feature check:
$ gcc -fstack-protector-all -c ./test.c
$ echo $?
0
But requires LDFLAGS support if separate compiling and linking:
$ gcc -fstack-protector-all -c ./test.c
$ gcc ./test.o
./test.o: In function `main':
test.c:(.text+0xb): undefined reference to `__stack_chk_guard'
test.c:(.text+0x21): undefined reference to `__stack_chk_guard'
collect2: error: ld returned 1 exit status
$ gcc -fstack-protector-all ./test.o
$ echo $?
0
$ gcc ./test.o -lssp
$ echo $?
0
$
In this environment building perf throws an error:
$ make
BUILD: Doing 'make -j24' parallel build
config/Makefile:344: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
config/Makefile:403: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:418: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:432: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:564: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
config/Makefile:606: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
CC fixdep.o
LD fixdep-in.o
LINK fixdep
fixdep-in.o: In function `parse_dep_file':
/kernel/tools/build/fixdep.c:47: undefined reference to `__stack_chk_guard'
/kernel/tools/build/fixdep.c:117: undefined reference to `__stack_chk_guard'
fixdep-in.o: In function `main':
/kernel-hydrogen/tools/build/fixdep.c:156: undefined reference to `__stack_chk_guard'
/kernel/tools/build/fixdep.c:168: undefined reference to `__stack_chk_guard'
collect2: error: ld returned 1 exit status
make[2]: *** [fixdep] Error 1
make[1]: *** [fixdep] Error 2
make: *** [all] Error 2
This is because the CFLAGS used in building perf pollutes the CFLAGS
used for fixdep, passing -fstack-protector-all to buiold fixdep which is
obviously not required. Since fixdep is a small host side tool, we
should keep its CFLAGS/LDFLAGS simple and clean.
This patch clears the CFLAGS and LDFLAGS passed when building fixdep, so
such gcc problem won't block the perf build process.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1448372181-151723-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/build/Makefile.include | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/build/Makefile.include b/tools/build/Makefile.include
index 4e09ad617a60..6254760290c9 100644
--- a/tools/build/Makefile.include
+++ b/tools/build/Makefile.include
@@ -4,7 +4,7 @@ ifdef CROSS_COMPILE
fixdep:
else
fixdep:
- $(Q)$(MAKE) -C $(srctree)/tools/build fixdep
+ $(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= fixdep
endif
.PHONY: fixdep
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] tools lib bpf: Don't do a feature check when cleaning
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2015-11-25 19:47 ` [PATCH 3/4] tools build: Clean CFLAGS and LDFLAGS for fixdep Arnaldo Carvalho de Melo
@ 2015-11-25 19:47 ` Arnaldo Carvalho de Melo
2015-11-26 8:15 ` [GIT PULL 0/4] perf/core improvements and fixes Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-25 19:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Wang Nan, Alexei Starovoitov, Jiri Olsa,
Masami Hiramatsu, Zefan Li, pi3orama, Arnaldo Carvalho de Melo
From: Wang Nan <wangnan0@huawei.com>
Before this patch libbpf always do feature check even when cleaning.
For example:
$ cd kernel/tools/lib/bpf
$ make
Auto-detecting system features:
... libelf: [ on ]
... bpf: [ on ]
CC libbpf.o
CC bpf.o
LD libbpf-in.o
LINK libbpf.a
LINK libbpf.so
$ make clean
CLEAN libbpf
CLEAN core-gen
$ make clean
Auto-detecting system features:
... libelf: [ on ]
... bpf: [ on ]
CLEAN libbpf
CLEAN core-gen
$
Although the first 'make clean' doesn't show feature check result, it
still does the check. No output because check result is similar to
FEATURE-DUMP.libbpf.
This patch uses same method as perf to turn off feature checking when
'make clean'.
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1448372181-151723-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/bpf/Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index a3caaf3eafbd..636e3ddb93a1 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -71,7 +71,17 @@ FEATURE_DISPLAY = libelf bpf
INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
+check_feat := 1
+NON_CHECK_FEAT_TARGETS := clean TAGS tags cscope help
+ifdef MAKECMDGOALS
+ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
+ check_feat := 0
+endif
+endif
+
+ifeq ($(check_feat),1)
include $(srctree)/tools/build/Makefile.feature
+endif
export prefix libdir src obj
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [GIT PULL 0/4] perf/core improvements and fixes
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2015-11-25 19:47 ` [PATCH 4/4] tools lib bpf: Don't do a feature check when cleaning Arnaldo Carvalho de Melo
@ 2015-11-26 8:15 ` Ingo Molnar
4 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2015-11-26 8:15 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
Alexei Starovoitov, David Ahern, Jiri Olsa, Masami Hiramatsu,
Michael Petlan, Namhyung Kim, Peter Zijlstra, pi3orama,
Steven Rostedt, Wang Nan, Zefan Li
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Hi,
>
> Please consider pulling, this is on top of my previous
> perf-core-for-mingo pull request.
>
> - Arnaldo
>
> The following changes since commit 646a6e846c4dc3812c614fd061603b6db5b8d380:
>
> perf callchain: Add missing parent_val initialization (2015-11-23 18:31:25 -0300)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-2
>
> for you to fetch changes up to d8ad6a15cc3a364de6c8010378adc3fb06ce3ff1:
>
> tools lib bpf: Don't do a feature check when cleaning (2015-11-25 16:38:13 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - Fix to free temporal Dwarf_Frame correctly in 'perf probe', fixing a
> regression introduced in perf/core that prevented, at least, adding
> an uprobe collecting function parameter values (Masami Hiramatsu)
>
> - Fix output of %llu for 64 bit values read on 32 bit machines in
> libtraceevent (Steven Rostedt)
>
> Developer visible:
>
> - Clean CFLAGS and LDFLAGS for fixdep in tools/build (Wang Nan)
>
> - Don't do a feature check when cleaning tools/lib/bpf (Wang Nan)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Masami Hiramatsu (1):
> perf probe: Fix to free temporal Dwarf_Frame correctly
>
> Steven Rostedt (1):
> tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines
>
> Wang Nan (2):
> tools build: Clean CFLAGS and LDFLAGS for fixdep
> tools lib bpf: Don't do a feature check when cleaning
>
> tools/build/Makefile.include | 2 +-
> tools/lib/bpf/Makefile | 10 ++++++++++
> tools/lib/traceevent/event-parse.c | 5 ++---
> tools/perf/util/probe-finder.c | 13 ++++++-------
> 4 files changed, 19 insertions(+), 11 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-26 8:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 19:46 [GIT PULL 0/4] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-11-25 19:46 ` [PATCH 1/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 2/4] perf probe: Fix to free temporal Dwarf_Frame correctly Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 3/4] tools build: Clean CFLAGS and LDFLAGS for fixdep Arnaldo Carvalho de Melo
2015-11-25 19:47 ` [PATCH 4/4] tools lib bpf: Don't do a feature check when cleaning Arnaldo Carvalho de Melo
2015-11-26 8:15 ` [GIT PULL 0/4] perf/core improvements and fixes Ingo Molnar
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).