NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-i386/52266: Double fault early in boot with Transmeta Crusoe CPU



Hi,

2017-07-08 18:15 GMT+09:00 Simon Burge <simonb%netbsd.org@localhost>:

>  If I change lapic_is_x2apic() to unconditionally return false, my
>  Soekris boots (at least to single user mode).
>
>  I tried to get lapic_is_x2apic() to store the value of the MSR it
>  reads by changing that function to:
>
>         uint64_t x2apic_msr;
>
>         bool
>         lapic_is_x2apic(void)
>         {
>                 x2apic_msr = rdmsr(MSR_APICBASE);
>                 return false;
>         }
>
>  but that just faulted/paniced too, but slightly differently:
>
>         > boot net8 -s
>         17730720+696076+839124 [776736+802655]=0x13e1cbc
>         fatal protection faufatal double fault in supervisor mode
>         trap type 13 code 0xc0118298 eip 0x8 cs 0x246 eflags 0xc054bbf6 cr2 0 ilevel 0x8 esp 0xc11ea760
>         curlwp 0xc125f360 pid 0 lid 1 lowest kstack 0xc14e32c0
>         kernel: user trap double fault, code=0
>         Stopped in pid 0.1 (system) at  8:      invalid address
>         db{0}>
>
>  The chopped off "fatal protection fau" is new.  Could the rdmsr() itself
>  be faulting then??
>
>  Is there any further info I get to help?

Could you try the following patch.

diff --git a/sys/arch/x86/x86/lapic.c b/sys/arch/x86/x86/lapic.c
index 20822a67184..372e9f8c0c2 100644
--- a/sys/arch/x86/x86/lapic.c
+++ b/sys/arch/x86/x86/lapic.c
@@ -235,10 +235,12 @@ lapic_enable_x2apic(void)
 bool
 lapic_is_x2apic(void)
 {
-    uint64_t r;
+    uint64_t msr;

-    r = rdmsr(MSR_APICBASE);
-    return (r & (APICBASE_EN | APICBASE_EXTD)) == (APICBASE_EN |
APICBASE_EXTD);
+    if (rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
+        return false;
+    return (msr & (APICBASE_EN | APICBASE_EXTD)) ==
+        (APICBASE_EN | APICBASE_EXTD);
 }

 /*


Regards,
-- 
Kimihiro Nonaka


Home | Main Index | Thread Index | Old Index