Opened 4 years ago

Closed 4 years ago

#16382 closed bug (fixed)

ASSERT FAILED: gFPUSaveLength <= sizeof(sInitialState.fpu_state)

Reported by: HAL Owned by: korli
Priority: high Milestone: R1/beta3
Component: System/Kernel Version: R1/beta2
Keywords: Cc: HAL
Blocked By: Blocking:
Platform: x86-64

Description (last modified by HAL)

I tried to boot hrev54415-x86_64 from a USB flash drive but it went to KDL before any boot icons lit. I don't know where the boot problem may have started but the previous hrev54412 also had the same problem. I had wrote the haiku anyboot image with USB Image Writer in Linux. At the top of the KDL first line is: PANIC: ASSERT FAILED (../haiku-git/src/system/kernel/arch/x86/64/thread.cpp:147): gFPUSaveLength <= sizeof (sInitialState.fpu_state)

Attachments (6)

Haiku Boot KDL.jpg (2.6 MB ) - added by HAL 4 years ago.
Picture of boot KDL
lspci From Linux.txt (1.6 KB ) - added by HAL 4 years ago.
lspci from Linux.
cat proc cpuinfo result (9.2 KB ) - added by HAL 4 years ago.
Here is the cpuinfo you requested
FPU Space Required.jpg (3.9 MB ) - added by HAL 4 years ago.
Microcode for Intel i7 4770k.jpg (11.7 KB ) - added by HAL 4 years ago.
Microcode I was using.
Linux Syslog.txt (182.4 KB ) - added by HAL 4 years ago.
Linux Syslog

Change History (31)

by HAL, 4 years ago

Attachment: Haiku Boot KDL.jpg added

Picture of boot KDL

comment:1 by HAL, 4 years ago

Description: modified (diff)

comment:2 by waddlesplash, 4 years ago

Owner: changed from nobody to korli
Status: newassigned

Looks like the initial FPU state is too large. Can you boot an older version and get a syslog, so we can see your PCI details (or a lspci from Linux)?

comment:3 by waddlesplash, 4 years ago

Component: - GeneralSystem/Kernel
Keywords: kernel_debugger_loopPkcs removed

by HAL, 4 years ago

Attachment: lspci From Linux.txt added

lspci from Linux.

comment:4 by waddlesplash, 4 years ago

Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor

I wonder if there is a datasheet online somewhere that lists FPU state size...

comment:5 by waddlesplash, 4 years ago

Summary: Booting to KDL before any ICONS LightASSERT FAILED: gFPUSaveLength <= sizeof(sInitialState.fpu_state)

comment:6 by waddlesplash, 4 years ago

Milestone: UnscheduledR1/beta3

comment:7 by pulkomandy, 4 years ago

If I understand correctly, we get the size from the CPUID, this gives the max size that the CPU supports. But we can enable and disable specific register sets we have storage space for.

The list of things that can be saved is here: https://xem.github.io/minix86/manual/intel-x86-and-64-manual-vol1/o_7281d5ea06a5b67a-307.html

Could you show the output of cat /proc/cpuinfo on Linux to make sure which CPU you have and which instructions it supports?

Currently we have 1024 bytes of storage available, which would be enough for AVX2, but not for MPX (would need 1056 bytes) nor AVX512 (would need 2560 bytes). The state may be compressed by XSAVEC and XSAVEOPT if available, but there is no guarantee they can actually make things smaller.

I think we should bump the space to 2560 bytes already and start getting ready for AVX512? (this is in headers/private/kernel/arch/x86/arch_thread_types.h struct arch_thread)

I have put a change doing this at https://review.haiku-os.org/c/haiku/+/3031 . It would be great if you could test it and let us know if that fixes the problem for you.

comment:8 by X512, 4 years ago

I think we should bump the space to 2560 bytes already and start getting ready for AVX512?

Does it affect thread switching speed?

comment:9 by pulkomandy, 4 years ago

This specific instance is only for creating new threads if I read things correctly.

But yes, in general, saving and restoring more data in context switches affects the speed. It seems Linux only saves registers that have been used at least once by the thread to avoid that, according to https://events.static.linuxfound.org/sites/events/files/slides/LinuxCon_NA_2014.pdf

by HAL, 4 years ago

Attachment: cat proc cpuinfo result added

Here is the cpuinfo you requested

in reply to:  7 comment:10 by HAL, 4 years ago

Replying to pulkomandy:

If I understand correctly, we get the size from the CPUID, this gives the max size that the CPU supports. But we can enable and disable specific register sets we have storage space for.

The list of things that can be saved is here: https://xem.github.io/minix86/manual/intel-x86-and-64-manual-vol1/o_7281d5ea06a5b67a-307.html

Could you show the output of cat /proc/cpuinfo on Linux to make sure which CPU you have and which instructions it supports?

Currently we have 1024 bytes of storage available, which would be enough for AVX2, but not for MPX (would need 1056 bytes) nor AVX512 (would need 2560 bytes). The state may be compressed by XSAVEC and XSAVEOPT if available, but there is no guarantee they can actually make things smaller.

I think we should bump the space to 2560 bytes already and start getting ready for AVX512? (this is in headers/private/kernel/arch/x86/arch_thread_types.h struct arch_thread)

I have put a change doing this at https://review.haiku-os.org/c/haiku/+/3031 . It would be great if you could test it and let us know if that fixes the problem for you.

How do I apply the patch? I have never done this before. If it is source code does it need compiled into source code with whole Haiku or can it be compiled on its own and as a file inserted where in Haiku? I cannot run any later version of Haiku so could it be compiled on Linux? I did compile Haiku a long time ago and probably forgotten. I think it was compilable in linux with crossbuild tools but don't remember what they were.

comment:11 by pulkomandy, 4 years ago

Well, let's make things simpler, I have merged the change so it will be available in the next update (hrev54430). When that is available you can try it and let us know if it works for you.

comment:12 by HAL, 4 years ago

I tried booting hrev54447 on USB flash drive and still getting same KDL. I also tried going into safe mode but cannot. I seem to only be able to start booting from inside BIOS setup screen with boot override. Putting the boot order with USB drive first has never worked with this BIOS. So double clicking boot override with the USB flash drive and holding down shift key at same time, does not work to get to safe mode.

comment:13 by pulkomandy, 4 years ago

Hi,

In hrev54489 I changed the error message to indicate the needed size. Please tell us what it says then we can make the buffer large enough for it.

comment:14 by HAL, 4 years ago

hrev54489 is not available for download. I have been waiting for a week but the latest is still at hrev54487.

comment:15 by pulkomandy, 4 years ago

54503 was added to the download page tonight (the buildbot was off for a few days, but it's back).

by HAL, 4 years ago

Attachment: FPU Space Required.jpg added

comment:16 by HAL, 4 years ago

I uploaded a picture of KDL from hrev54503.

comment:17 by pulkomandy, 4 years ago

Well, 15 Megabytes of context space seems a bit exagerated. So either your cpu has a bug and you need a microcooe update, or our code to get this information has a problem.

by HAL, 4 years ago

Microcode I was using.

comment:18 by HAL, 4 years ago

I was using the microcode shown in the picture. I have just tried removing it and reverting to the BIOS microcode but it made no difference. I still get the KDL with the same amount of context space. The BIOS is quite old compared to the microcode update I had loaded before.

comment:19 by pulkomandy, 4 years ago

Priority: normalhigh

Making this a high priority because it is a regression and makes the system unbootable currently.

comment:20 by korli, 4 years ago

Please attach a syslog from Linux (containing "x86/fpu: Enabled xstate features").

by HAL, 4 years ago

Attachment: Linux Syslog.txt added

Linux Syslog

comment:21 by HAL, 4 years ago

Sorry for late attach of Linux syslog. I separated the lines with a space where the x86/fpu enabled xstate features are shown, to make it easy to see.

comment:22 by korli, 4 years ago

Pushed a change for a default value: https://review.haiku-os.org/c/haiku/+/3372

comment:23 by korli, 4 years ago

Please check with hrev54695 or newer.

Last edited 4 years ago by korli (previous) (diff)

comment:24 by HAL, 4 years ago

hrev54697 boots fine. I tried it from a USB stick.

comment:25 by pulkomandy, 4 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.