From 1b57b65520fe928d60ca533ff6d39692c370f190ff67b137c759804621b3a9f0 Mon Sep 17 00:00:00 2001 From: Tony Jones Date: Thu, 6 Mar 2014 21:33:00 +0000 Subject: [PATCH] Accepting request 224922 from home:jones_tony:branches:devel:tools OBS-URL: https://build.opensuse.org/request/show/224922 OBS-URL: https://build.opensuse.org/package/show/devel:tools/oprofile?expand=0&rev=32 --- ...ing-libpfm-is-not-informative-enough.patch | 39 ++++++++++++++ ...-enable-for-new-ppc64le-architecture.patch | 51 +++++++++++++++++++ ...type-file-for-reading-for-ibm-power7.patch | 30 +++++++++++ ...pu-type-power8e-equivalent-to-power8.patch | 29 +++++++++++ oprofile-pfm-ppc.patch | 6 +-- oprofile.changes | 11 ++++ oprofile.spec | 15 ++++-- 7 files changed, 175 insertions(+), 6 deletions(-) create mode 100644 oprofile-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch create mode 100644 oprofile-enable-for-new-ppc64le-architecture.patch create mode 100644 oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch create mode 100644 oprofile-make-cpu-type-power8e-equivalent-to-power8.patch diff --git a/oprofile-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch b/oprofile-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch new file mode 100644 index 0000000..0fe5070 --- /dev/null +++ b/oprofile-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch @@ -0,0 +1,39 @@ +From: Maynard Johnson +Git-commit: a2811baceccff810e055f166792acdf7a920bf8c +Subject: configure error message for missing libpfm is not informative enough +Date: Wed Oct 9 14:27:54 2013 -0500 + + configure error message for missing libpfm is not informative enough + + On the ppc64 architecture, the libpfm library is used to get perf_events + encodings for events, so the configure script checks for the availability + of that library when building for ppc64. If the library is missing, the + configure error message is: + + checking for perfmon/pfmlib.h... no + configure: error: pfmlib.h not found; usually provided in papi devel package + + However, some newer distros (like Fedora 19) are now delivering separate + packages for libpfm and papi, instead of bundling them together. The patch + provided herein changes the configure message to reflect that change in + packaging. + + Signed-off-by: Maynard Johnson + +diff --git a/configure.ac b/configure.ac +index 758b676..457145a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -185,10 +185,10 @@ AC_CANONICAL_HOST + if test "$HAVE_PERF_EVENTS" = "1"; then + PFM_LIB= + if test "$host_cpu" = "powerpc64"; then +- AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])]) ++ AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; may be provided by libpfm devel or papi devel package])]) + AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1', [ + AC_CHECK_LIB(pfm, pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', +- [AC_MSG_ERROR([libpfm not found; usually provided in papi devel package])])]) ++ [AC_MSG_ERROR([libpfm not found; may be provided by libpfm devel or papi devel package])])]) + PFM_LIB="-lpfm" + AC_DEFINE_UNQUOTED(HAVE_LIBPFM3, $HAVE_LIBPFM3, [Define to 1 if using libpfm3; 0 if using newer libpfm]) + AC_DEFINE_UNQUOTED(HAVE_LIBPFM, $HAVE_LIBPFM, [Define to 1 if libpfm is available]) diff --git a/oprofile-enable-for-new-ppc64le-architecture.patch b/oprofile-enable-for-new-ppc64le-architecture.patch new file mode 100644 index 0000000..b6ecb6a --- /dev/null +++ b/oprofile-enable-for-new-ppc64le-architecture.patch @@ -0,0 +1,51 @@ +From: Maynard Johnson +Subject: Enable oprofile for new ppc64le architecture +Git-commit: a265c549bff149f5e9064dca7d06b6689fb3d64e +Date: Thu Jan 9 15:47:09 2014 -0600 + + Enable oprofile for new ppc64le architecture + + Signed-off-by: Maynard Johnson + +diff --git a/configure.ac b/configure.ac +index 457145a..1e3a65f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -184,7 +184,7 @@ AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf + AC_CANONICAL_HOST + if test "$HAVE_PERF_EVENTS" = "1"; then + PFM_LIB= +- if test "$host_cpu" = "powerpc64"; then ++ if test "$host_cpu" = "powerpc64le" -o "$host_cpu" = "powerpc64"; then + AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; may be provided by libpfm devel or papi devel package])]) + AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1', [ + AC_CHECK_LIB(pfm, pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', +diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c +index 7d5262c..15c71ab 100644 +--- a/libop/op_cpu_type.c ++++ b/libop/op_cpu_type.c +@@ -621,7 +621,8 @@ static op_cpu __get_cpu_type_alt_method(void) + fnmatch("i?86", uname_info.machine, 0) == 0) { + return _get_x86_64_cpu_type(); + } +- if (strncmp(uname_info.machine, "ppc64", 5) == 0) { ++ if ((strncmp(uname_info.machine, "ppc64", 5) == 0) || ++ (strncmp(uname_info.machine, "ppc64le", 7) == 0)) { + return _get_ppc64_cpu_type(); + } + if (strncmp(uname_info.machine, "arm", 3) == 0) { +diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp +index 67edd09..4b744f8 100644 +--- a/libutil++/bfd_support.cpp ++++ b/libutil++/bfd_support.cpp +@@ -634,9 +634,7 @@ void bfd_info::translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms) + bool bfd_info::get_synth_symbols() + { + extern const bfd_target bfd_elf64_powerpc_vec; +- extern const bfd_target bfd_elf64_powerpcle_vec; +- bool is_elf64_powerpc_target = (abfd->xvec == &bfd_elf64_powerpc_vec) +- || (abfd->xvec == &bfd_elf64_powerpcle_vec); ++ bool is_elf64_powerpc_target = (abfd->xvec == &bfd_elf64_powerpc_vec); + + if (!is_elf64_powerpc_target) + return false; diff --git a/oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch b/oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch new file mode 100644 index 0000000..95836c4 --- /dev/null +++ b/oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch @@ -0,0 +1,30 @@ +From: Maynard Johnson +Subject: Fix "Unable to open cpu_type file for reading" for IBM POWER7+ +Git-commit: 88ed74bade0096042d643a6d7e68c2cbc4b6e34d +Date: Thu Jan 9 15:07:21 2014 -0600 + + Fix "Unable to open cpu_type file for reading" for IBM POWER7+ + + Using operf to do profiling on an IBM POWER7+ may result in + the following error message: + + Unable to open cpu_type file for reading + + This patch fixes the problem. There is also a simple workaround of + running 'opcontrol --init'. + + Signed-off-by: Maynard Johnson + +diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c +index cd75ad4..7d5262c 100644 +--- a/libop/op_cpu_type.c ++++ b/libop/op_cpu_type.c +@@ -326,6 +326,8 @@ static op_cpu _get_ppc64_cpu_type(void) + for (i = 0; i < (int)len ; i++) + cpu_name_lowercase[i] = tolower(cpu_name[i]); + ++ if (strncmp(cpu_name_lowercase, "power7+", 7) == 0) ++ cpu_name_lowercase[6] = '\0'; + cpu_type_str[0] = '\0'; + strcat(cpu_type_str, "ppc64/"); + strncat(cpu_type_str, cpu_name_lowercase, len); diff --git a/oprofile-make-cpu-type-power8e-equivalent-to-power8.patch b/oprofile-make-cpu-type-power8e-equivalent-to-power8.patch new file mode 100644 index 0000000..46e9179 --- /dev/null +++ b/oprofile-make-cpu-type-power8e-equivalent-to-power8.patch @@ -0,0 +1,29 @@ +From: Maynard Johnson +Subject: Make cpu type POWER8E equivalent to POWER8 +Git-commit: 7243fa4ed8a25c6e59225a863fd263ce70989087 +Date: Tue Feb 4 08:27:10 2014 -0600 + + Make cpu type POWER8E equivalent to POWER8 + + Recent mainline kernel changes resulted in a cpu type of + "POWER8E" being displayed in /proc/cpuinfo for certain revisions + of the IBM POWER8 processor model. But for profiling and + counting of native events, we can ignore the differences between + POWER8 and POWER8E. This patch addresses that issue. + + Signed-off-by: Maynard Johnson + +diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c +index 2907f36..1ae2913 100644 +--- a/libop/op_cpu_type.c ++++ b/libop/op_cpu_type.c +@@ -331,6 +331,9 @@ static op_cpu _get_ppc64_cpu_type(void) + + if (strncmp(cpu_name_lowercase, "power7+", 7) == 0) + cpu_name_lowercase[6] = '\0'; ++ if (strncmp(cpu_name_lowercase, "power8e", 7) == 0) ++ cpu_name_lowercase[6] = '\0'; ++ + cpu_type_str[0] = '\0'; + strcat(cpu_type_str, "ppc64/"); + strncat(cpu_type_str, cpu_name_lowercase, len); diff --git a/oprofile-pfm-ppc.patch b/oprofile-pfm-ppc.patch index 24e1a8c..3840c02 100644 --- a/oprofile-pfm-ppc.patch +++ b/oprofile-pfm-ppc.patch @@ -12,8 +12,8 @@ Upstream: no AC_CANONICAL_HOST if test "$HAVE_PERF_EVENTS" = "1"; then PFM_LIB= -- if test "$host_cpu" = "powerpc64"; then -+ if test "$host_cpu" = "powerpc64" || test "$host_cpu" = "powerpc32"; then - AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])]) +- if test "$host_cpu" = "powerpc64le" -o "$host_cpu" = "powerpc64"; then ++ if test "$host_cpu" = "powerpc64le" -o "$host_cpu" = "powerpc64" -o "$host_cpu" = "powerpc32"; then + AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; may be provided by libpfm devel or papi devel package])]) AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1', [ AC_CHECK_LIB(pfm, pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', diff --git a/oprofile.changes b/oprofile.changes index c179e3b..504f13b 100644 --- a/oprofile.changes +++ b/oprofile.changes @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Thu Mar 6 19:40:06 UTC 2014 - tonyj@suse.com + +- Support ppc64le/power8e (bnc#867091) + added patches: + * oprofile-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch + * oprofile-enable-for-new-ppc64le-architecture.patch + * oprofile-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch + * oprofile-make-cpu-type-power8e-equivalent-to-power8.patch + modified patches: + * oprofile-pfm-ppc.patch +------------------------------------------------------------------- Wed Aug 7 17:18:32 UTC 2013 - tonyj@suse.com - Update to version 0.9.9 diff --git a/oprofile.spec b/oprofile.spec index cd96ca0..285b83c 100644 --- a/oprofile.spec +++ b/oprofile.spec @@ -1,7 +1,7 @@ # # spec file for package oprofile # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,7 +25,7 @@ BuildRequires: libxslt BuildRequires: popt-devel BuildRequires: qt-devel BuildRequires: update-desktop-files -%ifarch ppc ppc64 +%ifarch ppc ppc64 ppc64le BuildRequires: libpfm-devel >= 4.3.0 %endif Url: http://oprofile.sourceforge.net/ @@ -44,7 +44,11 @@ Source4: jvmpi.h Source5: README-BEFORE-ADDING-PATCHES Patch1: %{name}-compressed-kernel.patch Patch2: %{name}-no-libjvm-version.patch -Patch3: %{name}-pfm-ppc.patch +Patch3: %{name}-configure-error-message-for-missing-libpfm-is-not-informative-enough.patch +Patch4: %{name}-enable-for-new-ppc64le-architecture.patch +Patch5: %{name}-fix-unable-to-open-cpu_type-file-for-reading-for-ibm-power7.patch +Patch6: %{name}-make-cpu-type-power8e-equivalent-to-power8.patch +Patch7: %{name}-pfm-ppc.patch %description OProfile is a system-wide profiler for Linux systems, capable of @@ -98,6 +102,11 @@ from supported virtual machines. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 + mkdir -p java/include # copy files necessary to build Java agent libraries # libjvmpi_oprofile.so and libjvmti_oprofile.so