When running Linux on top of QEMU, Linux sometimes warns about CPU stalls. These stalls can be caused by:
  1. A vCPU in QEMU has hung
    • This is a bug in QEMU
  2. A vCPU in QEMU has not been scheduled for enough time that Linux thinks it has hung, but in fact it hasn’t
    • This maybe caused by multiple reasons related to vCPUs not getting scheduled to run. For example due to an overloaded host, or low priority scheduling assignments to QEMU.

Possible Solutions to avoid scheduling issues

  1. If possible, avoid running QEMU in a Linux VM like Virtualbox. VM’s are subject to CPU scheduling by the host (for example Windows host) and this will add more scheduling latency and increase the probability of seeing vCPU stall.
  2. Avoid running a lot of other CPU intensive programs while running QEMU. These other programs will use up CPU resources and increase the scheduling latency and the probability of seeing vCPU stalls.
  3. Avoid giving QEMU a low scheduling priority (e.g nice QEMU)
  4. Disable the RCU CPU stalls check in the guest Linux kernel
  5. Disable SMP in the guest to decrease the amount of CPU processing needed by QEMU
  6. Planned for 2018.1: Try using an MTTCG enabled QEMU to avoid all CPUs depending on one single host thread