linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Cyrix MII cpuid returns stale %ecx
@ 2004-12-01  5:07 Zwane Mwaikambo
  2004-12-03  9:08 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Zwane Mwaikambo @ 2004-12-01  5:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel, Andi Kleen, linux, Dave Jones

This patch is for the following bug, thanks to Ondrej Zary for 
reporting, testing and submitting a patch.

http://bugzilla.kernel.org/show_bug.cgi?id=3767

It appears that the Cyrix MII won't touch %ecx at all resulting in stale 
data being returned as extended attributes, so clear ecx before issuing 
the cpuid. I have also made the capability print code display all the 
capability words for easier debugging in future.

Signed-off-by: Zwane Mwaikambo <zwane@linuxpower.ca>

Index: linux-2.6.10-rc2-mm4/include/asm-i386/processor.h
===================================================================
RCS file: /home/cvsroot/linux-2.6.10-rc2-mm4/include/asm-i386/processor.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 processor.h
--- linux-2.6.10-rc2-mm4/include/asm-i386/processor.h	30 Nov 2004 18:52:25 -0000	1.1.1.1
+++ linux-2.6.10-rc2-mm4/include/asm-i386/processor.h	1 Dec 2004 04:25:11 -0000
@@ -126,6 +126,8 @@ extern void dodgy_tsc(void);
 
 /*
  * Generic CPUID function
+ * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
+ * resulting in stale register contents being returned.
  */
 static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
 {
@@ -134,7 +136,7 @@ static inline void cpuid(int op, int *ea
 		  "=b" (*ebx),
 		  "=c" (*ecx),
 		  "=d" (*edx)
-		: "0" (op));
+		: "0" (op), "c"(0));
 }
 
 /*
Index: linux-2.6.10-rc2-mm4/arch/i386/kernel/cpu/common.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.10-rc2-mm4/arch/i386/kernel/cpu/common.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 common.c
--- linux-2.6.10-rc2-mm4/arch/i386/kernel/cpu/common.c	30 Nov 2004 18:52:19 -0000	1.1.1.1
+++ linux-2.6.10-rc2-mm4/arch/i386/kernel/cpu/common.c	1 Dec 2004 04:18:46 -0000
@@ -334,21 +334,19 @@ void __init identify_cpu(struct cpuinfo_
 
 	generic_identify(c);
 
-	printk(KERN_DEBUG "CPU: After generic identify, caps: %08lx %08lx %08lx %08lx\n",
-		c->x86_capability[0],
-		c->x86_capability[1],
-		c->x86_capability[2],
-		c->x86_capability[3]);
+	printk(KERN_DEBUG "CPU: After generic identify, caps:");
+	for (i = 0; i < NCAPINTS; i++)
+		printk(" %08lx", c->x86_capability[i]);
+	printk("\n");
 
 	if (this_cpu->c_identify) {
 		this_cpu->c_identify(c);
 
-	printk(KERN_DEBUG "CPU: After vendor identify, caps:  %08lx %08lx %08lx %08lx\n",
-		c->x86_capability[0],
-		c->x86_capability[1],
-		c->x86_capability[2],
-		c->x86_capability[3]);
-}
+		printk(KERN_DEBUG "CPU: After vendor identify, caps:");
+		for (i = 0; i < NCAPINTS; i++)
+			printk(" %08lx", c->x86_capability[i]);
+		printk("\n");
+	}
 
 	/*
 	 * Vendor-specific initialization.  In this section we
@@ -398,11 +396,10 @@ void __init identify_cpu(struct cpuinfo_
 
 	/* Now the feature flags better reflect actual CPU features! */
 
-	printk(KERN_DEBUG "CPU: After all inits, caps:        %08lx %08lx %08lx %08lx\n",
-	       c->x86_capability[0],
-	       c->x86_capability[1],
-	       c->x86_capability[2],
-	       c->x86_capability[3]);
+	printk(KERN_DEBUG "CPU: After all inits, caps:");
+	for (i = 0; i < NCAPINTS; i++)
+		printk(" %08lx", c->x86_capability[i]);
+	printk("\n");
 
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cyrix MII cpuid returns stale %ecx
  2004-12-01  5:07 [PATCH] Cyrix MII cpuid returns stale %ecx Zwane Mwaikambo
@ 2004-12-03  9:08 ` Andi Kleen
  2004-12-03 16:57   ` Zwane Mwaikambo
  2004-12-03 22:18   ` H. Peter Anvin
  0 siblings, 2 replies; 4+ messages in thread
From: Andi Kleen @ 2004-12-03  9:08 UTC (permalink / raw)
  To: Zwane Mwaikambo
  Cc: Andrew Morton, Linux Kernel, Andi Kleen, linux, Dave Jones

On Tue, Nov 30, 2004 at 10:07:55PM -0700, Zwane Mwaikambo wrote:
> This patch is for the following bug, thanks to Ondrej Zary for 
> reporting, testing and submitting a patch.
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=3767
> 
> It appears that the Cyrix MII won't touch %ecx at all resulting in stale 
> data being returned as extended attributes, so clear ecx before issuing 
> the cpuid. I have also made the capability print code display all the 
> capability words for easier debugging in future.

Can you please change cpuid() on x86-64 too?

I think it would be also better to not printk the capabilities
at all or only with a special kernel option. Normally they are
not needed, but they clutter up the boot  log.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cyrix MII cpuid returns stale %ecx
  2004-12-03  9:08 ` Andi Kleen
@ 2004-12-03 16:57   ` Zwane Mwaikambo
  2004-12-03 22:18   ` H. Peter Anvin
  1 sibling, 0 replies; 4+ messages in thread
From: Zwane Mwaikambo @ 2004-12-03 16:57 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, Linux Kernel, linux, Dave Jones

On Fri, 3 Dec 2004, Andi Kleen wrote:

> On Tue, Nov 30, 2004 at 10:07:55PM -0700, Zwane Mwaikambo wrote:
> > This patch is for the following bug, thanks to Ondrej Zary for 
> > reporting, testing and submitting a patch.
> > 
> > http://bugzilla.kernel.org/show_bug.cgi?id=3767
> > 
> > It appears that the Cyrix MII won't touch %ecx at all resulting in stale 
> > data being returned as extended attributes, so clear ecx before issuing 
> > the cpuid. I have also made the capability print code display all the 
> > capability words for easier debugging in future.
> 
> Can you please change cpuid() on x86-64 too?
> 
> I think it would be also better to not printk the capabilities
> at all or only with a special kernel option. Normally they are
> not needed, but they clutter up the boot  log.

Isn't the KERN_DEBUG prefix sufficient?

Thanks,
	Zwane


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cyrix MII cpuid returns stale %ecx
  2004-12-03  9:08 ` Andi Kleen
  2004-12-03 16:57   ` Zwane Mwaikambo
@ 2004-12-03 22:18   ` H. Peter Anvin
  1 sibling, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2004-12-03 22:18 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20041203090843.GA25528@wotan.suse.de>
By author:    Andi Kleen <ak@suse.de>
In newsgroup: linux.dev.kernel
>
> On Tue, Nov 30, 2004 at 10:07:55PM -0700, Zwane Mwaikambo wrote:
> > This patch is for the following bug, thanks to Ondrej Zary for 
> > reporting, testing and submitting a patch.
> > 
> > http://bugzilla.kernel.org/show_bug.cgi?id=3767
> > 
> > It appears that the Cyrix MII won't touch %ecx at all resulting in stale 
> > data being returned as extended attributes, so clear ecx before issuing 
> > the cpuid. I have also made the capability print code display all the 
> > capability words for easier debugging in future.
> 
> Can you please change cpuid() on x86-64 too?
> 
> I think it would be also better to not printk the capabilities
> at all or only with a special kernel option. Normally they are
> not needed, but they clutter up the boot  log.
> 

Since this is a bug fix for Cyrix MII, which isn't x86-64, it seems
pointless to do it for x86-64.

	-hpa

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-03 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-01  5:07 [PATCH] Cyrix MII cpuid returns stale %ecx Zwane Mwaikambo
2004-12-03  9:08 ` Andi Kleen
2004-12-03 16:57   ` Zwane Mwaikambo
2004-12-03 22:18   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).