mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
oprofile: Update to 0.9.9
Backport patches to fix with gcc 4.9 delete applied patches and obsoleted ones (From OE-Core rev: 9ef0ed510aff5e975fb6d8be9330a10172a5b5d8) (From OE-Core rev: 5b5016ed87bcc916d29fb7e1e3d23a600847c882) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -7,8 +7,7 @@ BUGTRACKER = "http://sourceforge.net/tracker/?group_id=16191&atid=116191"
|
|||||||
LICENSE = "LGPLv2.1+ & GPLv2"
|
LICENSE = "LGPLv2.1+ & GPLv2"
|
||||||
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
|
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
|
||||||
file://libopagent/opagent.h;beginline=5;endline=26;md5=4f16f72c7a493d8a4704aa18d03d15c6 \
|
file://libopagent/opagent.h;beginline=5;endline=26;md5=4f16f72c7a493d8a4704aa18d03d15c6 \
|
||||||
file://daemon/liblegacy/p_module.h;beginline=2;endline=20;md5=fc23a43455edf185307274a99730b6e4"
|
"
|
||||||
|
|
||||||
SECTION = "devel"
|
SECTION = "devel"
|
||||||
|
|
||||||
DEPENDS = "popt binutils"
|
DEPENDS = "popt binutils"
|
||||||
@@ -19,10 +18,7 @@ FILES_${PN} = "${bindir} ${libdir}/${BPN}/lib*${SOLIBS} ${datadir}/${BPN}"
|
|||||||
FILES_${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/lib*.la"
|
FILES_${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/lib*.la"
|
||||||
FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
|
FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
|
||||||
|
|
||||||
INC_PR = "r2"
|
|
||||||
|
|
||||||
SRC_URI = "file://opstart.patch \
|
SRC_URI = "file://opstart.patch \
|
||||||
file://oprofile-no-query-modules.patch \
|
|
||||||
file://oprofile-root.patch \
|
file://oprofile-root.patch \
|
||||||
file://acinclude.m4"
|
file://acinclude.m4"
|
||||||
|
|
||||||
|
|||||||
@@ -1,208 +0,0 @@
|
|||||||
Upstream-Status: Accepted
|
|
||||||
|
|
||||||
From 36028035555297695f52e856f21920012fd64f79 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Fri, 11 Jan 2013 13:29:57 -0600
|
|
||||||
Subject: [PATCH] Allow ppc64 events to be specified with or without _GRP<n>
|
|
||||||
suffix
|
|
||||||
|
|
||||||
All events for IBM PowerPC server processors (except CYCLES) have
|
|
||||||
a _GRP<n> suffix. This is because the legacy opcontrol profiler
|
|
||||||
can only profile events in the same group (i.e., having the same
|
|
||||||
_GRP<n> suffix). But operf has no such restriction because it
|
|
||||||
can multiplex events; thus, so we should allow the user to pass
|
|
||||||
event names without the _GRP<n> suffix.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
---
|
|
||||||
doc/operf.1.in | 6 +++
|
|
||||||
doc/oprofile.xml | 12 +++++-
|
|
||||||
pe_profiling/operf.cpp | 107 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
utils/ophelp.c | 4 ++
|
|
||||||
4 files changed, 127 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/doc/operf.1.in b/doc/operf.1.in
|
|
||||||
index b109324..03027ca 100644
|
|
||||||
--- a/doc/operf.1.in
|
|
||||||
+++ b/doc/operf.1.in
|
|
||||||
@@ -110,6 +110,12 @@ be specified using the symbolic name. If no unit mask is specified, 0x0 will be
|
|
||||||
used as the default.
|
|
||||||
.P
|
|
||||||
.RS
|
|
||||||
+On IBM PowerPC systems, events may be specified with or without the
|
|
||||||
+.I _GRP<n>
|
|
||||||
+suffix. If no group number suffix is given, one will be automatically
|
|
||||||
+assigned; thus, OProfile post-processing tools will always show real event
|
|
||||||
+names that include the group number suffix.
|
|
||||||
+.P
|
|
||||||
When no event specification is given, the default event for the running
|
|
||||||
processor type will be used for profiling.
|
|
||||||
Use
|
|
||||||
diff --git a/doc/oprofile.xml b/doc/oprofile.xml
|
|
||||||
index 0ae2b0b..0f74726 100644
|
|
||||||
--- a/doc/oprofile.xml
|
|
||||||
+++ b/doc/oprofile.xml
|
|
||||||
@@ -1106,10 +1106,18 @@ shown by the output of <command>ophelp</command>. Unit masks with "extra:" para
|
|
||||||
specified using the symbolic name.
|
|
||||||
</para>
|
|
||||||
<note><para>
|
|
||||||
-When using legacy mode <command>opcontrol</command> on PowerPC platforms, all events specified must be in the same group;
|
|
||||||
+When using legacy mode <command>opcontrol</command> on IBM PowerPC platforms, all events specified must be in the same group;
|
|
||||||
i.e., the group number appended to the event name (e.g. <constant><<emphasis>some-event-name</emphasis>>_GRP9
|
|
||||||
</constant>) must be the same.
|
|
||||||
-</para></note>
|
|
||||||
+</para>
|
|
||||||
+<para>
|
|
||||||
+When profiling with <command>operf</command> on IBM PowerPC platforms, the above restriction
|
|
||||||
+regarding the same group number does not apply, and events may be
|
|
||||||
+specified with or without the group number suffix. If no group number suffix is given, one will be automatically
|
|
||||||
+assigned; thus, OProfile post-processing tools will always show real event
|
|
||||||
+names that include the group number suffix.
|
|
||||||
+</para>
|
|
||||||
+</note>
|
|
||||||
<para>
|
|
||||||
If OProfile is using timer-interrupt mode, there is no event configuration possible.
|
|
||||||
</para>
|
|
||||||
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
|
|
||||||
index 4416b29..a776e71 100644
|
|
||||||
--- a/pe_profiling/operf.cpp
|
|
||||||
+++ b/pe_profiling/operf.cpp
|
|
||||||
@@ -1146,6 +1146,108 @@ static void _get_event_code(operf_event_t * event)
|
|
||||||
event->evt_code = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+/* All ppc64 events (except CYCLES) have a _GRP<n> suffix. This is
|
|
||||||
+ * because the legacy opcontrol profiler can only profile events in
|
|
||||||
+ * the same group (i.e., having the same _GRP<n> suffix). But operf
|
|
||||||
+ * can multiplex events, so we should allow the user to pass event
|
|
||||||
+ * names without the _GRP<n> suffix.
|
|
||||||
+ *
|
|
||||||
+ * If event name is not CYCLES or does not have a _GRP<n> suffix,
|
|
||||||
+ * we'll call ophelp and scan the list of events, searching for one
|
|
||||||
+ * that matches up to the _GRP<n> suffix. If we don't find a match,
|
|
||||||
+ * then we'll exit with the expected error message for invalid event name.
|
|
||||||
+ */
|
|
||||||
+static string _handle_powerpc_event_spec(string event_spec)
|
|
||||||
+{
|
|
||||||
+ FILE * fp;
|
|
||||||
+ char line[MAX_INPUT];
|
|
||||||
+ size_t grp_pos;
|
|
||||||
+ string evt, retval, err_msg;
|
|
||||||
+ size_t evt_name_len;
|
|
||||||
+ bool first_non_cyc_evt_found = false;
|
|
||||||
+ bool event_found = false;
|
|
||||||
+ char event_name[OP_MAX_EVT_NAME_LEN], event_spec_str[OP_MAX_EVT_NAME_LEN + 20], * count_str;
|
|
||||||
+ string cmd = OP_BINDIR;
|
|
||||||
+ cmd += "/ophelp";
|
|
||||||
+
|
|
||||||
+ strncpy(event_spec_str, event_spec.c_str(), event_spec.length() + 1);
|
|
||||||
+
|
|
||||||
+ strncpy(event_name, strtok(event_spec_str, ":"), OP_MAX_EVT_NAME_LEN);
|
|
||||||
+ count_str = strtok(NULL, ":");
|
|
||||||
+ if (!count_str) {
|
|
||||||
+ err_msg = "Invalid count for event ";
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!strcmp("CYCLES", event_name)) {
|
|
||||||
+ event_found = true;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ evt = event_name;
|
|
||||||
+ // Need to make sure the event name truly has a _GRP<n> suffix.
|
|
||||||
+ grp_pos = evt.rfind("_GRP");
|
|
||||||
+ if ((grp_pos != string::npos) && ((evt = evt.substr(grp_pos, string::npos))).length() > 4) {
|
|
||||||
+ unsigned long value;
|
|
||||||
+ char * end;
|
|
||||||
+ value = strtoul(evt.substr(4, string::npos).c_str(), &end, 0);
|
|
||||||
+ if (end && (*end == '\0')) {
|
|
||||||
+ // Valid group number found after _GRP, so we can skip to the end.
|
|
||||||
+ event_found = true;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // If we get here, it implies the user passed a non-CYCLES event without a GRP suffix.
|
|
||||||
+ // Lets try to find a valid suffix for it.
|
|
||||||
+ fp = popen(cmd.c_str(), "r");
|
|
||||||
+ if (fp == NULL) {
|
|
||||||
+ cerr << "Unable to execute ophelp to get info for event "
|
|
||||||
+ << event_spec << endl;
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+ evt_name_len = strlen(event_name);
|
|
||||||
+ err_msg = "Cannot find event ";
|
|
||||||
+ while (fgets(line, MAX_INPUT, fp)) {
|
|
||||||
+ if (!first_non_cyc_evt_found) {
|
|
||||||
+ if (!strncmp(line, "PM_", 3))
|
|
||||||
+ first_non_cyc_evt_found = true;
|
|
||||||
+ else
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if (line[0] == ' ' || line[0] == '\t')
|
|
||||||
+ continue;
|
|
||||||
+ if (!strncmp(line, event_name, evt_name_len)) {
|
|
||||||
+ // Found a potential match. Check if it's a perfect match.
|
|
||||||
+ string save_event_name = event_name;
|
|
||||||
+ size_t full_evt_len = index(line, ':') - line;
|
|
||||||
+ memset(event_name, '\0', OP_MAX_EVT_NAME_LEN);
|
|
||||||
+ strncpy(event_name, line, full_evt_len);
|
|
||||||
+ string candidate = event_name;
|
|
||||||
+ if (candidate.rfind("_GRP") == evt_name_len) {
|
|
||||||
+ event_found = true;
|
|
||||||
+ break;
|
|
||||||
+ } else {
|
|
||||||
+ memset(event_name, '\0', OP_MAX_EVT_NAME_LEN);
|
|
||||||
+ strncpy(event_name, save_event_name.c_str(), evt_name_len);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ pclose(fp);
|
|
||||||
+
|
|
||||||
+out:
|
|
||||||
+ if (!event_found) {
|
|
||||||
+ cerr << err_msg << event_name << endl;
|
|
||||||
+ cerr << "Error retrieving info for event "
|
|
||||||
+ << event_spec << endl;
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+ retval = event_name;
|
|
||||||
+ return retval + ":" + count_str;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
static void _process_events_list(void)
|
|
||||||
{
|
|
||||||
string cmd = OP_BINDIR;
|
|
||||||
@@ -1154,6 +1256,11 @@ static void _process_events_list(void)
|
|
||||||
FILE * fp;
|
|
||||||
string full_cmd = cmd;
|
|
||||||
string event_spec = operf_options::evts[i];
|
|
||||||
+
|
|
||||||
+#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+ event_spec = _handle_powerpc_event_spec(event_spec);
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
if (operf_options::callgraph) {
|
|
||||||
full_cmd += " --callgraph=1 ";
|
|
||||||
}
|
|
||||||
diff --git a/utils/ophelp.c b/utils/ophelp.c
|
|
||||||
index 53a5dde..63895c8 100644
|
|
||||||
--- a/utils/ophelp.c
|
|
||||||
+++ b/utils/ophelp.c
|
|
||||||
@@ -652,6 +652,10 @@ int main(int argc, char const * argv[])
|
|
||||||
case CPU_PPC64_POWER7:
|
|
||||||
case CPU_PPC64_IBM_COMPAT_V1:
|
|
||||||
event_doc =
|
|
||||||
+ "When using operf, events may be specified without a '_GRP<n>' suffix.\n"
|
|
||||||
+ "If _GRP<n> (i.e., group number) is not specified, one will be automatically\n"
|
|
||||||
+ "selected for use by the profiler. OProfile post-processing tools will\n"
|
|
||||||
+ "always show real event names that include the group number suffix.\n\n"
|
|
||||||
"Documentation for IBM POWER7 can be obtained at:\n"
|
|
||||||
"http://www.power.org/events/Power7/\n"
|
|
||||||
"No public performance monitoring doc available for older processors.\n";
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
Upstream-Status: Backport
|
|
||||||
|
|
||||||
From 414f4dba2d77f3014755aa58937efb22a4789e9f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Fri, 21 Dec 2012 08:27:37 -0600
|
|
||||||
Subject: [PATCH] Change configure to look for libpfm4 function first; then
|
|
||||||
fallback to libpfm3
|
|
||||||
|
|
||||||
This change only affects ppc64 architecture, since it's the only
|
|
||||||
architecture that uses libpfm to obtain the event hex code to pass
|
|
||||||
to perf_event_open.
|
|
||||||
|
|
||||||
There were bugs in libpfm3 pertaining to POWER7 event definitions that
|
|
||||||
have been fixed in libpfm4. So it's likely that some IBM POWER7 users
|
|
||||||
may want to install libpfm4 and build oprofile to link with it. For
|
|
||||||
example, if libpfm4 were installed in /usr/local, the user would invoke
|
|
||||||
oprofile's configure thusly:
|
|
||||||
|
|
||||||
LDFLAGS="-L/usr/local/lib64" CPPFLAGS="-I/usr/local/include" ./configure
|
|
||||||
|
|
||||||
But if the user happens to also have libpfm3 already installed in /usr,
|
|
||||||
then the current order of config tests would result in choosing the libpfm3
|
|
||||||
library. This logic seems wrong. The configure checking should go from most
|
|
||||||
recent to older library versions. This patch changes the order of checking
|
|
||||||
so the libpfm4 library would be found first.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
---
|
|
||||||
configure.ac | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 3078393..a9b1ee4 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -160,8 +160,8 @@ if test "$HAVE_PERF_EVENTS" = "1"; then
|
|
||||||
arch="`uname -m`"
|
|
||||||
if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
|
|
||||||
AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])])
|
|
||||||
- AC_CHECK_LIB(pfm,pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', [
|
|
||||||
- AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1',
|
|
||||||
+ 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])])])
|
|
||||||
PFM_LIB="-lpfm"
|
|
||||||
AC_DEFINE_UNQUOTED(HAVE_LIBPFM3, $HAVE_LIBPFM3, [Define to 1 if using libpfm3; 0 if using newer libpfm])
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
Upstream-Status: Accepted
|
|
||||||
|
|
||||||
From 8e36ad01ceb1257d05773b684dbe9358aecd3f71 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Tue, 26 Feb 2013 13:41:27 -0600
|
|
||||||
Subject: [PATCH] Fix PPC64-specific libpfm usage so it doesn't break ppc32
|
|
||||||
architecture
|
|
||||||
|
|
||||||
The configure check to determine whether we should use libpfm or not
|
|
||||||
is intended only for the ppc64 architecture, but was incorrectly
|
|
||||||
hitting on the ppc32 architecture, too. Not only that, but it was using
|
|
||||||
'uname' which is not a good idea in cross-compile situtations.
|
|
||||||
|
|
||||||
Then, aside from that, we had several instances in the source code
|
|
||||||
of the following:
|
|
||||||
#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
which incorrectly included ppc32 architecutre also, when it was intended
|
|
||||||
for use as PPC64 architecture.
|
|
||||||
|
|
||||||
This patch fixes both errors.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com
|
|
||||||
---
|
|
||||||
configure.ac | 5 ++---
|
|
||||||
libperf_events/operf_utils.cpp | 4 ++--
|
|
||||||
libperf_events/operf_utils.h | 6 ++++++
|
|
||||||
pe_profiling/operf.cpp | 10 +++++-----
|
|
||||||
4 files changed, 15 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index a9b1ee4..a0da98c 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -154,11 +154,10 @@ else
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf_events exists])
|
|
||||||
-
|
|
||||||
+AC_CANONICAL_HOST
|
|
||||||
if test "$HAVE_PERF_EVENTS" = "1"; then
|
|
||||||
PFM_LIB=
|
|
||||||
- arch="`uname -m`"
|
|
||||||
- if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
|
|
||||||
+ 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_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/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
|
|
||||||
index da964fd..a17200b 100644
|
|
||||||
--- a/libperf_events/operf_utils.cpp
|
|
||||||
+++ b/libperf_events/operf_utils.cpp
|
|
||||||
@@ -83,7 +83,7 @@ static event_t comm_event;
|
|
||||||
* the following method is to map the operf-record event value to a value that
|
|
||||||
* opreport can understand.
|
|
||||||
*/
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
#define NIL_CODE ~0U
|
|
||||||
|
|
||||||
#if HAVE_LIBPFM3
|
|
||||||
@@ -716,7 +716,7 @@ static void __handle_sample_event(event_t * event, u64 sample_type)
|
|
||||||
} else if (event->header.misc == PERF_RECORD_MISC_USER) {
|
|
||||||
in_kernel = false;
|
|
||||||
}
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
else if (event->header.misc == PERF_RECORD_MISC_HYPERVISOR) {
|
|
||||||
#define MAX_HYPERVISOR_ADDRESS 0xfffffffULL
|
|
||||||
if (data.ip > MAX_HYPERVISOR_ADDRESS) {
|
|
||||||
diff --git a/libperf_events/operf_utils.h b/libperf_events/operf_utils.h
|
|
||||||
index 2df00b7..ddf05ed 100644
|
|
||||||
--- a/libperf_events/operf_utils.h
|
|
||||||
+++ b/libperf_events/operf_utils.h
|
|
||||||
@@ -45,6 +45,12 @@ extern bool throttled;
|
|
||||||
#define MMAP_WINDOW_SZ (32 * 1024 * 1024ULL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+/* A macro to be used for ppc64 architecture-specific code. The '__powerpc__' macro
|
|
||||||
+ * is defined for both ppc64 and ppc32 architectures, so we must further qualify by
|
|
||||||
+ * including the 'HAVE_LIBPFM' macro, since that macro will be defined only for ppc64.
|
|
||||||
+ */
|
|
||||||
+#define PPC64_ARCH (HAVE_LIBPFM) && ((defined(__powerpc__) || defined(__powerpc64__)))
|
|
||||||
+
|
|
||||||
extern unsigned int op_nr_counters;
|
|
||||||
|
|
||||||
static inline size_t align_64bit(u64 x)
|
|
||||||
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
|
|
||||||
index e7c2eab..e1190c2 100644
|
|
||||||
--- a/pe_profiling/operf.cpp
|
|
||||||
+++ b/pe_profiling/operf.cpp
|
|
||||||
@@ -1177,7 +1177,7 @@ static void _get_event_code(operf_event_t * event)
|
|
||||||
event->evt_code = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
/* All ppc64 events (except CYCLES) have a _GRP<n> suffix. This is
|
|
||||||
* because the legacy opcontrol profiler can only profile events in
|
|
||||||
* the same group (i.e., having the same _GRP<n> suffix). But operf
|
|
||||||
@@ -1287,7 +1287,7 @@ static void _process_events_list(void)
|
|
||||||
string full_cmd = cmd;
|
|
||||||
string event_spec = operf_options::evts[i];
|
|
||||||
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
event_spec = _handle_powerpc_event_spec(event_spec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1357,9 +1357,9 @@ static void _process_events_list(void)
|
|
||||||
_get_event_code(&event);
|
|
||||||
events.push_back(event);
|
|
||||||
}
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
{
|
|
||||||
- /* This section of code is for architectures such as ppc[64] for which
|
|
||||||
+ /* This section of code is soley for the ppc64 architecture for which
|
|
||||||
* the oprofile event code needs to be converted to the appropriate event
|
|
||||||
* code to pass to the perf_event_open syscall.
|
|
||||||
*/
|
|
||||||
@@ -1404,7 +1404,7 @@ static void get_default_event(void)
|
|
||||||
_get_event_code(&dft_evt);
|
|
||||||
events.push_back(dft_evt);
|
|
||||||
|
|
||||||
-#if (defined(__powerpc__) || defined(__powerpc64__))
|
|
||||||
+#if PPC64_ARCH
|
|
||||||
{
|
|
||||||
/* This section of code is for architectures such as ppc[64] for which
|
|
||||||
* the oprofile event code needs to be converted to the appropriate event
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
Upstream-Status: Backport
|
|
||||||
|
|
||||||
From ca6d916a6f8f0f8abbb4c9b6a97dd1a1615bb124 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Wed, 5 Dec 2012 10:16:35 -0600
|
|
||||||
Subject: [PATCH] Fix up configure to handle architectures that do not
|
|
||||||
implement perf_event_open
|
|
||||||
|
|
||||||
This patch fixes the following problems:
|
|
||||||
|
|
||||||
1) The configure script allows the user to pass a location to kernel
|
|
||||||
headers (via --with-kernel option) such that, even if the running
|
|
||||||
kernel does not have perf_events support, it may be possible to
|
|
||||||
build operf (e.g., in cross-compile environments). But the message
|
|
||||||
'This kernel does not have perf_events support; falling back to legacy
|
|
||||||
oprofile' was being displayed inappropriately in such cases. This
|
|
||||||
patch changes the configure script so that the "falling back to
|
|
||||||
legacy oprofile" message will only be displayed if we're running
|
|
||||||
on a kernel that does not have perf_events support AND the user
|
|
||||||
did not pass specify the "--with-kernel" option.
|
|
||||||
|
|
||||||
2) Some architectures don't even implement the perf_event_open syscall, so the
|
|
||||||
configure script must do more than checking kernel version and whether or not
|
|
||||||
perf_event.h is present in order to decide if perf_events is supported.
|
|
||||||
This patch provides that extra capability.
|
|
||||||
|
|
||||||
These problems were reported by Tony Jones <tonyj@suse.com>.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
---
|
|
||||||
configure.ac | 74 +++++++++++++++++++++++++++++-----------
|
|
||||||
utils/op_perf_events_checker.c | 6 ++--
|
|
||||||
2 files changed, 58 insertions(+), 22 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 5c3d13d..89336ee 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -70,34 +70,66 @@ KERNELDIR=$withval)
|
|
||||||
|
|
||||||
|
|
||||||
dnl Check kernel version for perf_events supported
|
|
||||||
-AC_MSG_CHECKING([kernel version supports perf_events])
|
|
||||||
if test "$KERNELDIR" != ""; then
|
|
||||||
KINC="$KERNELDIR/include"
|
|
||||||
-fi
|
|
||||||
-AX_KERNEL_VERSION(2, 6, 31, <=, kernel_has_perf_events_support="yes",
|
|
||||||
-kernel_has_perf_events_support="no")
|
|
||||||
-
|
|
||||||
-if test "$kernel_has_perf_events_support" = "no"; then
|
|
||||||
- AC_MSG_RESULT([This kernel does not have perf_events support; falling back to legacy oprofile])
|
|
||||||
+ PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
|
|
||||||
+ AC_SUBST(PERF_EVENT_FLAGS)
|
|
||||||
+ PERF_EVENT_H="$KERNELDIR/include/linux/perf_event.h"
|
|
||||||
else
|
|
||||||
- AC_MSG_RESULT([This kernel has perf_events support])
|
|
||||||
+ PERF_EVENT_H="/usr/include/linux/perf_event.h"
|
|
||||||
fi
|
|
||||||
|
|
||||||
-if test "$KERNELDIR" == ""; then
|
|
||||||
- PERF_EVENT_H="/usr/include/linux/perf_event.h"
|
|
||||||
+PERF_EVENT_H_EXISTS="no"
|
|
||||||
+kernel_may_have_perf_events_support="no"
|
|
||||||
+AX_KERNEL_VERSION(2, 6, 31, <=, kernel_may_have_perf_events_support="yes",
|
|
||||||
+kernel_has_perf_events_support="no")
|
|
||||||
+
|
|
||||||
+dnl The AX_KERNEL_VERSION macro may return kernel_may_have_perf_events_support="yes",
|
|
||||||
+dnl indicating a partial answer. Some architectures do not implement the Performance
|
|
||||||
+dnl Events Kernel Subsystem even with kernel versions > 2.6.31 -- i.e., not even
|
|
||||||
+dnl implementing the perf_event_open syscall to return ENOSYS. So the check below
|
|
||||||
+dnl will identify and handle such situations.
|
|
||||||
+
|
|
||||||
+if test "$kernel_may_have_perf_events_support" = "yes"; then
|
|
||||||
+ AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
|
|
||||||
+ AC_MSG_CHECKING([kernel supports perf_events])
|
|
||||||
+ if test "$PERF_EVENT_H_EXISTS" = "yes"; then
|
|
||||||
+ rm -f test-for-PERF_EVENT_OPEN
|
|
||||||
+ AC_LANG_CONFTEST(
|
|
||||||
+ [AC_LANG_PROGRAM([[#include <linux/perf_event.h>
|
|
||||||
+ #include <asm/unistd.h>
|
|
||||||
+ #include <sys/types.h>
|
|
||||||
+ #include <string.h>
|
|
||||||
+ ]],
|
|
||||||
+ [[struct perf_event_attr attr;
|
|
||||||
+ pid_t pid;
|
|
||||||
+ memset(&attr, 0, sizeof(attr));
|
|
||||||
+ attr.size = sizeof(attr);
|
|
||||||
+ attr.sample_type = PERF_SAMPLE_IP;
|
|
||||||
+ pid = getpid();
|
|
||||||
+ syscall(__NR_perf_event_open, &attr, pid, 0, -1, 0);
|
|
||||||
+ ]])
|
|
||||||
+ ])
|
|
||||||
+ $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o test-for-PERF_EVENT_OPEN > /dev/null 2>&1
|
|
||||||
+ if test -f test-for-PERF_EVENT_OPEN; then
|
|
||||||
+ kernel_has_perf_events_support="yes"
|
|
||||||
+ AC_MSG_RESULT(yes)
|
|
||||||
+ else
|
|
||||||
+ AC_MSG_RESULT(no)
|
|
||||||
+ kernel_has_perf_events_support="no"
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ AC_MSG_RESULT(unknown -- perf_event.h not found)
|
|
||||||
+ fi
|
|
||||||
else
|
|
||||||
- PERF_EVENT_H="$KERNELDIR/include/linux/perf_event.h"
|
|
||||||
+ AC_MSG_RESULT(kernel supports perf_events... no)
|
|
||||||
+ kernel_has_perf_events_support="no"
|
|
||||||
fi
|
|
||||||
-AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
|
|
||||||
-AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test -n "$PERF_EVENT_H_EXISTS")
|
|
||||||
-if test "$PERF_EVENT_H_EXISTS" = "yes"; then
|
|
||||||
- HAVE_PERF_EVENTS='1'
|
|
||||||
|
|
||||||
- if test "$KERNELDIR" != ""; then
|
|
||||||
- PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
|
|
||||||
- AC_SUBST(PERF_EVENT_FLAGS)
|
|
||||||
- fi
|
|
||||||
+AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test "$kernel_has_perf_events_support" = "yes")
|
|
||||||
|
|
||||||
+if test "$kernel_has_perf_events_support" = "yes"; then
|
|
||||||
+ HAVE_PERF_EVENTS='1'
|
|
||||||
AC_MSG_CHECKING([whether PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
|
|
||||||
rm -f test-for-PERF_GUEST
|
|
||||||
AC_LANG_CONFTEST(
|
|
||||||
@@ -117,7 +149,9 @@ if test "$PERF_EVENT_H_EXISTS" = "yes"; then
|
|
||||||
rm -f test-for-PERF_GUEST*
|
|
||||||
else
|
|
||||||
HAVE_PERF_EVENTS='0'
|
|
||||||
+ AC_MSG_RESULT([No perf_events support available; falling back to legacy oprofile])
|
|
||||||
fi
|
|
||||||
+
|
|
||||||
AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf_events exists])
|
|
||||||
|
|
||||||
if test "$HAVE_PERF_EVENTS" = "1"; then
|
|
||||||
@@ -433,7 +467,7 @@ elif test "`getent passwd oprofile 2>/dev/null`" == "" || \
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
-if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_has_perf_events_support" = "yes"; then
|
|
||||||
+if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_may_have_perf_events_support" = "yes"; then
|
|
||||||
echo "Warning: perf_event.h not found. Either install the kernel headers package or"
|
|
||||||
echo "use the --with-kernel option if you want the non-root, single application"
|
|
||||||
echo "profiling support provided by operf."
|
|
||||||
diff --git a/utils/op_perf_events_checker.c b/utils/op_perf_events_checker.c
|
|
||||||
index 519cafa..74a410e 100644
|
|
||||||
--- a/utils/op_perf_events_checker.c
|
|
||||||
+++ b/utils/op_perf_events_checker.c
|
|
||||||
@@ -49,8 +49,10 @@ int main(int argc, char **argv)
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_PERF_EVENTS
|
|
||||||
- /* If perf_events syscall is not implemented, the syscall below will fail
|
|
||||||
- * with ENOSYS (38). If implemented, but the processor type on which this
|
|
||||||
+ /* Even if the perf_event_open syscall is implemented, the architecture may still
|
|
||||||
+ * not provide a full implementation of the perf_events subsystem, in which case,
|
|
||||||
+ * the syscall below will fail with ENOSYS (38). If the perf_events subsystem is
|
|
||||||
+ * implemented for the architecture, but the processor type on which this
|
|
||||||
* program is running is not supported by perf_events, the syscall returns
|
|
||||||
* ENOENT (2).
|
|
||||||
*/
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
Upstream-Status: Backport
|
|
||||||
|
|
||||||
From dbe24f5f0d98b1fe5517d2b137b4c59766e536ad Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Mon, 19 Nov 2012 15:16:37 -0600
|
|
||||||
Subject: [PATCH] Handle early perf_events kernel without
|
|
||||||
PERF_RECORD_MISC_GUEST* macros
|
|
||||||
|
|
||||||
In very early versions of perf_events kernel subsystem, the
|
|
||||||
PERF_RECORD_MISC_GUEST_KERNEL and PERF_RECORD_MISC_GUEST_USER
|
|
||||||
macros (in perf_event.h) were not yet defined. This patch adds
|
|
||||||
a configure check to determine when it's OK for source code to refer
|
|
||||||
to those macros.
|
|
||||||
|
|
||||||
This patch also does some minor cleanup of the configure script
|
|
||||||
help and warning messages relating to the --with-kernel option.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
---
|
|
||||||
configure.ac | 32 ++++++++++++++++++++++++++------
|
|
||||||
libperf_events/operf_utils.cpp | 2 ++
|
|
||||||
2 files changed, 28 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index 7449854..18d1169 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -60,12 +60,12 @@ test "$LD" || AC_ERROR(ld not found)
|
|
||||||
|
|
||||||
# --with-kernel for cross compilation
|
|
||||||
AC_ARG_WITH(kernel,
|
|
||||||
-[AS_HELP_STRING([--with-kernel=dir], [Path to kernel include directory (...include/linux/perf_event.h) to use.
|
|
||||||
+[AS_HELP_STRING([--with-kernel=dir], [Path to kernel include directory (e.g. /tmp/linux-xyz) to use.
|
|
||||||
If this option is not specified, configure will look for kernel header files in the usual installation location
|
|
||||||
-for a kernel-headers package -- /usr/include. Use this option in cross-compile enviroments
|
|
||||||
+for a kernel-headers package -- /usr. Use this option in cross-compile enviroments
|
|
||||||
or in situations where the host system does not support perf_events but you wish to build binaries
|
|
||||||
-for a target system that does support perf_events. Because of OProfile's use of syscalls, be sure that the
|
|
||||||
-kernel headers used match the architecture of the intended target system.])],
|
|
||||||
+for a target system that does support perf_events. Because of OProfile's use of syscalls,
|
|
||||||
+kernel headers used during build must match the architecture of the intended target system.])],
|
|
||||||
KERNELDIR=$withval)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -92,10 +92,29 @@ AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
|
|
||||||
AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test -n "$PERF_EVENT_H_EXISTS")
|
|
||||||
if test "$PERF_EVENT_H_EXISTS" = "yes"; then
|
|
||||||
HAVE_PERF_EVENTS='1'
|
|
||||||
+
|
|
||||||
if test "$KERNELDIR" != ""; then
|
|
||||||
PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
|
|
||||||
AC_SUBST(PERF_EVENT_FLAGS)
|
|
||||||
fi
|
|
||||||
+
|
|
||||||
+ AC_MSG_CHECKING([whether PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
|
|
||||||
+ rm -f test-for-PERF_GUEST
|
|
||||||
+ AC_LANG_CONFTEST(
|
|
||||||
+ [AC_LANG_PROGRAM([[#include <linux/perf_event.h>]],
|
|
||||||
+ [[unsigned int pr_guest_kern = PERF_RECORD_MISC_GUEST_KERNEL;
|
|
||||||
+ unsigned int pr_guest_user = PERF_RECORD_MISC_GUEST_USER;]])
|
|
||||||
+ ])
|
|
||||||
+ $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o test-for-PERF_GUEST > /dev/null 2>&1
|
|
||||||
+ if test -f test-for-PERF_GUEST; then
|
|
||||||
+ echo "yes"
|
|
||||||
+ HAVE_PERF_GUEST_MACROS='1'
|
|
||||||
+ else
|
|
||||||
+ echo "no"
|
|
||||||
+ HAVE_PERF_GUEST_MACROS='0'
|
|
||||||
+ fi
|
|
||||||
+ AC_DEFINE_UNQUOTED(HAVE_PERF_GUEST_MACROS, $HAVE_PERF_GUEST_MACROS, [PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
|
|
||||||
+ rm -f test-for-PERF_GUEST*
|
|
||||||
else
|
|
||||||
HAVE_PERF_EVENTS='0'
|
|
||||||
fi
|
|
||||||
@@ -416,7 +435,8 @@ elif test "`getent passwd oprofile 2>/dev/null`" == "" || \
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_has_perf_events_support" = "yes"; then
|
|
||||||
- echo "Warning: perf_event.h not found. Please install the kernel headers package if you"
|
|
||||||
- echo " want non-root support built into OProfile."
|
|
||||||
+ echo "Warning: perf_event.h not found. Either install the kernel headers package or"
|
|
||||||
+ echo "use the --with-kernel option if you want the non-root, single application"
|
|
||||||
+ echo "profiling support provided by operf."
|
|
||||||
fi
|
|
||||||
|
|
||||||
diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
|
|
||||||
index 06cd566..470cfba 100644
|
|
||||||
--- a/libperf_events/operf_utils.cpp
|
|
||||||
+++ b/libperf_events/operf_utils.cpp
|
|
||||||
@@ -732,12 +732,14 @@ static void __handle_sample_event(event_t * event, u64 sample_type)
|
|
||||||
case PERF_RECORD_MISC_HYPERVISOR:
|
|
||||||
domain = "hypervisor";
|
|
||||||
break;
|
|
||||||
+#if HAVE_PERF_GUEST_MACROS
|
|
||||||
case PERF_RECORD_MISC_GUEST_KERNEL:
|
|
||||||
domain = "guest OS";
|
|
||||||
break;
|
|
||||||
case PERF_RECORD_MISC_GUEST_USER:
|
|
||||||
domain = "guest user";
|
|
||||||
break;
|
|
||||||
+#endif
|
|
||||||
default:
|
|
||||||
domain = "unknown";
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
Upstream-Status: Backport
|
|
||||||
|
|
||||||
From fa889ea74b6b931e241a8cd57e90edc23cd7ab03 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William Cohen <wcohen@redhat.com>
|
|
||||||
Date: Mon, 15 Oct 2012 15:09:55 -0500
|
|
||||||
Subject: [PATCH] OProfile doesn't build for 32-bit ppc; the operf_utils.cpp
|
|
||||||
compile fails. Need to be able to build the 32-bit ppc
|
|
||||||
version of oprofile to provide the 32-bit ppc java support
|
|
||||||
libraries. The configure only handles the case of ppc64
|
|
||||||
with perf support.
|
|
||||||
|
|
||||||
Signed-off-by: William Cohen <wcohen@redhat.com>
|
|
||||||
---
|
|
||||||
configure.ac | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index b739133..7449854 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -104,7 +104,7 @@ AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf
|
|
||||||
if test "$HAVE_PERF_EVENTS" = "1"; then
|
|
||||||
PFM_LIB=
|
|
||||||
arch="`uname -m`"
|
|
||||||
- if test "$arch" = "ppc64"; then
|
|
||||||
+ if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
|
|
||||||
AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])])
|
|
||||||
AC_CHECK_LIB(pfm,pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', [
|
|
||||||
AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1',
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
Upstream-Status: Backport
|
||||||
|
|
||||||
|
From 63b5692aace5ff6022f892822b4bfdc51ed25bfb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alan Modra <amodra@gmail.com>
|
||||||
|
Date: Fri, 2 May 2014 07:54:08 -0500
|
||||||
|
Subject: [PATCH] Tidy powerpc64 bfd target check
|
||||||
|
|
||||||
|
Testing for a bfd_target vector might (will!) break. See
|
||||||
|
https://sourceware.org/ml/binutils/2014-04/msg00283.html
|
||||||
|
|
||||||
|
It's safer to ask BFD for the target name. I left the direct target
|
||||||
|
vector checks in configure tests, and updated them, even though the
|
||||||
|
target vector is no longer used in oprofile code, because a run-time
|
||||||
|
configure test for powerpc64 support in bfd:
|
||||||
|
#include <bfd.h>
|
||||||
|
int main(void)
|
||||||
|
{ return !bfd_find_target("elf64-powerpc", (void *)0); }
|
||||||
|
unfortunately isn't possible when cross-compiling.
|
||||||
|
|
||||||
|
The bfd_target vector tests could be omitted if we aren't bothered by
|
||||||
|
the small runtime overhead of a strncmp on targets other than
|
||||||
|
powerpc64.
|
||||||
|
|
||||||
|
* libutil++/bfd_support.cpp (get_synth_symbols): Don't check for
|
||||||
|
ppc64 target vector, use bfd_get_target to return the target
|
||||||
|
name instead.
|
||||||
|
* m4/binutils.m4: Modernize bfd_get_synthetic_symtab checks to
|
||||||
|
use AC_LINK_IFELSE. Check for either powerpc_elf64_vec or
|
||||||
|
bfd_elf64_powerpc_vec.
|
||||||
|
|
||||||
|
Signed-off-by: Alan Modra <amodra@gmail.com>
|
||||||
|
---
|
||||||
|
libutil++/bfd_support.cpp | 10 +++++++--
|
||||||
|
m4/binutils.m4 | 50 ++++++++++++++++++++++-----------------------
|
||||||
|
2 files changed, 33 insertions(+), 27 deletions(-)
|
||||||
|
|
||||||
|
Index: oprofile-0.9.9/libutil++/bfd_support.cpp
|
||||||
|
===================================================================
|
||||||
|
--- oprofile-0.9.9.orig/libutil++/bfd_support.cpp 2013-07-29 08:55:06.000000000 -0700
|
||||||
|
+++ oprofile-0.9.9/libutil++/bfd_support.cpp 2014-05-02 09:12:05.761146347 -0700
|
||||||
|
@@ -633,10 +633,16 @@
|
||||||
|
|
||||||
|
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);
|
||||||
|
+ const char* targname = bfd_get_target(abfd);
|
||||||
|
+ // Match elf64-powerpc and elf64-powerpc-freebsd, but not
|
||||||
|
+ // elf64-powerpcle. elf64-powerpcle is a different ABI without
|
||||||
|
+ // function descriptors, so we don't need the synthetic
|
||||||
|
+ // symbols to have function code marked by a symbol.
|
||||||
|
+ bool is_elf64_powerpc_target = (!strncmp(targname, "elf64-powerpc", 13)
|
||||||
|
+ && (targname[13] == 0
|
||||||
|
+ || targname[13] == '-'));
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
if (!is_elf64_powerpc_target)
|
||||||
|
return false;
|
||||||
|
Index: oprofile-0.9.9/m4/binutils.m4
|
||||||
|
===================================================================
|
||||||
|
--- oprofile-0.9.9.orig/m4/binutils.m4 2013-07-29 08:55:07.000000000 -0700
|
||||||
|
+++ oprofile-0.9.9/m4/binutils.m4 2014-05-02 09:07:32.471148147 -0700
|
||||||
|
@@ -22,32 +22,32 @@
|
||||||
|
|
||||||
|
AC_LANG_PUSH(C)
|
||||||
|
# Determine if bfd_get_synthetic_symtab macro is available
|
||||||
|
-OS="`uname`"
|
||||||
|
-if test "$OS" = "Linux"; then
|
||||||
|
- AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
|
||||||
|
- rm -f test-for-synth
|
||||||
|
- AC_LANG_CONFTEST(
|
||||||
|
- [AC_LANG_PROGRAM([[#include <bfd.h>]],
|
||||||
|
- [[asymbol * synthsyms; bfd * ibfd = 0;
|
||||||
|
- long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
|
||||||
|
- extern const bfd_target bfd_elf64_powerpc_vec;
|
||||||
|
- extern const bfd_target bfd_elf64_powerpcle_vec;
|
||||||
|
- char * ppc_name = bfd_elf64_powerpc_vec.name;
|
||||||
|
- char * ppcle_name = bfd_elf64_powerpcle_vec.name;
|
||||||
|
- printf("%s %s\n", ppc_name, ppcle_name);]])
|
||||||
|
- ])
|
||||||
|
- $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS -o test-for-synth > /dev/null 2>&1
|
||||||
|
- if test -f test-for-synth; then
|
||||||
|
- echo "yes"
|
||||||
|
- SYNTHESIZE_SYMBOLS='1'
|
||||||
|
- else
|
||||||
|
- echo "no"
|
||||||
|
- SYNTHESIZE_SYMBOLS='0'
|
||||||
|
- fi
|
||||||
|
- AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
|
||||||
|
- rm -f test-for-synth*
|
||||||
|
+AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
|
||||||
|
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
|
||||||
|
+ ]],
|
||||||
|
+ [[asymbol * synthsyms; bfd * ibfd = 0;
|
||||||
|
+ long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
|
||||||
|
+ extern const bfd_target powerpc_elf64_vec;
|
||||||
|
+ char *ppc_name = powerpc_elf64_vec.name;
|
||||||
|
+ printf("%s\n", ppc_name);
|
||||||
|
+ ]])],
|
||||||
|
+ [AC_MSG_RESULT([yes])
|
||||||
|
+ SYNTHESIZE_SYMBOLS=2],
|
||||||
|
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
|
||||||
|
+ ]],
|
||||||
|
+ [[asymbol * synthsyms; bfd * ibfd = 0;
|
||||||
|
+ long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
|
||||||
|
+ extern const bfd_target bfd_elf64_powerpc_vec;
|
||||||
|
+ char *ppc_name = bfd_elf64_powerpc_vec.name;
|
||||||
|
+ printf("%s\n", ppc_name);
|
||||||
|
+ ]])],
|
||||||
|
+ [AC_MSG_RESULT([yes])
|
||||||
|
+ SYNTHESIZE_SYMBOLS=1],
|
||||||
|
+ [AC_MSG_RESULT([no])
|
||||||
|
+ SYNTHESIZE_SYMBOLS=0])
|
||||||
|
+ ])
|
||||||
|
+AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
|
||||||
|
|
||||||
|
-fi
|
||||||
|
AC_LANG_POP(C)
|
||||||
|
]
|
||||||
|
)
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
Upstream-Status: Accepted
|
|
||||||
|
|
||||||
From 735d9eb0322b34b3d26302a1dac173100d718d35 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
Date: Thu, 10 Jan 2013 14:24:26 -0600
|
|
||||||
Subject: [PATCH] ophelp lists events: Fix doc URL for ppc64 arch
|
|
||||||
|
|
||||||
When ophelp is used to list available events, it displays
|
|
||||||
some help text before the event list to direct the user
|
|
||||||
where to find more info. For the ppc64 architecture, a
|
|
||||||
stale URL was listed. This patch fixes that URL.
|
|
||||||
|
|
||||||
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
||||||
---
|
|
||||||
utils/ophelp.c | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/utils/ophelp.c b/utils/ophelp.c
|
|
||||||
index f48697b..827f2d0 100644
|
|
||||||
--- a/utils/ophelp.c
|
|
||||||
+++ b/utils/ophelp.c
|
|
||||||
@@ -652,8 +652,9 @@ int main(int argc, char const * argv[])
|
|
||||||
case CPU_PPC64_POWER7:
|
|
||||||
case CPU_PPC64_IBM_COMPAT_V1:
|
|
||||||
event_doc =
|
|
||||||
- "Obtain PowerPC64 processor documentation at:\n"
|
|
||||||
- "http://www-306.ibm.com/chips/techlib/techlib.nsf/productfamilies/PowerPC\n";
|
|
||||||
+ "Documentation for IBM POWER7 can be obtained at:\n"
|
|
||||||
+ "http://www.power.org/events/Power7/\n"
|
|
||||||
+ "No public performance monitoring doc available for older processors.\n";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CPU_PPC64_CELL:
|
|
||||||
--
|
|
||||||
1.7.9.7
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
disable portions which use query_module on 2.6 kernel this is not available
|
|
||||||
in OE we dont support 2.4 anyway
|
|
||||||
|
|
||||||
|
|
||||||
Upstream-Status: Pending
|
|
||||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
||||||
|
|
||||||
Index: oprofile-0.9.6/daemon/liblegacy/opd_kernel.c
|
|
||||||
===================================================================
|
|
||||||
--- oprofile-0.9.6.orig/daemon/liblegacy/opd_kernel.c 2009-11-24 07:25:17.000000000 -0800
|
|
||||||
+++ oprofile-0.9.6/daemon/liblegacy/opd_kernel.c 2011-07-18 10:08:39.863798825 -0700
|
|
||||||
@@ -270,6 +270,9 @@
|
|
||||||
*/
|
|
||||||
static void opd_drop_module_sample(unsigned long eip)
|
|
||||||
{
|
|
||||||
+ verbprintf(vmodule, "query_module not available on linux-2.6: %s\n", strerror(EPERM));
|
|
||||||
+
|
|
||||||
+#if 0
|
|
||||||
char * module_names;
|
|
||||||
char * name;
|
|
||||||
size_t size = 1024;
|
|
||||||
@@ -307,6 +310,7 @@
|
|
||||||
|
|
||||||
if (module_names)
|
|
||||||
free(module_names);
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
require oprofile.inc
|
|
||||||
|
|
||||||
PR = "${INC_PR}.3"
|
|
||||||
|
|
||||||
DEPENDS += "virtual/kernel"
|
|
||||||
DEPENDS_append_powerpc64 = " libpfm4"
|
|
||||||
|
|
||||||
SRC_URI += "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
|
|
||||||
file://0001-Add-rmb-definition-for-AArch64-architecture.patch \
|
|
||||||
file://0001-OProfile-doesn-t-build-for-32-bit-ppc-the-operf_util.patch \
|
|
||||||
file://0001-Handle-early-perf_events-kernel-without-PERF_RECORD_.patch \
|
|
||||||
file://0001-Fix-up-configure-to-handle-architectures-that-do-not.patch \
|
|
||||||
file://0001-Change-configure-to-look-for-libpfm4-function-first-.patch \
|
|
||||||
file://0001-ophelp-lists-events-Fix-doc-URL-for-ppc64-arch.patch \
|
|
||||||
file://0001-Allow-ppc64-events-to-be-specified-with-or-without-_.patch \
|
|
||||||
file://0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch"
|
|
||||||
|
|
||||||
SRC_URI[md5sum] = "6d127023af1dd1cf24e15411229f3cc8"
|
|
||||||
SRC_URI[sha256sum] = "ab45900fa1a23e5d5badf3c0a55f26c17efe6e184efcf00b371433751fa761bc"
|
|
||||||
|
|
||||||
S = "${WORKDIR}/oprofile-${PV}"
|
|
||||||
|
|
||||||
15
meta/recipes-kernel/oprofile/oprofile_0.9.9.bb
Normal file
15
meta/recipes-kernel/oprofile/oprofile_0.9.9.bb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require oprofile.inc
|
||||||
|
|
||||||
|
DEPENDS += "virtual/kernel"
|
||||||
|
DEPENDS_append_powerpc64 = " libpfm4"
|
||||||
|
|
||||||
|
SRC_URI += "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
|
||||||
|
file://0001-Add-rmb-definition-for-AArch64-architecture.patch \
|
||||||
|
file://0001-Tidy-powerpc64-bfd-target-check.patch \
|
||||||
|
"
|
||||||
|
SRC_URI[md5sum] = "00aec1287da2dfffda17a9b1c0a01868"
|
||||||
|
SRC_URI[sha256sum] = "1e523400daaba7b8d0d15269e977a08b40edfea53970774b69ae130e25117597"
|
||||||
|
|
||||||
|
|
||||||
|
S = "${WORKDIR}/oprofile-${PV}"
|
||||||
|
|
||||||
Reference in New Issue
Block a user