KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Running Windows SMP Guests

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:

  • Standard PC
  • MPS Uniprocessor PC
  • MPS Multiprocessor PC
  • ACPI PC
  • ACPI Uniprocessor PC
  • MPS Multiprocessor PC

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:

  1. You can upgrade your current guest HAL to one that supports multiprocessors.
  2. For a new guest, you can install your windows guest using a HAL that supports multiprocessors.

 

1. Update Guest HAL to support Multiprocessors

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%

It work, however, the CPU usage is 200% if smp=2, 300% if smp=3 when using 4-core CPU.