Blame SOURCES/oprofile-ppc64-equivalent.patch

c532ac
commit 4f5a0d9c4419f3b88586d665272eb35f270a0551
c532ac
Author: Maynard Johnson <maynardj@us.ibm.com>
c532ac
Date:   Tue Dec 17 16:04:33 2013 -0600
c532ac
c532ac
    Allow all native events for IBM POWER8 in POWER7 compat mode
c532ac
    
c532ac
    Certain older Linux distributions will support the new IBM POWER8
c532ac
    processor, but only in a limited mode, since much of the new
c532ac
    kernel code needed to fully support the POWER8 was not backported
c532ac
    to these older distros.  This limited mode is referred to as
c532ac
    "POWER7 compat mode" since the kernel can support only the features
c532ac
    that were also available on that earlier IBM processor.
c532ac
    
c532ac
    Changes I originally made to support POWER8 assumed that there
c532ac
    would not be full POWER8 performance monitor unit capabilities when
c532ac
    in POWER7 compat mode, and thus, the current oprofile code supports
c532ac
    only a limited subset of POWER8 events (i.e., events which were also
c532ac
    available on the POWER7). However, I've recently been made aware
c532ac
    that these older distros actually do have complete backports of the
c532ac
    POWER8 perf_events kernel subsystem code, making them fully aware of
c532ac
    all POWER8 events. This patch allows operf and ocount to use all
c532ac
    of the POWER8 events, regardless of what mode or distribution we
c532ac
    are running on.
c532ac
    
c532ac
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
c532ac
c532ac
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
c532ac
index 4bb34b7..cd75ad4 100644
c532ac
--- a/libop/op_cpu_type.c
c532ac
+++ b/libop/op_cpu_type.c
c532ac
@@ -290,7 +290,16 @@ static op_cpu _try_ppc64_arch_generic_cpu(void)
c532ac
 			}
c532ac
 		}
c532ac
 		if (!platforms_are_equivalent) {
c532ac
-			if (strcmp(platform, "power7") == 0)
c532ac
+			//  FIXME
c532ac
+			/* For POWER8 running in POWER7 compat mode (RHEL 6.5 and SLES 11 SP4),
c532ac
+			 * the kernel will have enough POWER8-specific PMU code so we can utilize
c532ac
+			 * all of the POWER8 events. In general, this is not necessarily the case
c532ac
+			 * when running in compat mode.  This code needs to be inspected for every
c532ac
+			 * new IBM Power processor released, but for now, we'll assume that for the
c532ac
+			 * next processor model (assuming there will be something like a POWER9?),
c532ac
+			 * we should use just the architected events when running POWER8 compat mode.
c532ac
+			 */
c532ac
+			if (strcmp(platform, "power8") == 0)
c532ac
 				cpu_type = CPU_PPC64_ARCH_V1;
c532ac
 		}
c532ac
 	}
c532ac
commit 88ed74bade0096042d643a6d7e68c2cbc4b6e34d
c532ac
Author: Maynard Johnson <maynardj@us.ibm.com>
c532ac
Date:   Thu Jan 9 15:07:21 2014 -0600
c532ac
c532ac
    Fix "Unable to open cpu_type file for reading" for IBM POWER7+
c532ac
    
c532ac
    Using operf to do profiling on an IBM POWER7+ may result in
c532ac
    the following error message:
c532ac
    
c532ac
    	Unable to open cpu_type file for reading
c532ac
    
c532ac
    This patch fixes the problem.  There is also a simple workaround of
c532ac
    running 'opcontrol --init'.
c532ac
    
c532ac
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
c532ac
c532ac
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
c532ac
index cd75ad4..7d5262c 100644
c532ac
--- a/libop/op_cpu_type.c
c532ac
+++ b/libop/op_cpu_type.c
c532ac
@@ -326,6 +326,8 @@ static op_cpu _get_ppc64_cpu_type(void)
c532ac
 	for (i = 0; i < (int)len ; i++)
c532ac
 		cpu_name_lowercase[i] = tolower(cpu_name[i]);
c532ac
 
c532ac
+	if (strncmp(cpu_name_lowercase, "power7+", 7) == 0)
c532ac
+		cpu_name_lowercase[6] = '\0';
c532ac
 	cpu_type_str[0] = '\0';
c532ac
 	strcat(cpu_type_str, "ppc64/");
c532ac
 	strncat(cpu_type_str, cpu_name_lowercase, len);
c532ac
commit 65176cb1af0fb1f6c7d3ddba4ab5f5f23c5f7c62
c532ac
Author: Maynard Johnson <maynardj@us.ibm.com>
c532ac
Date:   Tue Jan 21 14:43:02 2014 -0600
c532ac
c532ac
    Fix regression in IBM POWER8 running in POWER7 compat mode
c532ac
    
c532ac
    A commit made on Dec 17, 2013 ("Allow all native events for IBM POWER8
c532ac
    in POWER7 compat mode) broke support for POWER8 in POWER7 compat mode.
c532ac
    Instead, oprofile attempts to treat it as a normal POWER7 processor,
c532ac
    which is not correct.  A user reported the following error when
c532ac
    running operf with the default CYCLES event:
c532ac
    
c532ac
       terminate called after throwing an instance of 'std::runtime_error'
c532ac
         what():  libpfm cannot find event code for CYCLES; cannot continue
c532ac
       Aborted
c532ac
    
c532ac
    This patch fixes this problem.
c532ac
    
c532ac
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
c532ac
c532ac
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
c532ac
index a3ad804..2907f36 100644
c532ac
--- a/libop/op_cpu_type.c
c532ac
+++ b/libop/op_cpu_type.c
c532ac
@@ -300,7 +300,9 @@ static op_cpu _try_ppc64_arch_generic_cpu(void)
c532ac
 			 * next processor model (assuming there will be something like a POWER9?),
c532ac
 			 * we should use just the architected events when running POWER8 compat mode.
c532ac
 			 */
c532ac
-			if (strcmp(platform, "power8") == 0)
c532ac
+			if ((strcmp(platform, "power7") == 0) && (strcmp(base_platform, "power8") == 0))
c532ac
+				cpu_type = CPU_PPC64_POWER8;
c532ac
+			else
c532ac
 				cpu_type = CPU_PPC64_ARCH_V1;
c532ac
 		}
c532ac
 	}
c532ac
commit 7243fa4ed8a25c6e59225a863fd263ce70989087
c532ac
Author: Maynard Johnson <maynardj@us.ibm.com>
c532ac
Date:   Tue Feb 4 08:27:10 2014 -0600
c532ac
c532ac
    Make cpu type POWER8E equivalent to POWER8
c532ac
    
c532ac
    Recent mainline kernel changes resulted in a cpu type of
c532ac
    "POWER8E" being displayed in /proc/cpuinfo for certain revisions
c532ac
    of the IBM POWER8 processor model. But for profiling and
c532ac
    counting of native events, we can ignore the differences between
c532ac
    POWER8 and POWER8E.  This patch addresses that issue.
c532ac
    
c532ac
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
c532ac
c532ac
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
c532ac
index 2907f36..1ae2913 100644
c532ac
--- a/libop/op_cpu_type.c
c532ac
+++ b/libop/op_cpu_type.c
c532ac
@@ -331,6 +331,9 @@ static op_cpu _get_ppc64_cpu_type(void)
c532ac
 
c532ac
 	if (strncmp(cpu_name_lowercase, "power7+", 7) == 0)
c532ac
 		cpu_name_lowercase[6] = '\0';
c532ac
+	if (strncmp(cpu_name_lowercase, "power8e", 7) == 0)
c532ac
+		cpu_name_lowercase[6] = '\0';
c532ac
+
c532ac
 	cpu_type_str[0] = '\0';
c532ac
 	strcat(cpu_type_str, "ppc64/");
c532ac
 	strncat(cpu_type_str, cpu_name_lowercase, len);