From 623c0ed853eaaaeb9278755a530c1ed45b6f1501 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 04 2015 07:07:06 +0000 Subject: import devtoolset-3-oprofile-0.9.9-7.el7 --- diff --git a/SOURCES/oprofile-defaultmask.patch b/SOURCES/oprofile-defaultmask.patch new file mode 100644 index 0000000..ecd71ac --- /dev/null +++ b/SOURCES/oprofile-defaultmask.patch @@ -0,0 +1,33 @@ +commit fb9529161039e96d44b4b7396450cff04e3d9aa8 +Author: Maynard Johnson +Date: Tue Oct 15 14:58:16 2013 -0500 + + Fix operf/ocount default unit mask selection + + Many events (particularly in the x86* architectures) + require a unit mask value to specify the exact event + type. For such events, a default unit mask value + is assigned. When a user runs operf, ocount, or + opcontrol and specifies such an event but does not + specify a unit mask, the default unit mask should be + selected and used by the tool. A bug was discovered + with operf and ocount where the unit mask value in + this situation was being set to '0' instead of the + default unit mask value. This patch fixes the bug. + + Signed-off-by: Maynard Johnson + +diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp +index b85d175..177835e 100644 +--- a/libpe_utils/op_pe_utils.cpp ++++ b/libpe_utils/op_pe_utils.cpp +@@ -484,7 +484,8 @@ handle_named_um: + pclose(fp); + event->evt_um = strtoull(mask, &endptr, 10); + if ((endptr >= mask) && +- (endptr <= (mask + strlen(mask) - 1))) { ++ (endptr <= (mask + strlen(mask) - 2))) { // '- 2' to account for linefeed and '\0' ++ + // Must be a default named unit mask + strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN); + goto handle_named_um; diff --git a/SOURCES/oprofile-env.patch b/SOURCES/oprofile-env.patch new file mode 100644 index 0000000..1b81a13 --- /dev/null +++ b/SOURCES/oprofile-env.patch @@ -0,0 +1,71 @@ +From b869a61861e161c855379c4b5700fd352da01154 Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Thu, 8 Jan 2015 16:37:57 -0500 +Subject: [PATCH] Avoid permanently setting POSIXLY_CORRECT environment + variable + +During testing on Fedora it was discovered that operf was setting the +enviroment variable POSIXLY_CORRECT and this could potentially be +observed in the children tasks that operf starts (Red Hat Bugzilla +1178577). The operf, ocount, and opjitconv commands all ensure that +POSIXLY_CORRECT environment variable is set when the options are +processed with getopt_long, but they never unset the variable +afterwards. This patch ensures that POSIXLY_CORRECT is as it was +before it was set. + +Signed-off-by: William Cohen +--- + opjitconv/opjitconv.c | 5 +++++ + pe_counting/ocount.cpp | 5 +++++ + pe_profiling/operf.cpp | 5 +++++ + 3 files changed, 15 insertions(+) + +diff --git a/pe_counting/ocount.cpp b/pe_counting/ocount.cpp +index 07dfd0c..f7caede 100644 +--- a/pe_counting/ocount.cpp ++++ b/pe_counting/ocount.cpp +@@ -579,6 +579,7 @@ static int _process_ocount_and_app_args(int argc, char * const argv[]) + { + bool keep_trying = true; + int idx_of_non_options = 0; ++ char * prev_env = getenv("POSIXLY_CORRECT"); + setenv("POSIXLY_CORRECT", "1", 0); + while (keep_trying) { + int option_idx = 0; +@@ -663,6 +664,10 @@ static int _process_ocount_and_app_args(int argc, char * const argv[]) + __print_usage_and_exit("ocount: unexpected end of arg parsing"); + } + } ++ ++ if (prev_env == NULL) ++ unsetenv("POSIXLY_CORRECT"); ++ + return idx_of_non_options; + } + +diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp +index 04a25d9..a186278 100644 +--- a/pe_profiling/operf.cpp ++++ b/pe_profiling/operf.cpp +@@ -1258,6 +1258,7 @@ static int _process_operf_and_app_args(int argc, char * const argv[]) + { + bool keep_trying = true; + int idx_of_non_options = 0; ++ char * prev_env = getenv("POSIXLY_CORRECT"); + setenv("POSIXLY_CORRECT", "1", 0); + while (keep_trying) { + int option_idx = 0; +@@ -1331,6 +1332,10 @@ static int _process_operf_and_app_args(int argc, char * const argv[]) + __print_usage_and_exit("unexpected end of arg parsing"); + } + } ++ ++ if (prev_env == NULL) ++ unsetenv("POSIXLY_CORRECT"); ++ + return idx_of_non_options; + } + +-- +2.1.0 + diff --git a/SOURCES/oprofile-extramask.patch b/SOURCES/oprofile-extramask.patch new file mode 100644 index 0000000..6863288 --- /dev/null +++ b/SOURCES/oprofile-extramask.patch @@ -0,0 +1,97 @@ +From dd433306f249db81f1ef5cfffefeb2d0ad4e3115 Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Tue, 10 Mar 2015 10:52:39 -0400 +Subject: [PATCH] Ensure that umask is set if the extra bits (edge, inv, cmask) + are used + +When testing ocount on some of the Intel processor it was discovered +that that the umask not not being set for events that specified the +the extra bits. Below is an example of the problem on an Intel Ivy +Bridge processor with the event code missing the 0x03 unit masks for +the events: + +$ ocount --verbose -e int_misc:recovery_cycles -e int_misc:recovery_stalls_count ls +Final event code is 140000d +Final event code is 144000d +Number of events passed is 2 +Exec args are: ls +telling child to start app +parent says start app /usr/bin/ls +calling perf_event_open for pid 240d +perf_event_open returning fd 9 +perf_event_open returning fd a +perf counter setup complete +app 240d is running +going into waitpid on monitored app 240d +app process ended normally. +Reading counter data for event int_misc +Reading counter data for event int_misc + +Events were actively counted for 1070382 nanoseconds. +Event counts (actual) for /usr/bin/ls: + Event Count % time counted + int_misc:recovery_cycles 0 100.00 + int_misc:recovery_stalls_count 0 100.00 + +With this patch the umasks are included and the example executes correctly: + +$ ocount --verbose -e int_misc:recovery_cycles -e int_misc:recovery_stalls_count ls +Final event code is 140030d +Final event code is 144030d +Number of events passed is 2 +Exec args are: ls +telling child to start app +calling perf_event_open for pid 72e1 +parent says start app /usr/bin/ls +perf_event_open returning fd 9 +perf_event_open returning fd a +perf counter setup complete +app 72e1 is running +going into waitpid on monitored app 72e1 +app process ended normally. +Reading counter data for event int_misc +Reading counter data for event int_misc + +Events were actively counted for 1216948 nanoseconds. +Event counts (actual) for /usr/bin/ls: + Event Count % time counted + int_misc:recovery_cycles 69,730 100.00 + int_misc:recovery_stalls_count 14,800 100.00 + +Signed-off-by: William Cohen +--- + libop/op_events.c | 3 +++ + libop/op_events.h | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/libop/op_events.c b/libop/op_events.c +index 99266c6..2badc8e 100644 +--- a/libop/op_events.c ++++ b/libop/op_events.c +@@ -238,6 +238,9 @@ static void parse_um_entry(struct op_described_um * entry, char const * line) + if (strisprefix(c, "extra:")) { + c += 6; + entry->extra = parse_extra(c); ++ /* include the regular umask if there are real extra bits */ ++ if (entry->extra != EXTRA_NONE) ++ entry->extra |= (entry->value & UMASK_MASK) << UMASK_SHIFT; + /* named mask */ + c = skip_nonws(c); + c = skip_ws(c); +diff --git a/libop/op_events.h b/libop/op_events.h +index ec345e5..f09c830 100644 +--- a/libop/op_events.h ++++ b/libop/op_events.h +@@ -20,6 +20,9 @@ extern "C" { + #include "op_types.h" + #include "op_list.h" + ++#define UMASK_SHIFT 8 ++#define UMASK_MASK 0xff ++ + #define EXTRA_EDGE (1U << 18) + #define EXTRA_MIN_VAL EXTRA_EDGE + +-- +2.1.0 + diff --git a/SOURCES/oprofile-hugepage.patch b/SOURCES/oprofile-hugepage.patch new file mode 100644 index 0000000..111ba1d --- /dev/null +++ b/SOURCES/oprofile-hugepage.patch @@ -0,0 +1,34 @@ +From 0246c6ba4a08378c46c17617d831d6baf0f44989 Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Fri, 9 Jan 2015 16:44:09 -0500 +Subject: [PATCH] Allow operf to track anon_hugepage mmap entries + +The perf mmap information for anon_huge pages has a different filename +("/anon_hugepage") than the mmap information for regions composed of +normal sized pages ("//anon"). This results in opreport not being +able to map samples collected by operf to Java methods when the Java +VM uses statically allocated huge pages (rhbz1180512 and rhbz1180513). + +Signed-off-by: William Cohen +--- + libperf_events/operf_utils.cpp | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp +index a87524b..90a0765 100644 +--- a/libperf_events/operf_utils.cpp ++++ b/libperf_events/operf_utils.cpp +@@ -295,6 +295,10 @@ static void __handle_mmap_event(event_t * event) + strlen("//anon")) == 0)) { + mapping->is_anon_mapping = true; + strcpy(mapping->filename, "anon"); ++ } else if ((strncmp(mapping->filename, "/anon_hugepage", ++ strlen("/anon_hugepage")) == 0)) { ++ mapping->is_anon_mapping = true; ++ strcpy(mapping->filename, "anon"); + } + mapping->end_addr = (event->mmap.len == 0ULL)? 0ULL : mapping->start_addr + event->mmap.len - 1; + mapping->pgoff = event->mmap.pgoff; +-- +2.1.0 + diff --git a/SOURCES/oprofile-maskarray.patch b/SOURCES/oprofile-maskarray.patch new file mode 100644 index 0000000..2851b63 --- /dev/null +++ b/SOURCES/oprofile-maskarray.patch @@ -0,0 +1,33 @@ +commit ef501aa609f49c06df9f33c9a7330dffd71b31b3 +Author: Maynard Johnson +Date: Thu Oct 31 11:11:06 2013 -0500 + + Fix handling of default named unit masks longer than 11 chars + + The handling of default unit masks that are names instead of hex + values is new with oprofile 0.9.9. I've discovered a bug in this + handling when the name exceeds 11 characters. For example, on + Sandybridge, the following ocount command fails: + + [mpjohn@oc1757000783 test-stuff]$ ocount -e l1d_blocks ls + Cannot find unit mask bank_confli for l1d_blocks + Unable to find unit mask info for bank_confli for event l1d_blocks + + This problem was due to the char array ('mask') being too small. + + Signed-off-by: Maynard Johnson + +diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp +index 177835e..9e2addb 100644 +--- a/libpe_utils/op_pe_utils.cpp ++++ b/libpe_utils/op_pe_utils.cpp +@@ -413,8 +413,8 @@ static void _get_event_code(operf_event_t * event, op_cpu cpu_type) + + + #if defined(__i386__) || defined(__x86_64__) ++ char mask[OP_MAX_UM_NAME_LEN]; + // Setup EventSelct[11:8] field for AMD +- char mask[12]; + const char * vendor_AMD = "AuthenticAMD"; + if (op_is_cpu_vendor((char *)vendor_AMD)) { + config = base_code & 0xF00ULL; diff --git a/SPECS/oprofile.spec b/SPECS/oprofile.spec index f2e0c94..57e5506 100644 --- a/SPECS/oprofile.spec +++ b/SPECS/oprofile.spec @@ -3,7 +3,7 @@ Summary: System wide profiler Name: %{?scl_prefix}oprofile Version: 0.9.9 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ and LGPLv2+ Group: Development/System # @@ -26,6 +26,11 @@ Patch402: oprofile-broadwell.patch Patch500: oprofile-aarch64.patch Patch600: oprofile-power8.patch Patch601: oprofile-ppc64le.patch +Patch700: oprofile-hugepage.patch +Patch800: oprofile-defaultmask.patch +Patch801: oprofile-extramask.patch +Patch802: oprofile-maskarray.patch +Patch803: oprofile-env.patch URL: http://oprofile.sf.net @@ -115,6 +120,11 @@ agent library. %patch500 -p1 -b .aarch64 %patch600 -p1 -b .power8 %patch601 -p1 -b .ppc64le +%patch700 -p1 +%patch800 -p1 +%patch801 -p1 +%patch802 -p1 +%patch803 -p1 ./autogen.sh @@ -197,6 +207,13 @@ exit 0 %{_sysconfdir}/ld.so.conf.d/* %changelog +* Thu Apr 23 2015 Will Cohen - 0.9.9-7 +- LLC_REFS and LLC_MISSES do not work on some CPUs. +- incorrect handling of default unit masks longer than 11 characters +- Oprofile updates for Avoton +- Unable to profile jited JVM code when using static huge pages +- operf causes rpmbuild to fail + * Wed Sep 17 2014 Will Cohen - 0.9.9-6 - Update support for Intel Silvermont (Avoton). - Enable configure for ppc64le.