ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.82k stars 274 forks source link

4 tests fail on POWER8 ppc64le #1048

Open Richard-Rogalski opened 11 months ago

Richard-Rogalski commented 11 months ago

log98.txt << test log

 1/27 Test  #2: bootSyscallC .....................   Passed    2.00 sec
 2/27 Test #16: sse_intrinsics ...................   Passed    2.13 sec
 3/27 Test #12: fpu ..............................   Passed    2.16 sec
 4/27 Test #19: irelative_reloc ..................   Passed    2.15 sec
 5/27 Test  #1: bootSyscall ......................   Passed    2.26 sec
 6/27 Test #24: x87cache .........................   Passed    2.24 sec
 7/27 Test #22: pshufb ...........................   Passed    2.31 sec
 8/27 Test #27: mmx ..............................   Passed    2.28 sec
 9/27 Test #15: sse_asm ..........................   Passed    2.39 sec
10/27 Test #17: aes ..............................   Passed    2.40 sec
11/27 Test  #5: maths1 ...........................   Passed    2.47 sec
12/27 Test #14: linkingIndirectNoversion .........   Passed    2.44 sec
13/27 Test #20: longjumpInSignals ................   Passed    2.50 sec
14/27 Test  #3: printf ...........................   Passed    2.58 sec
15/27 Test  #4: args .............................   Passed    2.59 sec
16/27 Test #13: contexts .........................   Passed    2.55 sec
17/27 Test #21: x87 ..............................   Passed    2.56 sec
18/27 Test  #9: fork .............................   Passed    2.68 sec
19/27 Test #18: backtrace ........................   Passed    2.66 sec
20/27 Test #11: tlsData ..........................   Passed    2.70 sec
21/27 Test #26: sse4_2 ...........................   Passed    2.60 sec
22/27 Test  #6: threadsStart .....................   Passed    2.73 sec
23/27 Test #23: bswap ............................   Passed    2.64 sec
24/27 Test  #7: trig .............................***Failed    2.74 sec
25/27 Test #25: feround ..........................   Passed    2.66 sec
26/27 Test #10: cppThreads .......................   Passed    2.76 sec
27/27 Test  #8: pi ...............................   Passed    2.84 sec

Gentoo running on my ppc64le powernv power8 machine. This is the latest git commit. Identical results on 0.2.4. CFLAGS="-O2 -pipe -mcpu=power8". However, INTERESTINGLY, I get the following on 0.2.2:

 1/22 Test #19: irelative_reloc ..................   Passed    0.91 sec
 2/22 Test #21: x87 ..............................   Passed    0.92 sec
 3/22 Test  #2: bootSyscallC .....................   Passed    1.00 sec
 4/22 Test #12: fpu ..............................   Passed    1.24 sec
 5/22 Test  #3: printf ...........................   Passed    1.27 sec
 6/22 Test #16: sse_intrinsics ...................   Passed    1.23 sec
 7/22 Test  #5: maths1 ...........................   Passed    1.28 sec
 8/22 Test  #4: args .............................   Passed    1.29 sec
 9/22 Test  #1: bootSyscall ......................   Passed    1.30 sec
10/22 Test  #7: trig .............................   Passed    1.29 sec
11/22 Test  #6: threadsStart .....................   Passed    1.30 sec
12/22 Test #11: tlsData ..........................   Passed    1.28 sec
13/22 Test #14: linkingIndirectNoversion .........   Passed    1.28 sec
14/22 Test #10: cppThreads .......................   Passed    1.30 sec
15/22 Test #18: backtrace ........................   Passed    1.27 sec
16/22 Test #17: aes ..............................   Passed    1.28 sec
17/22 Test #13: contexts .........................   Passed    1.30 sec
18/22 Test  #9: fork .............................   Passed    1.32 sec
19/22 Test #15: sse_asm ..........................   Passed    1.30 sec
20/22 Test #20: longjumpInSignals ................   Passed    1.28 sec
21/22 Test #22: mmx ..............................   Passed    1.28 sec
22/22 Test  #8: pi ...............................   Passed    1.44 sec

100% tests passed, 0 tests failed out of 22

Let me know what other info/testing you want, or you can also get SSH access to the machine if you drop me a pubkey either here or by mail at rrogalski <> firemail.cc

ptitSeb commented 11 months ago

can you try to diff the result of the failing test with the reference? For the build folder, do something like

git diff --no-index test07.out ../tests/ref07.txt
Richard-Rogalski commented 11 months ago
diff --git a/test07.out b/../box64-9999//tests/ref07.txt
index bbad3e3..76649ab 100644
--- a/test07.out
+++ b/../box64-9999//tests/ref07.txt
@@ -1 +1 @@
-0 is 0.000000, sin(pi/2) is 0.000000 and 3*1.5 is 1.000000.
+0 is 0.000000, sin(pi/2) is 1.000000 and 3*1.5 is 4.500000.
ptitSeb commented 11 months ago

Ah ok. Looks like some issue with printf (or a variant) wrapping!

ptitSeb commented 11 months ago

Also, did you built with the PPC64LE cmake flags?

Richard-Rogalski commented 11 months ago

sure did!! Htuo.log < build log

Richard-Rogalski commented 11 months ago

Let me know if there's anything wrong with my cmake flags (I package box for gentoo's guru repository). nogit was intentional as this is a git live ebuild

You are also free to ssh access at any point in the future too to test things or if you want to set up CI on my box

TheCodex6824 commented 10 months ago

I bisected this issue on a ppc64le power9 system (has the same issue with test07 failing) and got e2077c46ce334453c567382cb254d1010f733fb1 as the bad change. Looking into it more, I don't think that the change to the flag handling itself is the issue, but rather some packing / alignment side effects of changing the total size of the flags in x64emu_t.

My theory is that the scratch array declared later on in x64emu_t needs extra alignment on ppc64le for some reason, and it used to just happen to be right with the old flag fields. If I force the scratch array to be aligned to 16 bytes, the test starts passing.