[PATCH] PURR data on iSeries Linux

jscheel at magnaspeed.net jscheel at magnaspeed.net
Wed Nov 10 07:14:50 EST 2004


With the addtion of the PURR for Power5 systems,
applications have begun being built to utilize this value.
 One application in particular is looking for equivalent
information for Linux running on legacy iSeries systems.

The data necessary to report this data is available from
the hypervisor.  It simply has to be retrieved and reported
by /proc/ppc64/lparcfg interface on iSeries.

For those interested in testing this patch, retrieve the
purr data at two defined intervals and calculate the
difference.  Then, multiply the delta by 100, divide by
the number of seconds in your interval, divide by the
"timebase" value from "/proc/cpuinfo", and divide again by
the number of processors. This will provide the physical
cpu utilization ranging from 1 to 100.

For shared processor configurations, this will depend on
workload with the actual value somewhere between 1 and 100.
 For dedicated processors, this number should always be
100 as the operating system gets all of the physical
processor capacity.

This patch to arch/ppc64/lparcfg.c reports this data.  It
has been tested on legacy iSeries systems and is not
dependent on the Power5 PURR implementation.
Please consider it for inclusion in the arch/ppc64 tree.
 Additionally, I would appreciate any and all comments.

Thanks,
-Jeff

P.S. Sorry I had to use my personal email address but I
can't get the patch out without losing tabs.  I think this
works.  :-)

Signed-off-by: Jeff Scheel <scheel at vnet.ibm.com>

---
linuxppc-2.6.9_rc1.orig/arch/ppc64/kernel/lparcfg.c	2004-11-09
07:03:43.354383000 -0600
+++
linuxppc-2.6.9_rc1/arch/ppc64/kernel/lparcfg.c	2004-11-09
10:40:36.375934020 -0600
@@ -34,7 +34,7 @@
 #include <asm/rtas.h>
 #include <asm/system.h>
 
-#define MODULE_VERS "1.4"
+#define MODULE_VERS "1.5"
 #define MODULE_NAME "lparcfg"
 
 /* #define LPARCFG_DEBUG */
@@ -70,6 +70,30 @@
 
 #ifdef CONFIG_PPC_ISERIES
 
+static unsigned long get_purr(void);
+
+/*
+ * For iSeries legacy systems, the PPA purr function is
available from the
+ * xEmulatedTimeBase field in the paca.
+ */
+static unsigned long get_purr()
+{
+	unsigned long sum_purr=0;
+	int cpu;
+	struct paca_struct *lpaca;
+
+	for_each_online_cpu(cpu) {
+		lpaca = paca + cpu;
+		sum_purr += lpaca->xLpPaca.xEmulatedTimeBase;
+
+#ifdef PURR_DEBUG
+		printk(KERN_INFO "get_purr for cpu (%x) has value (%lx)
\n",
+			cpu,lpaca->xLpPaca.xEmulatedTimeBase);
+#endif
+	}
+	return sum_purr;
+}
+
 #define lparcfg_write NULL
 
 /* 
@@ -81,6 +105,7 @@
 	int shared, entitled_capacity, max_entitled_capacity;
 	int processors, max_processors;
 	struct paca_struct *lpaca = get_paca();
+	unsigned long purr = get_purr();
 
 	shared = (int)(lpaca->lppaca_ptr->xSharedProc);
 	seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
@@ -131,6 +156,7 @@
 		seq_printf(m, "pool_capacity=%d\n",
 			   (int)(HvLpConfig_getNumProcsInSharedPool(pool_id) *
 				 100));
+		seq_printf(m, "purr=%ld\n", purr);
 	}
 
 	seq_printf(m, "shared_processor_mode=%d\n", shared);




More information about the Linuxppc64-dev mailing list