From: Arnaldo Carvalho de Melo <[email protected]>
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 0e9f2204cfa6d79abe3e525ddf7c4ab5792cc751:
perf/x86: Fix Userspace RDPMC switch (2014-02-09 13:08:25 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
for you to fetch changes up to 844ae5b46c08dbc7ba695b543c023f9cf3bbf9ff:
perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches (2014-02-13 17:28:31 -0300)
----------------------------------------------------------------
perf/urgent fixes:
. Handle PERF_RECORD_HEADER_EVENT_TYPE properly. (Jiri Olsa)
. Fix checking for supported events on older kernels in
'perf list' (Vince Weaver)
. Do not add offset twice to uprobe address in
'perf probe' (Masami Hiramatsu)
. Fix perf trace's ioctl 'request' beautifier build problems
on !(i386 || x86_64) arches (Arnaldo Carvalho de Melo)
. Fix 'perf trace' build by adding a fallback definition for
EFD_SEMAPHORE (Ben Hutchings)
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches
Ben Hutchings (1):
perf trace: Add fallback definition of EFD_SEMAPHORE
Jiri Olsa (1):
perf tools: Handle PERF_RECORD_HEADER_EVENT_TYPE properly
Masami Hiramatsu (1):
perf probe: Do not add offset twice to uprobe address
Vince Weaver (1):
perf list: Fix checking for supported events on older kernels
tools/perf/builtin-trace.c | 22 ++++++++++++++++++++++
tools/perf/util/parse-events.c | 17 +++++++++++++++--
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/session.c | 6 ++++++
4 files changed, 44 insertions(+), 3 deletions(-)
From: Ben Hutchings <[email protected]>
glibc 2.17 is missing this on sparc, despite the fact that it's not
architecture-specific.
Signed-off-by: Ben Hutchings <[email protected]>
Fixes: 49af9e93adfa ('perf trace: Beautify eventfd2 'flags' arg')
Cc: <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-trace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 896f27047ed6..619d11c47a91 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -37,6 +37,10 @@
# define MADV_UNMERGEABLE 13
#endif
+#ifndef EFD_SEMAPHORE
+# define EFD_SEMAPHORE 1
+#endif
+
struct tp_field {
int offset;
union {
--
1.8.1.4
From: Vince Weaver <[email protected]>
"perf list" listing of hardware events doesn't work on older ARM devices.
The change enabling event detection:
commit b41f1cec91c37eeea6fdb15effbfa24ea0a5536b
Author: Namhyung Kim <[email protected]>
Date: Tue Aug 27 11:41:53 2013 +0900
perf list: Skip unsupported events
uses the following code in tools/perf/util/parse-events.c:
struct perf_event_attr attr = {
.type = type,
.config = config,
.disabled = 1,
.exclude_kernel = 1,
};
On ARM machines pre-dating the Cortex-A15 this doesn't work, as these
machines don't support .exclude_kernel. So starting with 3.12 "perf
list" does not report any hardware events at all on older machines (seen
on Rasp-Pi, Pandaboard, Beagleboard, etc).
This version of the patch makes changes suggested by Namhyung Kim to
check for EACCESS and retry (instead of just dropping the
exclude_kernel) so we can properly handle machines where
/proc/sys/kernel/perf_event_paranoid is set to 2.
Reported-by: Chad Paradis <[email protected]>
Signed-off-by: Vince Weaver <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Chad Paradis <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1312301536150.28814@vincent-weaver-1.um.maine.edu
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/parse-events.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d248fca6d7ed..1e15df10a88c 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1091,12 +1091,12 @@ int is_valid_tracepoint(const char *event_string)
static bool is_event_supported(u8 type, unsigned config)
{
bool ret = true;
+ int open_return;
struct perf_evsel *evsel;
struct perf_event_attr attr = {
.type = type,
.config = config,
.disabled = 1,
- .exclude_kernel = 1,
};
struct {
struct thread_map map;
@@ -1108,7 +1108,20 @@ static bool is_event_supported(u8 type, unsigned config)
evsel = perf_evsel__new(&attr);
if (evsel) {
- ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;
+ open_return = perf_evsel__open(evsel, NULL, &tmap.map);
+ ret = open_return >= 0;
+
+ if (open_return == -EACCES) {
+ /*
+ * This happens if the paranoid value
+ * /proc/sys/kernel/perf_event_paranoid is set to 2
+ * Re-run with exclude_kernel set; we don't do that
+ * by default as some ARM machines do not support it.
+ *
+ */
+ evsel->attr.exclude_kernel = 1;
+ ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;
+ }
perf_evsel__delete(evsel);
}
--
1.8.1.4
From: Jiri Olsa <[email protected]>
We removed event types from data file in following commits:
6065210 perf tools: Remove event types framework completely
44b3c57 perf tools: Remove event types from perf data file
We no longer need this information, because we can get it directly from
tracepoints.
But we still need to handle PERF_RECORD_HEADER_EVENT_TYPE event for the
sake of old perf data files created in pipe mode like:
$ perf.3.4 record -o - foo >perf.data
$ perf.312 report -i - < perf.data
Reported-by: Stephane Eranian <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/session.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0b39a48e5110..5da6ce74c676 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1008,6 +1008,12 @@ static int perf_session__process_user_event(struct perf_session *session, union
if (err == 0)
perf_session__set_id_hdr_size(session);
return err;
+ case PERF_RECORD_HEADER_EVENT_TYPE:
+ /*
+ * Depreceated, but we need to handle it for sake
+ * of old data files create in pipe mode.
+ */
+ return 0;
case PERF_RECORD_HEADER_TRACING_DATA:
/* setup for reading amidst mmap */
lseek(fd, file_offset, SEEK_SET);
--
1.8.1.4
From: Arnaldo Carvalho de Melo <[email protected]>
Supporting decoding the ioctl 'request' parameter needs more work to
properly support more architectures, the current approach doesn't work
on at least powerpc and sparc, as reported by Ben Hutchings in
http://lkml.kernel.org/r/[email protected] .
Work around that by making it to be ifdefed for the architectures known
to work with the current, limited approach, i386 and x86_64 till better
code is written.
Reported-by: Ben Hutchings <[email protected]>
Acked-by: Ben Hutchings <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: <[email protected]> # 3.13 Fixes: 78645cf3ed32 ("perf trace: Initial beautifier for ioctl's 'cmd' arg")
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/builtin-trace.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 619d11c47a91..6aa6fb6f7bd9 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -283,6 +283,11 @@ static size_t syscall_arg__scnprintf_strarray(char *bf, size_t size,
#define SCA_STRARRAY syscall_arg__scnprintf_strarray
+#if defined(__i386__) || defined(__x86_64__)
+/*
+ * FIXME: Make this available to all arches as soon as the ioctl beautifier
+ * gets rewritten to support all arches.
+ */
static size_t syscall_arg__scnprintf_strhexarray(char *bf, size_t size,
struct syscall_arg *arg)
{
@@ -290,6 +295,7 @@ static size_t syscall_arg__scnprintf_strhexarray(char *bf, size_t size,
}
#define SCA_STRHEXARRAY syscall_arg__scnprintf_strhexarray
+#endif /* defined(__i386__) || defined(__x86_64__) */
static size_t syscall_arg__scnprintf_fd(char *bf, size_t size,
struct syscall_arg *arg);
@@ -843,6 +849,10 @@ static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscal
#define SCA_SIGNUM syscall_arg__scnprintf_signum
+#if defined(__i386__) || defined(__x86_64__)
+/*
+ * FIXME: Make this available to all arches.
+ */
#define TCGETS 0x5401
static const char *tioctls[] = {
@@ -864,6 +874,7 @@ static const char *tioctls[] = {
};
static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401);
+#endif /* defined(__i386__) || defined(__x86_64__) */
#define STRARRAY(arg, name, array) \
.arg_scnprintf = { [arg] = SCA_STRARRAY, }, \
@@ -945,9 +956,16 @@ static struct syscall_fmt {
{ .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), },
{ .name = "ioctl", .errmsg = true,
.arg_scnprintf = { [0] = SCA_FD, /* fd */
+#if defined(__i386__) || defined(__x86_64__)
+/*
+ * FIXME: Make this available to all arches.
+ */
[1] = SCA_STRHEXARRAY, /* cmd */
[2] = SCA_HEX, /* arg */ },
.arg_parm = { [1] = &strarray__tioctls, /* cmd */ }, },
+#else
+ [2] = SCA_HEX, /* arg */ }, },
+#endif
{ .name = "kill", .errmsg = true,
.arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, },
{ .name = "linkat", .errmsg = true,
--
1.8.1.4
From: Masami Hiramatsu <[email protected]>
Fix perf-probe not to add offset value twice to uprobe probe address
when post processing.
The tevs[i].point.address struct member is the address of symbol+offset,
but current perf-probe adjusts the point.address by adding the offset.
As a result, the probe address becomes symbol+offset+offset. This may
cause unexpected code corruption. Urgent fix is needed.
Without this fix:
---
# ./perf probe -x ./perf dso__load_vmlinux+4
# ./perf probe -l
probe_perf:dso__load_vmlinux (on 0x000000000006d2b8)
# nm ./perf.orig | grep dso__load_vmlinux\$
000000000046d0a0 T dso__load_vmlinux
---
You can see the given offset is 3 but the actual probed address is
dso__load_vmlinux+8.
With this fix:
---
# ./perf probe -x ./perf dso__load_vmlinux+4
# ./perf probe -l
probe_perf:dso__load_vmlinux (on 0x000000000006d2b4)
---
Now the problem is fixed.
Note: This bug is introduced by
commit fb7345bbf7fad9bf72ef63a19c707970b9685812
Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: "David A. Long" <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Srikar Dronamraju <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/20140205051858.6519.27314.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/probe-event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a8a9b6cd93a8..d8b048c20cde 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -336,8 +336,8 @@ static int add_exec_to_probe_trace_events(struct probe_trace_event *tevs,
return ret;
for (i = 0; i < ntevs && ret >= 0; i++) {
+ /* point.address is the addres of point.symbol + point.offset */
offset = tevs[i].point.address - stext;
- offset += tevs[i].point.offset;
tevs[i].point.offset = 0;
zfree(&tevs[i].point.symbol);
ret = e_snprintf(buf, 32, "0x%lx", offset);
--
1.8.1.4
* Arnaldo Carvalho de Melo <[email protected]> wrote:
> From: Arnaldo Carvalho de Melo <[email protected]>
>
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 0e9f2204cfa6d79abe3e525ddf7c4ab5792cc751:
>
> perf/x86: Fix Userspace RDPMC switch (2014-02-09 13:08:25 +0100)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
>
> for you to fetch changes up to 844ae5b46c08dbc7ba695b543c023f9cf3bbf9ff:
>
> perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches (2014-02-13 17:28:31 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> . Handle PERF_RECORD_HEADER_EVENT_TYPE properly. (Jiri Olsa)
>
> . Fix checking for supported events on older kernels in
> 'perf list' (Vince Weaver)
>
> . Do not add offset twice to uprobe address in
> 'perf probe' (Masami Hiramatsu)
>
> . Fix perf trace's ioctl 'request' beautifier build problems
> on !(i386 || x86_64) arches (Arnaldo Carvalho de Melo)
>
> . Fix 'perf trace' build by adding a fallback definition for
> EFD_SEMAPHORE (Ben Hutchings)
>
> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
> perf trace: Fix ioctl 'request' beautifier build problems on !(i386 || x86_64) arches
>
> Ben Hutchings (1):
> perf trace: Add fallback definition of EFD_SEMAPHORE
>
> Jiri Olsa (1):
> perf tools: Handle PERF_RECORD_HEADER_EVENT_TYPE properly
>
> Masami Hiramatsu (1):
> perf probe: Do not add offset twice to uprobe address
>
> Vince Weaver (1):
> perf list: Fix checking for supported events on older kernels
>
> tools/perf/builtin-trace.c | 22 ++++++++++++++++++++++
> tools/perf/util/parse-events.c | 17 +++++++++++++++--
> tools/perf/util/probe-event.c | 2 +-
> tools/perf/util/session.c | 6 ++++++
> 4 files changed, 44 insertions(+), 3 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo