[email protected] (Stefan Kempf), 2016.02.01 (Mon) 19:13 (CET):
> Marcus MERIGHI wrote:
> > [email protected] (Stefan Kempf), 2016.01.30 (Sat) 10:49 (CET):
> > > We need to see how it looks like from within the kernel (and whether
> > > the illegal instruction is really raised from within sendsig()). Can you
> > > try the diff below?
> >
> > > You should get a kernel panic now instead of an illegal instruction
> > > signal if you try running ping or top. We need the output of the panic
> > > message and the output of the following commands:
> >
> > ping(1), top(1) messed up the screen.
> >
> > # ping 192.168.188.189
> > PING 192.168.188.189 (192.168.188.189): 56 data bytes
> > 64 bytes from 192.168.188.189: icmp_seq=0 ttl=255 time=166.533 ms
> > panic: sendsig 1: fxsave 0xffff800032c8a000, sp 0x7f7fff0d20b1,
> > fxave_size 512, savefpu_size 832, fpu_save_len 15773951, tf_rsp
> > 0x7f7ffffdd238, userstack 1
>
> fpu_save_len is way too large (0xf0b0ff in hex). It should be 832 at
> most. And that causes the kernel to attempt writes outside of the
> process stack (and/or to read beyond the saved FPU state).
>
> Either the value we get from CPUID is strange (or we handle CPUID
> wrongly), or something trashes fpu_save_len.
Now that you mention CPUID...
If I switch 'Max CPUID Value Limit' to 'disabled' in the BIOS, the
symptom is gone. It re-appears when setting to 'enabled'.
Diff between dmesgs (I did some line wrapping; file attached for better
readability):
--- dmesg.out.enabled Tue Feb 2 09:55:41 2016
+++ dmesg.out.disabled Tue Feb 2 09:55:41 2016
@@ -15,7 +15,7 @@
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
-cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.70 MHz
+cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.68 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,
PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,
PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,
PERF,ITSC
cpu0: 256KB 64b/line 8-way L2 cache
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
@@ -160,16 +160,18 @@
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
-cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.68 MHz
-cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,
PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,
PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,
PERF,ITSC
+cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.67 MHz
+cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,
PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,
PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,
PERF,ITSC,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
+cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
-cpu0: mwait min=23041, max=45311 (bogus)
+cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.51 MHz
-cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,
PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,
PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,
PERF,ITSC
+cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,
PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,
PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,
PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,
PERF,ITSC,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
+cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
@@ -188,8 +190,8 @@
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0: not present
-acpicpu0 at acpi0: C1(@1 halt!), PSS
-acpicpu1 at acpi0: C1(@1 halt!), PSS
+acpicpu0 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
+acpicpu1 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpipwrres1 at acpi0: FN01, resource for FAN1
acpipwrres2 at acpi0: FN02, resource for FAN2
I'm now off to working off your instructions below...
Bye+Thanks, Marcus
> Can you try this diff and paste the "cpuid1:" "cpuid2:" lines? Please
> revert the previous diff. That will show us what CPUID returns.
>
> Index: arch/amd64/amd64/cpu.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v
> retrieving revision 1.94
> diff -u -p -r1.94 cpu.c
> --- arch/amd64/amd64/cpu.c 27 Dec 2015 04:31:34 -0000 1.94
> +++ arch/amd64/amd64/cpu.c 1 Feb 2016 18:00:02 -0000
> @@ -477,6 +477,13 @@ cpu_attach(struct device *parent, struct
> * Initialize the processor appropriately.
> */
>
> +__attribute__((noinline)) void
> +print_cpuid2(uint32_t ebx)
> +{
> + printf("cpuid2: fpu_save_len: 0x%zx, ebx: 0x%x\n",
> + fpu_save_len, ebx);
> +}
> +
> void
> cpu_init(struct cpu_info *ci)
> {
> @@ -510,11 +517,13 @@ cpu_init(struct cpu_info *ci)
>
> xsave_mask = XCR0_X87 | XCR0_SSE;
> CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
> + printf("cpuid1: ebx: 0x%x\n", ebx);
> if (eax & XCR0_AVX)
> xsave_mask |= XCR0_AVX;
> xsetbv(0, xsave_mask);
> CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
> fpu_save_len = ebx;
> + print_cpuid2(ebx);
> }
>
> #if NVMM > 0
>
>
> !DSPAM:56afa11b8919659718217!
>
--- dmesg.out.enabled Tue Feb 2 09:55:41 2016
+++ dmesg.out.disabled Tue Feb 2 09:55:41 2016
@@ -15,7 +15,7 @@
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
-cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.70 MHz
+cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.68 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC
cpu0: 256KB 64b/line 8-way L2 cache
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
@@ -160,16 +160,18 @@
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
-cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.68 MHz
-cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC
+cpu0: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.67 MHz
+cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
+cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
-cpu0: mwait min=23041, max=45311 (bogus)
+cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Celeron(R) CPU 847 @ 1.10GHz, 1097.51 MHz
-cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC
+cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
+cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
@@ -188,8 +190,8 @@
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0: not present
-acpicpu0 at acpi0: C1(@1 halt!), PSS
-acpicpu1 at acpi0: C1(@1 halt!), PSS
+acpicpu0 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
+acpicpu1 at acpi0: C2(350@104 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpipwrres1 at acpi0: FN01, resource for FAN1
acpipwrres2 at acpi0: FN02, resource for FAN2