lkml.org 
[lkml]   [1997]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: incorrect 'buggy K6' warning
From
Date

> > Nov 14 15:33:01 wormhole kernel: AMD K6 stepping B detected - system stability
> > ay be impaired. Please see.
> > Nov 14 15:33:01 wormhole kernel: http://www.creaweb.fr/bpc/k6bug_faq.htmlLinux
> > However, this is a week 32 K6, i.e. one that doesn't have the bug.
>
> There isn't a decent way to detect a 'good' and 'bad' one. AMD really really
> should have bumped up the stepping mask on the fixed chips and we wouldn't have
> these annoying false warnings.

The following patch tries to detect 'bad' chips by timing indirect calls.
This method has been tried on a few K6 and always returned the correct answer,
up to now ;-)
Feedback is welcome.

-- Benoit


diff -ur linux-2.1.64.std/include/asm-i386/bugs.h linux-2.1.64/include/asm-i386/bugs.h
--- linux-2.1.64.std/include/asm-i386/bugs.h Sun Nov 16 12:26:52 1997
+++ linux-2.1.64/include/asm-i386/bugs.h Sun Nov 16 18:24:48 1997
@@ -148,21 +148,47 @@
}

/*
- * B step AMD K6 before B 9729AIJW have hardware bugs that can cause
+ * B step AMD K6 before B 9730xxxx have hardware bugs that can cause
* misexecution of code under Linux. Owners of such processors should
* contact AMD for precise details and a CPU swap.
*
- * See http://www.creaweb.fr/bpc/k6bug_faq.html
+ * See http://www.chorus.com/bpc/k6bug.html
* http://www.amd.com/K6/k6docs/revgd.html
*/

+
+extern void vide(void);
+__asm__(".align 4\nvide: ret");
+
__initfunc(static void check_amd_k6(void))
{
/* B Step AMD K6 */
if(x86_model==6 && x86_mask==1 && memcmp(x86_vendor_id, "AuthenticAMD", 12)==0)
{
- printk(KERN_INFO "AMD K6 stepping B detected - system stability may be impaired. Please see.\n");
- printk(KERN_INFO "http://www.creaweb.fr/bpc/k6bug_faq.html");
+#define K6_BUG_LOOP 1000000
+ int n;
+ void (*f_vide)();
+ unsigned long d, d2;
+
+ /*
+ * It looks like AMD fixed the 2.6.2 bug and improved indirect
+ * calls at the same time.
+ */
+ n = K6_BUG_LOOP;
+ f_vide = vide;
+ __asm__ ("rdtsc" : "=a" (d));
+ while (n--) f_vide();
+ __asm__ ("rdtsc" : "=a" (d2));
+ d = d2-d;
+
+ printk(KERN_INFO "K6 BUG %ld %ld\n", d, 20*K6_BUG_LOOP);
+ printk(KERN_INFO "AMD K6 stepping B detected - ");
+ if (d > 20*K6_BUG_LOOP) {
+ printk(KERN_INFO "system stability may be impaired when more than 32 MB are used.\n");
+ } else {
+ printk(KERN_INFO "probably OK (after B9730xxxx).\n");
+ }
+ printk(KERN_INFO "Please see http://www.chorus.com/bpc/k6bug.html\n");
}
}

\
 
 \ /
  Last update: 2005-03-22 13:40    [from the cache]
©2003-2011 Jasper Spaans