Opened 5 years ago
Last modified 12 months ago
#15210 new bug
KDL: Unexpected exception "SIMD Floating-Point Exception" occurred in kernel mode!
Reported by: | konrad | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | System/Kernel | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86-64 |
Description
If you run Qemu with SMP larger than 2, Haiku crashes.
This one KDLs: qemu-system-x86_64 -drive file=haiku.img,format=raw -m 8192 -soundhw hda -usb -accel hvf -cpu host -smp 4 -rtc base=utc,clock=host
changing to -smp 2 works.
Attachments (1)
Change History (11)
by , 5 years ago
Attachment: | serial.txt added |
---|
comment:1 by , 5 years ago
Keywords: | qemu removed |
---|---|
Summary: | KDL in Qemu → KDL: Unexpected exception "SIMD Floating-Point Exception" occurred in kernel mode! |
https://xref.plausible.coop/source/xref/haiku/src/add-ons/kernel/bus_managers/usb/Transfer.cpp#230
There's a bunch of floating-point math in there, but no divides by non-constants. That it works with 2 cores but not 4 is especially strange, and likely implies a bug in our multicore logic, or (more likely, since no-one has ever seen this elsewhere) in QEMU's HVF usage
comment:3 by , 5 years ago
We have never had a policy of avoiding FP. A large number of things in kernel-mode (the USB stack as seen here is one instance) use floating-point math.
We also do not have any policy (or, really, any reason, since SSE2 is part of the baseline x64) to avoid SIMD in the kernel; I think it's enabled (since pdziepak's scheduler changes) inside the bootloader just before the kernel is called. GCC 6+ by default will vectorize certain operations; seems that's what is occurring here.
comment:4 by , 5 years ago
Do we really save and restore that properly. I think they propably shouldn't be there. I was taught to never ever do that in kernel and think most OS'es avoid it. In PS/2 driver there is even fake FP handling.
comment:5 by , 5 years ago
Looked it up, saving restoring fp (and simd on 32bit) is so expensive it is not done on context switching. Therefore you need to write code that save/restore them perfetly on all exit cases and without messing up stack order. So it's just something you should avoid. SIMD on 64 bit is fine though.
Havn't looked at our own context-switching though.
comment:6 by , 5 years ago
As I said already, pdziepak made changes to enable this even earlier in the boot than it was before; we definitely support this properly in kernel mode and many other things would have broken if we didn't: https://xref.plausible.coop/source/xref/haiku/src/system/kernel/arch/x86/arch_thread.cpp#250
comment:7 by , 5 years ago
The PS/2 driver's fake FP probably dates from the days we ran Haiku code under BeOS, which (I don't believe?) supported floating-point, indeed. We can probably get rid of that fake code and use the real thing now.
comment:8 by , 5 years ago
Ah nice. PS/2 code will be moved out of kernel at some point. Similar code exists in userland already.
comment:10 by , 12 months ago
Platform: | All → x86-64 |
---|
serial output