When it comes to running windows smp guests, you have to consider the HAL that your windows guest is using. HAL stands for Hardware Abstraction Layer and Wikipedia provides a good definition which states:
A hardware abstraction layer (HAL) is an abstraction layer, implemented in software, between the physical hardware of a computer and the software that runs on that computer. Its function is to hide differences in hardware from most of the operating system kernel, so that most of the kernel-mode code does not need to be changed to run on systems with different hardware. On a PC, HAL can basically be considered to be the driver for the motherboard and allows instructions from higher level computer languages to communicate with lower level components, such as directly with hardware.
For running a windows smp guest, the standard PC and uniprocessor HALs will not support multiple CPUs. Examples of the HALs windows support are:
For more information on this you can refer to the Microsoft web page describing the HAL options for windows XP and 2003. If you want to run windows smp guests you have two options:
How can you tell what HAL your windows guest is using? Right click on My computer, select Properties, select the hardware tab then select Device Manager.

Expand your computer object to see what type of device your running. The example below shows the windows guest using the standard pc hal. This guest in the example below will not run multiple cpus if we initialize it using the –smp option as the standard PC and unicprocessor HALs will not run smp guests.
Select the Hardware tab then Device Manager
Expand the computer icon to show your current HAL
By default, windows will install using an ACPI uniprocessor HAL. To upgrade to a HAL that supports multiple processors do the following. Right click on ACPI Uniprocessor PC and select “upgrade driver”.
At the wizard welcome screen select “No, not at this time” and click on next to continue.
Select Install from a specific location
Select the option to choose the driver to install.
You will see a list of HALs available. Choose any one of the multiprocessor HALs.
It has been my experience that if you are currently using the standard PC HAL, you will not see any other option but the standard PC HAL in this list.
2. Choose multiprocessor HAL during Guest Installation
If you are installing a new guest machine that you intend to run as an smp guest, then you need to select the appropriate HAL during installation or the acpi uniprocessor will install by default. Shortly after the installation CD boots when you see the following screen ( during the option to press F6 ), hit the F5 button. Below is an example of a windows 2003 install.
Hitting F5 will bring up the options of HALs that you can install with your windows guest.
Select one of the multiprocessor HALs and continue installation as you normally would. That’s it, you’re done. When you boot into the installed guest you can verify the HAL by inspecting your computer device manager as shown earlier. Now you can boot your guest using the –smp option using 2 or more cpus. For example, to boot with 2 virtual cpus, start kvm as follows.
qemu-system-x86_64 –hda windows.img –m 512 –smp 2
You can verify that you’re running an smp windows guest by looking at the performance tab in taskmanager within the windows guest. Below is a snapshot of what you should see; performance graphs for two cpus.

Comments
It work but the host CPU usage is always 100%
Friday, January 2, 2009 - 09:23 Anonymous (not verified)It work, however, the CPU usage is 200% if smp=2, 300% if smp=3 when using 4-core CPU.
Note that if I use ACPI
Wednesday, January 7, 2009 - 09:32 Anonymous (not verified)Note that if I use ACPI option with ACPI Multi-processor, no high cpu usage problem.
Tried many kvm revisions and
Saturday, January 31, 2009 - 07:28 Anonymous (not verified)Tried many kvm revisions and both 32-bit and 64-bit xp pro versions. Only 2 cores are detected with smp -4 and acpi enabled. Testing with a quad core Q6600, gentoo, kvm-83. With a debian guest the 4 cores are detected correctly.
A little followup to my
Saturday, January 31, 2009 - 18:04 Anonymous (not verified)A little followup to my previous post:
I think kvm passes cores to the guest as individual cpus.
XP supports 4 cores but only 2 cpus.
Windows Server 2003 supports 4 cpus.
So I tried my old winidows server 2003 license, and with smp -4 now I got 4 cpu in the guest. Hope this helps others.
Good job
Wednesday, July 15, 2009 - 10:26 faparicio (not verified)after 5 hours of tests, your article has solved the problem. Thanks XD
Post new comment