* [PATCH 1/3] perf tools: Fix perf stack to non executable on x86_64
2012-02-06 21:36 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2012-02-06 21:36 ` Arnaldo Carvalho de Melo
2012-02-06 21:36 ` [PATCH 2/3] perf tools: Fix prefix matching for kernel maps Arnaldo Carvalho de Melo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-02-06 21:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, Corey Ashford, Paul Mackerras,
Peter Zijlstra, stable, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@redhat.com>
By adding following objects:
bench/mem-memcpy-x86-64-asm.o
the x86_64 perf binary ended up with executable stack.
The reason was that above object are assembler sourced and is missing the
GNU-stack note section. In such case the linker assumes that the final binary
should not be restricted at all and mark the stack as RWX.
Adding section ".note.GNU-stack" definition to mentioned object, with all
flags disabled, thus omiting this object from linker stack flags decision.
Problem introduced in:
$ git describe ea7872b
v2.6.37-rc2-19-gea7872b
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=783570
Reported-by: Clark Williams <williams@redhat.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@kernel.org
Link: http://lkml.kernel.org/r/1328100848-5630-1-git-send-email-jolsa@redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
[ committer note: Backported fix to perf/urgent (3.3-rc2+) ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bench/mem-memcpy-x86-64-asm.S | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S
index a57b66e..185a96d 100644
--- a/tools/perf/bench/mem-memcpy-x86-64-asm.S
+++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S
@@ -1,2 +1,8 @@
#include "../../../arch/x86/lib/memcpy_64.S"
+/*
+ * We need to provide note.GNU-stack section, saying that we want
+ * NOT executable stack. Otherwise the final linking will assume that
+ * the ELF stack should not be restricted at all and set it RWX.
+ */
+.section .note.GNU-stack,"",@progbits
--
1.7.9.rc2.1.g69204
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] perf tools: Fix prefix matching for kernel maps
2012-02-06 21:36 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2012-02-06 21:36 ` [PATCH 1/3] perf tools: Fix perf stack to non executable on x86_64 Arnaldo Carvalho de Melo
@ 2012-02-06 21:36 ` Arnaldo Carvalho de Melo
2012-02-06 21:36 ` [PATCH 3/3] perf evsel: Fix an issue where perf report fails to show the proper percentage Arnaldo Carvalho de Melo
2012-02-07 8:46 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-02-06 21:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, Corey Ashford, Paul Mackerras,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@redhat.com>
In some perf ancient versions we used '[kernel.kallsyms._text]' as the
name for the kernel map.
This got changed with commit:
perf: 'perf kvm' tool for monitoring guest performance from host
commit a1645ce12adb6c9cc9e19d7695466204e3f017fe
Author: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
and we started to use following name '[kernel.kallsyms]_text'.
This name change is important for the report code dealing with ancient
perf data. When processing the kernel map event, we need to recognize
the old naming (dont match the last ']') and initialize the kernel map
correctly.
The subsequent call to maps__set_kallsyms_ref_reloc_sym deals with the
superfluous ']' to get correct symbol name.
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1328461865-6127-1-git-send-email-jolsa@redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 73ddaf0..2044324 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -554,7 +554,7 @@ static int perf_event__process_kernel_mmap(struct perf_tool *tool __used,
is_kernel_mmap = memcmp(event->mmap.filename,
kmmap_prefix,
- strlen(kmmap_prefix)) == 0;
+ strlen(kmmap_prefix) - 1) == 0;
if (event->mmap.filename[0] == '/' ||
(!is_kernel_mmap && event->mmap.filename[0] == '[')) {
--
1.7.9.rc2.1.g69204
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] perf evsel: Fix an issue where perf report fails to show the proper percentage
2012-02-06 21:36 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2012-02-06 21:36 ` [PATCH 1/3] perf tools: Fix perf stack to non executable on x86_64 Arnaldo Carvalho de Melo
2012-02-06 21:36 ` [PATCH 2/3] perf tools: Fix prefix matching for kernel maps Arnaldo Carvalho de Melo
@ 2012-02-06 21:36 ` Arnaldo Carvalho de Melo
2012-02-07 8:46 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-02-06 21:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Naveen N. Rao, Ananth N Mavinakayanahalli,
Robert Richter, Srikar Dronamraju, stable,
Arnaldo Carvalho de Melo
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
This patch fixes an issue where perf report shows nan% for certain
perf.data files. The below is from a report for a do_fork probe:
-nan% sshd [kernel.kallsyms] [k] do_fork
-nan% packagekitd [kernel.kallsyms] [k] do_fork
-nan% dbus-daemon [kernel.kallsyms] [k] do_fork
-nan% bash [kernel.kallsyms] [k] do_fork
A git bisect shows commit f3bda2c as the cause. However, looking back
through the git history, I saw commit 640c03c which seems to have
removed the required initialization for perf_sample->period. The problem
only started showing after commit f3bda2c. The below patch re-introduces
the initialization and it fixes the problem for me.
With the below patch, for the same perf.data:
73.08% bash [kernel.kallsyms] [k] do_fork
8.97% 11-dhclient [kernel.kallsyms] [k] do_fork
6.41% sshd [kernel.kallsyms] [k] do_fork
3.85% 20-chrony [kernel.kallsyms] [k] do_fork
2.56% sendmail [kernel.kallsyms] [k] do_fork
This patch applies over current linux-tip commit 9949284.
Problem introduced in:
$ git describe 640c03c
v2.6.37-rc3-83-g640c03c
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: stable@kernel.org
Link: http://lkml.kernel.org/r/20120203170113.5190.25558.stgit@localhost6.localdomain6
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 667f3b7..7132ee8 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -463,6 +463,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
memset(data, 0, sizeof(*data));
data->cpu = data->pid = data->tid = -1;
data->stream_id = data->id = data->time = -1ULL;
+ data->period = 1;
if (event->header.type != PERF_RECORD_SAMPLE) {
if (!sample_id_all)
--
1.7.9.rc2.1.g69204
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [GIT PULL 0/3] perf/urgent fixes
2012-02-06 21:36 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2012-02-06 21:36 ` [PATCH 3/3] perf evsel: Fix an issue where perf report fails to show the proper percentage Arnaldo Carvalho de Melo
@ 2012-02-07 8:46 ` Ingo Molnar
3 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2012-02-07 8:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Ananth N Mavinakayanahalli, Clark Williams,
Corey Ashford, Eric Dumazet, Jiri Olsa, Naveen N. Rao,
Paul Mackerras, Peter Zijlstra, Robert Richter, Srikar Dronamraju,
stable, arnaldo.melo
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> The following changes since commit 84f2b9b2edc09595569c7397cc3c888764ffd78b:
>
> perf: Remove deprecated WARN_ON_ONCE() (2012-02-03 08:24:40 +0100)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux perf-urgent-for-mingo
>
> for you to fetch changes up to a4a03fc7ef89020baca4f19174e6a43767c6d78a:
>
> perf evsel: Fix an issue where perf report fails to show the proper percentage (2012-02-06 18:59:38 -0200)
>
> ----------------------------------------------------------------
> Fixes for some long standing problems.
>
> ----------------------------------------------------------------
> Jiri Olsa (2):
> perf tools: Fix perf stack to non executable on x86_64
> perf tools: Fix prefix matching for kernel maps
>
> Naveen N. Rao (1):
> perf evsel: Fix an issue where perf report fails to show the proper percentage
>
> tools/perf/bench/mem-memcpy-x86-64-asm.S | 6 ++++++
> tools/perf/util/event.c | 2 +-
> tools/perf/util/evsel.c | 1 +
> 3 files changed, 8 insertions(+), 1 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread