I created a Windows10 VM using qemu a LONG time ago and have copied it around to various servers and have been using it with different -smp levels (I start it just using command line arguments and I just use -smp 4 or -smp 8 or whatever) based on the capabilities of the server. Basically I use about 75% of the available CPU cores on the system but never >10. Same with -mem. I run it with -snapshot because I just use it for testing installation etc.

All my servers are x86_64 running Ubuntu 20.04 (QEMU 4.2.1)

That has worked fine but I needed to update the Windows VM image with newer patches etc. so I did that (without -snapshot obviously), and it worked great. Then I copied the VM image around to my other servers, but last night the testing failed on one of them.

Retrying shows that when this image starts on that server it pauses for a long time, then throws a BSOD with the error "power driver state failure", then it finally reboots and it seems fine after that. However, this is not good because by the time it's finally up my tests have all timed out etc.

I searched for this error and didn't come up with much. So I decided to just try random stuff :). The first thing I noticed is that while both my "working" system and the "non-working" system both use -mem 8G, the working system used -smp 4 while the non-working system used -smp 10: the non-working system is a larger server with more CPUs; the end of /proc/cpuinfo shows:

processor       : 19
vendor_id       : GenuineIntel
cpu family      : 6
model           : 79
model name      : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz

So I tried restarting qemu on the "non-working" system with -smp 4 and lo and behold it worked! I also tried -smp 8 and that failed as well, but -smp 6 worked.

So, that's unfortunate for me. Does anyone have any ideas of why this might happen, why this new version of the image would have this problem when the old one worked fine, if there's any way to fix it from within the image (changing the QEMU startup will be annoying since it requires changing a lot of test scripting throughout a lot of Git branches), or other hints?

My QEMU start line is:

qemu-system-x86_64 -enable-kvm -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time \
    -vnc -pidfile qemu-installer-vm.pid -daemonize \
    -device nec-usb-xhci -device usb-tablet \
    -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
    -drive file=win10-x64.qcow2,if=none,id=drive-ide0-0-0,format=qcow2 -vga std \
    -net user,hostfwd=tcp::6350-:22 -net nic -name windows \
    -m 8G -smp 10 -snapshot

If I change the -smp 10 to -smp 4 it works.

  • I tried removing -snapshot and starting with -smp 10, letting it go through the reboot, then shutting it down, and now it boots up OK the first time with -smp 10 and -snapshot. It also still works with -smp 4. I will have to copy this image to other systems and see if it works there too. This is pretty strange though. Still wondering if anyone has thoughts about it... – MadScientist Dec 6 '20 at 17:02

Not a solution, but it may point to one.

From an old bug-report:
Bug 689665: Specify the number of cpu cores failed with cpu model Nehalem Penryn and Conroe

Cause: some CPU models defined on qemu-kvm have a low "level" value (< 4). This includes the models: Conroe, Penrym, Nehalem.

I take this to mean that qemu-kvm has a limit on the number of cores that depends on the virtual architecture of the VM.

I don't know much about how your VM is defined, and I don't use qemu, but you have probably reached one of its limits. You may need to experiment with qemu versions and configuration parameters to achieve a higher core count.

  • Could be; but this exact same VM worked fine on all systems for years. The only change I made to it was to start it without -snapshot and allow all the accumulated Windows updates to be installed, including all the restarts etc. then shut it down cleanly. On the original system I did this, with -smp 4, I restarted and tested the image many many times and it always worked. On this other host system, with -smp 8 or -smp 10, it failed. I didn't change anything about the QEMU options when I started the system. All options are shown above: there's no other config file. – MadScientist Dec 7 '20 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.