Monitor device_add triggers deadlock when calling drain_call_rcu on QEMU >= 6.0.0
Host environment
- Operating system: Debian bullseye/sid
- OS/kernel version: Linux 5.2.0-2-amd64
- Architecture: amd64
- QEMU flavor: qemu-system-mips64
- QEMU version: 6.1.50 (v6.1.0-936-gba0fa56b)
- QEMU command line:
./qemu-system-mips64 -nographic
Emulated/Virtualized environment
Doesn't matter
Description of problem
It hangs
Steps to reproduce
- Run the QEMU:
./qemu-system-mips64 -nographic - Enter into the QEMU monitor: press ctrl-a c
- Execute command
device_addwithout arguments:
(qemu) device_add
- It hangs so bad that only
kill -9helps
Additional information
I didn't test versions between 4.2.0 and 6.0.0, but I can confirm that 6.0.0, 6.1.0 and the latest master pull have this bug, while version 4.2.0 doesn't have it.
I've tracked the problem and found this.
- Command
device_addcalls functiondrain_call_rcu.drain_call_rcuwaits indefinitely for drain_complete_event. - Function
cpu_execin accel/tcg/cpu-exec.c callsrcu_read_lockbut does not callrcu_read_unlock().cpu_execjust spins in its inner loop. - Function
call_rcu_threadhanged in calling thesynchronize_rcuwhich callswait_for_readers.
If I execute stop command in QEMU monitor before calling device_add command, no hang happen.
Edited by Daniel P. Berrangé