Windows guests do not recognize all of the available cores under KVM and will usually detect only 2 cores. This happens since KVM exposes the available virtual CPU cores as physical CPUs (sockets). So, if the physical host running KVM has 2 CPUs with 4 cores each (a total of 8 cores), and the guest is configured for 8 CPUs, Windows will see 8 physical CPUs and will run only on 2, due to the hard coded limits in some of the editions of Windows Server.
To make Windows use all available cores, we need to configure the guest to expose the CPUs as cores and not as physical CPUs (sockets):
- Open the guest configuration screen
- Select Processor options tab
- Expand the “Topology” setting
- Set the sockets to 2
- Set the cores to 4 (for the guest to have a total of 8 cores) or 3 (for the guest to have a total of 6 cores).
- You can also expand the “Configration” settings and click on “copy host CPU configuration” to make the guest fully use all of the physical host’s CPU capabilities.
If you run the guest from command line, the KVM option for setting the CPU topology is: -smp 8,socket=2,cores=4