diff --git a/SOURCES/oprofile-power9_recog.patch b/SOURCES/oprofile-power9_recog.patch new file mode 100644 index 0000000..b41485a --- /dev/null +++ b/SOURCES/oprofile-power9_recog.patch @@ -0,0 +1,45 @@ +commit c474cd3ddfcb2fe68f38745675f4c4d9ef79dfc5 +Author: Carl Love +Date: Tue Mar 27 13:07:37 2018 -0700 + + PowerPC: Remove trailing comma in cpu_name. + + Will: + + I redid the patch as follows per your suggestions. I was able to get + on to a system where the issue occurs and test the patch. The patch + seems to work fine. + + Carl Love + + ----------------------------------------------------------------------- + + The processor type for some Power 9 systems had a comma after POWER9. + Remove the comma before returning the string for the CPU. + +diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c +index feea9487..d2babd18 100644 +--- a/libop/op_cpu_type.c ++++ b/libop/op_cpu_type.c +@@ -154,17 +154,17 @@ static char * _get_cpuinfo_cpu_type_line(char * buf, int len, const char * prefi + /* if token param 0 then read the whole line else + * first token only. */ + if (token == 0) { +- /* Trim trailing whitespace */ ++ /* Trim trailing whitespace and commas */ + end = buf + strlen(buf) - 1; +- while (isspace(*end)) ++ while (isspace(*end) || *end == ',') + --end; + *(++end) = '\0'; + break; + } else { + /* Scan ahead to the end of the token */ +- while (*buf && !isspace(*buf)) ++ while (*buf && !(isspace(*buf) || *buf == ',')) + ++buf; +- /* Trim trailing whitespace */ ++ /* Trim trailing whitespace and commas */ + *buf = '\0'; + break; + } diff --git a/SOURCES/oprofile-trans_init.patch b/SOURCES/oprofile-trans_init.patch new file mode 100644 index 0000000..0b85c24 --- /dev/null +++ b/SOURCES/oprofile-trans_init.patch @@ -0,0 +1,43 @@ +From e044a7def7f6aa61d3bb2a75a1ef597a4724441b Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Mon, 18 Jun 2018 16:47:00 -0400 +Subject: [PATCH] Initialize the trans structure fields to values unused by + perf samples + +On newer 4.14 kernel operf was crashing because the kernel commit +1d953111b648e ("perf/core: Don't report zero PIDs for exiting tasks") +made perf samples have TID/PID of -1 for exiting processes. OProfile +used this same value internally to indicate the that field had not +been initialized. As a result operf would incorrectly attempt to run +some bookkeeping code due to an invalid match. The initialization of +the trans tgid field is now changed to a value that is unsed by the +perf samples to ensure that these invalid matches do not occur. + +Signed-off-by: William Cohen +--- + libperf_events/operf_utils.cpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp +index 58c50a6..057692d 100644 +--- a/libperf_events/operf_utils.cpp ++++ b/libperf_events/operf_utils.cpp +@@ -73,7 +73,14 @@ static inline void update_trans_last(struct operf_transient * trans) + + static inline void clear_trans(struct operf_transient * trans) + { +- trans->tgid = ~0U; ++ /* ~0U (-1) could be used by the kernel perf samples ++ * for the TID/PID of exiting processes. To avoid ++ * confusing the oprofile logic use ~1U as the ++ * initialization value for tgid field to avoid ++ * possibly matching the TID/PID values for exiting ++ * processes. ++ */ ++ trans->tgid = ~1U; + trans->cur_procinfo = NULL; + } + +-- +1.8.3.1 + diff --git a/SPECS/oprofile.spec b/SPECS/oprofile.spec index d9261bc..465f51d 100644 --- a/SPECS/oprofile.spec +++ b/SPECS/oprofile.spec @@ -1,7 +1,7 @@ Summary: System wide profiler Name: oprofile Version: 0.9.9 -Release: 25%{?dist} +Release: 25%{?dist}.1 License: GPLv2+ and LGPLv2+ Group: Development/System # @@ -42,6 +42,8 @@ Patch1010: oprofile-rhbz1385007.patch Patch1011: oprofile-rhbz1426426.patch Patch2000: oprofile-power9.patch Patch2001: oprofile-knl.patch +Patch2002: oprofile-power9_recog.patch +Patch2003: oprofile-trans_init.patch URL: http://oprofile.sf.net @@ -136,6 +138,8 @@ agent library. %patch1011 -p1 -b .rhbz1426426 %patch2000 -p1 -b .power9 %patch2001 -p1 -b .knl +%patch2002 -p1 -b .recog +%patch2003 -p1 -b .init ./autogen.sh @@ -222,6 +226,9 @@ exit 0 %{_sysconfdir}/ld.so.conf.d/* %changelog +* Tue Jun 19 2018 William Cohen - 0.9.9-25el7.1 +- rhbz1593131 + * Mon Sep 25 2017 William Cohen - 0.9.9-25 - Add Intel Xeon Phi support. rhbz1465354