Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mame -validate hangs on s390x and arm64 #3371

Closed
jmallach opened this issue Mar 21, 2018 · 7 comments
Closed

mame -validate hangs on s390x and arm64 #3371

jmallach opened this issue Mar 21, 2018 · 7 comments
Assignees

Comments

@jmallach
Copy link
Contributor

jmallach commented Mar 21, 2018

0.195, built on Debian sid (gcc 7.3)

MAME builds correctly, but our check target tries to run mame -validate. This has stopped working, and on at least these two architectures, it now just sucks CPU until killed. strace shows nothing. Both architectures use the C fallback code instead of native assembler.

Attached is a backtrace and a disassembly of a generated core file on s390x.

disassembly.txt

@ajrhacker
Copy link
Contributor

Have you tried adding the -verbose flag? If a particular driver is causing -validate to hang, that should show output stopping just before it.

@cuavas
Copy link
Member

cuavas commented Mar 21, 2018

It's not in a particular driver, it's in validity_checker::validate_inlines() - it's probably a bug in our relatively poorly-tested C++ fallback code, since we have intrinsics/assembly for our main supported platforms. For s390x it's actually compiled something to an infinite loop:

   0x0000000124d8d4c0 <+2208>:  je      0x124d8d4d0 <_ZN16validity_checker16validate_inlinesEv+2224>
   0x0000000124d8d4c4 <+2212>:  larl    %r2,0x126f2cdb2
   0x0000000124d8d4ca <+2218>:  brasl   %r14,0x1252aa3a8 <_Z16osd_printf_errorPKcz>
=> 0x0000000124d8d4d0 <+2224>:  j       0x124d8d4d0 <_ZN16validity_checker16validate_inlinesEv+2224>
   0x0000000124d8d4d4 <+2228>:  ltr     %r1,%r1
   0x0000000124d8d4d6 <+2230>:  jhe     0x124d8cd38 <_ZN16validity_checker16validate_inlinesEv+280>

That's not going to ever complete. I'll try to find some time to see if I can work out what it's trying to do there.

@cuavas cuavas self-assigned this Mar 21, 2018
@cuavas
Copy link
Member

cuavas commented Mar 21, 2018

According to @DopefishJustin, the asm.js build (which uses the C fallbacks) hangs on -validate as well. After a bit of reading, it seems the compiler has optimised the C fallback for count_leading_zeros to an infinite loop with no side-effects. There's no function epilogue or anything.

@cuavas
Copy link
Member

cuavas commented Mar 21, 2018

Should be fixed in 418bc70

@DopefishJustin
Copy link
Member

That fixes the asm.js hang.

@cuavas
Copy link
Member

cuavas commented Mar 21, 2018

Closing since it should be fixed across all platforms - @jmallach please reopen if it's not fixed on S/390, ARM, or AArch64.

@cuavas cuavas closed this as completed Mar 21, 2018
@jmallach
Copy link
Contributor Author

dpkg-deb: building package 'mame' in '../mame_0.195+dfsg.1-1_s390x.deb'. 🎉

Thanks for the prompt fix. A build has also finished for mips, and it failed in the same way as expected.

kfazz pushed a commit to kfazz/mame_brother_wp that referenced this issue Sep 22, 2019
Validation tests were failing for mips*, arm*, s390x, and other arches
with no native ASM.

Cherrypick Vas' patch to fix this.

See mamedev/mame#3371 for more info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants