Qemu 5 on Windows Host With WHPX

Running Linux guests using Qemu 5.0+ on a Windows host, using the WHPX accelerator, may fail to start and freezes on this line:

[ ... ] Freeing unused kernel image memory: ...

These guests work fine using Qemu 4 on the same Windows host, configured to use a SkyLake CPU type. The issue can be worked around in either of two ways:

  1. Switch the accelerator to TCG.
    Enable SMP with a suitable number of cores or threads to improve performance. I.e. use the parameters:
    -accel tcg -cpu Skylake-Client -smp sockets=1,cores=2,threads=2

  2. Switch the CPU type to Westmere.
    We have confirmed the guest fails to boot with a CPU type of SandyBridge or later. You can also enable the pcid on the CPU to mitigate the cost of Meltdown fixes. I.e. use the parameters:
    -accel whpx -cpu Westmere,+pcid

Running Windows guests with the WHPX accelerator and SMP enabled may cause the guest to freeze, with the host at 100% high CPU usage, after running for a short while. To prevent this, either:

  1. Remove the “-smp …” parameter.
    – or –
  2. Limit to 1 CPU, 1 core and 1 thread, i.e.:
    -smp sockets=1,cores=1,threads=1

This will limit Qemu to single core on the host, but performance will still be better than using the TCG accelerator.