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