Hi all,

Is anyone running the 9k amd64 kernel? I wrote a simple floating point test
program and would very much like to know if it works for you. The program
is at https://swtch.com/tmp/fpnote2.c.

6c fpnote2.c
6l fpnote2.6
6.out

Successful output ends by printing 49999995000001 49999995000001.

Unsuccessful output looks like this:

term% 6.fpnote2
start counting
.postnote
postnote done
floatnote mynote
out of sync 2970158019 140737488346705

The 'out of sync' message means the integer registers and floating-point
registers, which are counting the same sum, have gotten out of sync. It
seems like the floating-point registers are being lost shortly after a note
arrives and is handled by the process. Without the note, the program runs
correctly.

I did find one bug in what seems to be the latest copy of
/sys/src/9k/k10/fpu.c
<https://github.com/0intro/9legacy/blob/6df3ae5f452342095aaafbdaef1bd6c9342dd6af/sys/src/9k/k10/fpu.c#L166>.
In sysrforkchild, the child->fpusave pointer is set to point at up->fxsave,
which is the parent's FPU save buffer. This will get corrected during exec,
which will clear fpusave and set fpustate to Init. Then the first FPU usage
will set fpusave correctly. The sharing here is certainly a bug, but it's
not the problem: correcting that line to say child->fxsave does not make my
test program start working (as expected; in my program the child does no
floating point).

I'm seeing the failures using QEMU, both on a non-x86 Mac using -accel tcg
and on an AMD Linux system using -accel kvm. Those are different enough to
make me lean toward thinking it's a real hardware bug, but it could still
possibly be a QEMU problem. I'd be very interested to know how real
hardware fares.

Thanks!

Best,
Russ

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Taf6b900592afc500-M3e9849e499c6ce1204a99bf4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to