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