Patchwork powerpc: Fix setting of oprofile cpu type

login
register
mail settings
Submitter Benjamin Herrenschmidt
Date April 30, 2009, 5:39 a.m.
Message ID <20090430053943.93CF7DDED6@ozlabs.org>
Download mbox | patch
Permalink /patch/26663/
State Accepted
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Benjamin Herrenschmidt - April 30, 2009, 5:39 a.m.
commit 2657dd4e301d4841ed67a4fac7d145ad8f3e1b28 introduced a
bug where we would now always override the "real" oprofile CPU
type with the "compatible" one provided by a pseudo-PVR in the
device-tree which is incorrect and breaks oprofile on all current
configs since the "compatible" ones aren't yet recognized.

This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

Bug hit 2.6.29 too. I'll send this to Linus and Greg tomorrow unless
somebody thinks it's wrong. I've tested on POWER6 and verified the
bug and the fix.

 arch/powerpc/kernel/cputable.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

--- linux-work.orig/arch/powerpc/kernel/cputable.c	2009-04-30 14:22:30.000000000 +1000
+++ linux-work/arch/powerpc/kernel/cputable.c	2009-04-30 14:22:41.000000000 +1000
@@ -1833,8 +1833,8 @@  static void __init setup_cpu_spec(unsign
 		 * and, in that case, keep the current value for
 		 * oprofile_cpu_type.
 		 */
-		if (old.oprofile_cpu_type == NULL)
-			t->oprofile_cpu_type = s->oprofile_cpu_type;
+		if (old.oprofile_cpu_type != NULL)
+			t->oprofile_cpu_type = old.oprofile_cpu_type;
 	}
 
 	*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;