|
|
d5df0a |
From dd433306f249db81f1ef5cfffefeb2d0ad4e3115 Mon Sep 17 00:00:00 2001
|
|
|
d5df0a |
From: William Cohen <wcohen@redhat.com>
|
|
|
d5df0a |
Date: Tue, 10 Mar 2015 10:52:39 -0400
|
|
|
d5df0a |
Subject: [PATCH] Ensure that umask is set if the extra bits (edge, inv, cmask)
|
|
|
d5df0a |
are used
|
|
|
d5df0a |
|
|
|
d5df0a |
When testing ocount on some of the Intel processor it was discovered
|
|
|
d5df0a |
that that the umask not not being set for events that specified the
|
|
|
d5df0a |
the extra bits. Below is an example of the problem on an Intel Ivy
|
|
|
d5df0a |
Bridge processor with the event code missing the 0x03 unit masks for
|
|
|
d5df0a |
the events:
|
|
|
d5df0a |
|
|
|
d5df0a |
$ ocount --verbose -e int_misc:recovery_cycles -e int_misc:recovery_stalls_count ls
|
|
|
d5df0a |
Final event code is 140000d
|
|
|
d5df0a |
Final event code is 144000d
|
|
|
d5df0a |
Number of events passed is 2
|
|
|
d5df0a |
Exec args are: ls
|
|
|
d5df0a |
telling child to start app
|
|
|
d5df0a |
parent says start app /usr/bin/ls
|
|
|
d5df0a |
calling perf_event_open for pid 240d
|
|
|
d5df0a |
perf_event_open returning fd 9
|
|
|
d5df0a |
perf_event_open returning fd a
|
|
|
d5df0a |
perf counter setup complete
|
|
|
d5df0a |
app 240d is running
|
|
|
d5df0a |
going into waitpid on monitored app 240d
|
|
|
d5df0a |
app process ended normally.
|
|
|
d5df0a |
Reading counter data for event int_misc
|
|
|
d5df0a |
Reading counter data for event int_misc
|
|
|
d5df0a |
|
|
|
d5df0a |
Events were actively counted for 1070382 nanoseconds.
|
|
|
d5df0a |
Event counts (actual) for /usr/bin/ls:
|
|
|
d5df0a |
Event Count % time counted
|
|
|
d5df0a |
int_misc:recovery_cycles 0 100.00
|
|
|
d5df0a |
int_misc:recovery_stalls_count 0 100.00
|
|
|
d5df0a |
|
|
|
d5df0a |
With this patch the umasks are included and the example executes correctly:
|
|
|
d5df0a |
|
|
|
d5df0a |
$ ocount --verbose -e int_misc:recovery_cycles -e int_misc:recovery_stalls_count ls
|
|
|
d5df0a |
Final event code is 140030d
|
|
|
d5df0a |
Final event code is 144030d
|
|
|
d5df0a |
Number of events passed is 2
|
|
|
d5df0a |
Exec args are: ls
|
|
|
d5df0a |
telling child to start app
|
|
|
d5df0a |
calling perf_event_open for pid 72e1
|
|
|
d5df0a |
parent says start app /usr/bin/ls
|
|
|
d5df0a |
perf_event_open returning fd 9
|
|
|
d5df0a |
perf_event_open returning fd a
|
|
|
d5df0a |
perf counter setup complete
|
|
|
d5df0a |
app 72e1 is running
|
|
|
d5df0a |
going into waitpid on monitored app 72e1
|
|
|
d5df0a |
app process ended normally.
|
|
|
d5df0a |
Reading counter data for event int_misc
|
|
|
d5df0a |
Reading counter data for event int_misc
|
|
|
d5df0a |
|
|
|
d5df0a |
Events were actively counted for 1216948 nanoseconds.
|
|
|
d5df0a |
Event counts (actual) for /usr/bin/ls:
|
|
|
d5df0a |
Event Count % time counted
|
|
|
d5df0a |
int_misc:recovery_cycles 69,730 100.00
|
|
|
d5df0a |
int_misc:recovery_stalls_count 14,800 100.00
|
|
|
d5df0a |
|
|
|
d5df0a |
Signed-off-by: William Cohen <wcohen@redhat.com>
|
|
|
d5df0a |
---
|
|
|
d5df0a |
libop/op_events.c | 3 +++
|
|
|
d5df0a |
libop/op_events.h | 3 +++
|
|
|
d5df0a |
2 files changed, 6 insertions(+)
|
|
|
d5df0a |
|
|
|
d5df0a |
diff --git a/libop/op_events.c b/libop/op_events.c
|
|
|
d5df0a |
index 99266c6..2badc8e 100644
|
|
|
d5df0a |
--- a/libop/op_events.c
|
|
|
d5df0a |
+++ b/libop/op_events.c
|
|
|
d5df0a |
@@ -238,6 +238,9 @@ static void parse_um_entry(struct op_described_um * entry, char const * line)
|
|
|
d5df0a |
if (strisprefix(c, "extra:")) {
|
|
|
d5df0a |
c += 6;
|
|
|
d5df0a |
entry->extra = parse_extra(c);
|
|
|
d5df0a |
+ /* include the regular umask if there are real extra bits */
|
|
|
d5df0a |
+ if (entry->extra != EXTRA_NONE)
|
|
|
d5df0a |
+ entry->extra |= (entry->value & UMASK_MASK) << UMASK_SHIFT;
|
|
|
d5df0a |
/* named mask */
|
|
|
d5df0a |
c = skip_nonws(c);
|
|
|
d5df0a |
c = skip_ws(c);
|
|
|
d5df0a |
diff --git a/libop/op_events.h b/libop/op_events.h
|
|
|
d5df0a |
index ec345e5..f09c830 100644
|
|
|
d5df0a |
--- a/libop/op_events.h
|
|
|
d5df0a |
+++ b/libop/op_events.h
|
|
|
d5df0a |
@@ -20,6 +20,9 @@ extern "C" {
|
|
|
d5df0a |
#include "op_types.h"
|
|
|
d5df0a |
#include "op_list.h"
|
|
|
d5df0a |
|
|
|
d5df0a |
+#define UMASK_SHIFT 8
|
|
|
d5df0a |
+#define UMASK_MASK 0xff
|
|
|
d5df0a |
+
|
|
|
d5df0a |
#define EXTRA_EDGE (1U << 18)
|
|
|
d5df0a |
#define EXTRA_MIN_VAL EXTRA_EDGE
|
|
|
d5df0a |
|
|
|
d5df0a |
--
|
|
|
d5df0a |
2.1.0
|
|
|
d5df0a |
|