Blame SOURCES/oprofile-ppc64-equivalent.patch

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