VMware, Coreinfo and mapping logical CPU cores to physical processors.

Sometimes you may have a requirement due to licensing to ensure a Virtual Machine’s CPU configuration is perfectly set out in terms of “physical sockets”. Or perhaps you want to run an operating system such as Windows Server 2003 SE on your Virtual Machine. By default this VM would be limited to only use 4 cores because of the way VMware tells the operating system that each CPU has only 1 core per socket. (Giving it 4 x vCPUs would be the same as giving a physical Windows Server 2003 SE machine 4 x physical CPUs – the actual CPU limit). Either way, it can be quite useful to verify you have the correct CPU configuration.

Enter Coreinfo. This is a handy command line utility by Mark Russinovich which allows you to dump the information about your current CPU and cache configuration for Windows. Download the utility and execute the following command to gather information about the logical CPU core mapping to physical processor.

coreinfo.exe -c -s

In the case of a single socket, six core CPU (such as the one I have running here) this is the output you will see:

 

The Logical to Physical Processor Map information in the first section marks each CPU core with an asterisk (*). The next section, lists the Logical Processor to Socket mappings, indicating how many “processor sockets” your machine has and at which location each Processor Core is at (again marked with an asterisk).

 

If you had provisioned a VM with 4 x vCPUs by default, this would show up with 4 x Sockets and 4 x Physical Processors like so:


Besides being a limiting factor for Windows Server 2003 SE VMs when trying to use 8 x vCPUs (you can’t have more than 4 x “physical” CPUs), this may also be a potential issue with a socket licensed edition of SQL server for example, as you would now have 4 x sockets to worry about with your licensing.

 

So here is where VMware’s useful extra configuration parameters come in handy. These are basically bits of extra configuration you can add to your VMs, and are stored in your VM’s .vmx configuration file. By simply editing your VM, you can add a configuration option which specifies how many Cores per Socket there are. To do this using vSphere, power off your VM, then edit it’s settings. Go to the Options tab, then General, then Configuration Paramaters.

 

 

In this case I have a VM with 4 x vCPUs, which shows up by default with 4 x processor sockets. I want this to be 4 x cores with 1 x socket. So now I would click “Add Row” and in the first empty column, enter: cpuid.coresPerSocket and use 4 as the value in the second column. See this screenshot for specifics (and adjust the value used depending on your desired configuration):

 

 

Power up your VM, and run coreinfo again, using

coreinfo.exe -c -s

 

You should now see that VMware is assigning 4 CPU cores per “Physical CPU socket”. In other words, your VM now has 1 x “physical” processor socket, and 4 x cores. Meaning your single processor application socket is now valid on this VM. Here is the result of assigning my VM a value of 4 for “cpuid.coresPerSocket” when it uses 4 x vCPUs in vSphere:

 

 

As you can now see, it has changed from the original configuration where it had 4 x Sockets listed under “Logical Processor to Socket Map” with a “Physical Processor” for each “Socket”, to showing the 4 x “Physical Processors” all on “Socket 0”.

 

If you are using VMware Workstation, this configuration is easy to do – just edit your VM settings, and look for the dropdown menu under the CPU configuration – change this to how many Processors you want and how many Cores per Processor you will use. (See the screenshot below for an example of 2 x Sockets with 2 x cores per socket):

 

 

Well, that is a brief overview of how to look at your Processor configuration (whether you are using a physical machine or a Virtual Machine), and how to change your CPU socket / core configurations using VMware vSphere or Workstation. The two uses I can think of as stated above are for licensing issues, or issues where you are being limited by what your guest OS can handle in terms of physical CPUs. Feel free to chime in, in the comments below if you can think of any other uses this may have, or if spot a mistake anywhere!

8 thoughts on “VMware, Coreinfo and mapping logical CPU cores to physical processors.”

  1. Hi Schadi,

    Ok there is your problem – With vSphere 4 Enterprise edition, your VMs are limited to 4 vCPUs. If you had Enterprise Plus licensing for your hosts then you would be able to use up to 8 vCPUs. The test I illustrated above (6 x vCPUs in a VM) in my previous comment is running on a vSphere 4.0 Enterprise Plus licensed ESX Host.

    Sean

  2. @Schadi
    under “Konfiguration – Lizensierte Funktionen (Configuration – licensed functions)

    Produkt: vSphere 4 Enterprise Lizenziert für 2 physische CPUs (1-6 Kerne pro CPU)
    Lizenzschlüssel:
    Läuft ab: Nie

    Produktfunktionen:
    Bis zu 256 GB Arbeitsspeicher
    Bis zu 4-Wege-Virtual SMP
    vCenter-Agent für ESX Server
    vStorage-APIs
    VMsafe
    DVfilter
    VMware HA
    Virtuelle Hardware, die im laufenden Betrieb ausgewechselt werden kann
    VMotion
    VMware FT
    Data Recovery
    vShield-Zonen
    VMware DRS
    Storage VMotion

  3. @Schadi

    Hi Schadi,

    Ok, in your vSphere Client, click “Home” then go to “Hosts & Clusters”. Select the ESX(i) Host that is running your VM. Look at it’s summary tab and you’ll see what “Edition” of vSphere ESX or ESXi it is running listed in the details. Let me know.

    PS regarding your scenario – it should work fine. I just created a VM with 6 vCPUs, and Windows Server 2008 R2 Standard (SP1). I powered it up. As expected, coreinfo showed it had 4 x “CPU Sockets”. Task manager also showed 4 x “Processors”. I powered it down, added the VMware Advanced settings “cpuid.coresPerSocket” with a value of 2, and applied that. I then powered up the VM, and checked CoreInfo again. It now showed 3 x Sockets with 2 x Cores per socket (used coreinfo.exe -c -s). As expected Task Manager also showed 6 x “Cores”. Check out the screenshot I took of this: http://dl.dropbox.com/u/450727/Temp/coreinfo-test.jpg

    I can only imagine that perhaps your licensing is holding you back. Will be interesting to see what edition of ESX(i) you are running.

    Sean

  4. Hi Schadi,

    What edition of vSphere are you running and what licensing do you have? I’ll see if I can try this out in a test environment myself otherwise as soon as I get a chance and let you know what I find.

    Sean

  5. Hi

    I tried this with an an Windows Server 2008 R2 as guest System
    I added cpuid.coresPerSocket with an value of 2 – but when i try to use 6 vCPU i still can’t start the guest – vSphere gives an error message which says that i can only use 4 vCPUs for this guest OS

    can anybody help?

Leave a Comment