Windows 7 Home Premium and QEMU in SMP mode

I recently played around with a Linux Kernel as host operating system and having Windows 7 Home Premium as guest. My intention was to implement an easy-to-use sandbox system for someone in my family (a good starting point may be here). The hardware should be a Core 2 Duo processor. As he will most likely end up using only the sandbox and never really touch the host system, the maximum amount of resources (including memory and CPU power) should be handed over to the guest operating system. However, thinking that this should be quite easy turned out to be non-trivial in the end.

Hardware Abstraction Layer

Knowing that “forwarding” multiple processor cores would not be easy is already confirmed when you look at the topic of SMP with KVM/QEMU. Besides the fact that it is non-trivial to configure (and many of the management applications do not consider this topic carefully enough!) even the guest operating system must deal with the multiprocessor environment properly. In the case of Windows, the Hardware Abstraction Layer (short: HAL) is one of the cornerstones which you might stumble over. How a switch of the HAL is possible even after installation is documented in here. For the case of my Windows 7 Home Premium 64 Bit version, however, this is totally different: There is only one HAL version – one for the ACPI-PC which in fact (almost) all today’s motherboards with multicore support are. There is also no dedicated ACPI-HAL for multiprocessors or similar. As impact (to my surprise), though I had given “-smp 2” on the QEMU-KVM command line, the task manager always reported only to have one single CPU. On the KVM console (CTRL-ALT-2) the command info cpus indicated that two CPUs had been started, but the second was always halted.

The correct settings for QEMU

The root cause for this “missing multiprocessor” support can be clarified quite quickly: All Windows 7 Home versions do not support to run on multiprocessors environment – it only allows multicore environments! To get that straight, let’s clarify the difference: A multiprocessor system is a computer system that has multiple physical main processors installed. A multicore system, however, may physically have only one processor die (one single chip) which in turn still has more than one internal instruction/operation unit — the so-called “core”. All these cores, thus, physically share the same die, i.e. the chip on which the processor is built. In this fact, there is already the answer to the problem: if you simply state -smp 2 in the command line to start your virtual system, you are telling QEMU to provide two physical processors – you will get a multiprocessor system. Yet, Windows 7 Home does not know how to deal with it, takes only the first CPU and thus keeps the second CPU idling around.
In newer versions of QEMU it is possible to provide additional parameters to the “-smp” command which makes it simulate a multicore system. In my case -smp 2,cores=2,sockets=1 made the trick. However, please note that you need to specify both additional parameters. As soon as I dropped one of them, I was back to the old problem that the virtual maschine had two processors instead of two cores.

It took me three hours to find that out and I nowhere found proper documentation on this effect. Apparently, nobody took the time to simply write down these two trivial facts. I hope that someone out there might not need to dig that deep to understand the “strange world of KVM with Windows 7 Home edition” when doing SMP.

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)
VN:F [1.9.22_1171]
Rating: +2 (from 2 votes)
Windows 7 Home Premium and QEMU in SMP mode, 5.0 out of 5 based on 3 ratings

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.