Hello to everyone,
Some recent changes to GPU emulation engine introduced regression which causes emulator to completely hang.
This issue can be observed with the latest emulator built from emu-master-dev sources and run with -gpu on.
It seems that it is some race condition in question because it can not be reproduced 100% of the time.
Verified that it is happening for both ARM64 and MIPS/MIPS64 with the Ranchu (qemu2) backend, could not reproduce the hang with the Goldfish (classic) backend.
It is however easier to reproduce with MIPS/MIPS64 emulation using qemu2 backend.
To reproduce the issue with MIPS64 emulation, just run the emulator built from emu-master-dev sources :
cd <AOSP>
source build/envsetup.sh
lunch aosp_mips64-eng
cd <EMU_MASTER_DEV>/external/qemu/
./objs/emulator -show-kernel -gpu on
Almost 100% of the times it will hang during bootanimation.
To increase a chance to reproduce the issue with ARM64, run the emulation through GDB like this:
cd <AOSP>
source build/envsetup.sh
lunch aosp_arm64-eng
cd <EMU_MASTER_DEV>/external/qemu/
gdb -args ./objs/emulator -show-kernel -gpu on
...
Reading symbols from ./objs/emulator...(no debugging symbols found)...done.
(gdb) handle SIGUSR1 nostop
Signal Stop Print Pass to program Description
SIGUSR1 No Yes Yes User defined signal 1
(gdb) set pagination off
(gdb) run
...
[Thread 0x7fff767fc700 (LWP 2913) exited]
[Thread 0x7fff757fa700 (LWP 2915) exited]
[Thread 0x7fff75ffb700 (LWP 2914) exited]
[Thread 0x7fffc4fff700 (LWP 2917) exited]
This is a point where the emulation freezes:
Program received signal SIGINT, Interrupt.
[Switching to Thread 0x7ffff1a26700 (LWP 2895)]
__lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
135 ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) bt
#0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1 0x00007ffff7bc6657 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2 0x00007ffff7bc6480 in __GI___pthread_mutex_lock (mutex=0x11b2e80) at ../nptl/pthread_mutex_lock.c:79
#3 0x00000000006c97b9 in ?? ()
#4 0x000000000043dc5b in ?? ()
#5 0x000000000067709b in ?? ()
#6 0x000000000048f117 in ?? ()
#7 0x00000000005b2b4a in ?? ()
#8 0x00007ffff644262f in ?? () from /home/mousewho/MIPS_SUPPORT/sources/Android/workspace-linux/studio-dev/external/qemu/objs/lib64/qt/lib/libQt5Core.so.5
#9 0x00007ffff7bc4182 in start_thread (arg=0x7ffff1a26700) at pthread_create.c:312
#10 0x00007ffff567e47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) info threads
Id Target Id Frame
17 Thread 0x7fff54ffd700 (LWP 2912) "MainLoopThread" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
16 Thread 0x7fff567fe700 (LWP 2911) "MainLoopThread" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
15 Thread 0x7fff56fff700 (LWP 2910) "MainLoopThread" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
14 Thread 0x7fff74ff9700 (LWP 2909) "MainLoopThread" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
6 Thread 0x7fffe89d3700 (LWP 2898) "MainLoopThread" 0x00000000004f7e68 in ?? ()
4 Thread 0x7ffff1225700 (LWP 2896) "MainLoopThread" pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 3 Thread 0x7ffff1a26700 (LWP 2895) "MainLoopThread" __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
2 Thread 0x7ffff227d700 (LWP 2893) "QXcbEventReader" 0x00007ffff567112d in poll () at ../sysdeps/unix/syscall-template.S:81
1 Thread 0x7ffff7ee2980 (LWP 2886) "qemu-system-aar" 0x00007ffff5675da3 in select () at ../sysdeps/unix/syscall-template.S:81
(gdb)
We also identified, that the following changes are most likely to introduced the issue :
If you checkout the sources as follows, issue disappears :
external/qemu:
git checkout 1bd2d4e581f~1
external/qemu-android:
git checkout 288dfebe905~1
Kind regards,
Miodrag