[vbox-dev] cpu hotplug support

Alexander Eichner Alexander.Eichner at Sun.COM
Thu Apr 22 09:29:17 GMT 2010


any recent Linux kernel should support it. I used Ubuntu 9.10. Windows  
is also supported but Windows Server 2008 R2 x64 Datacenter edition
implements CPU hot-add only.

The following commands configure the VM for CPU hotplugging:


VBoxManage modifyvm name --cpuhotplug on -- switches CPu hot-plugging on

VBoxManage modifyvm name --cpus <nr> -- sets the maximum number of  
CPus the VM can have

VBoxManage modifyvm name --plugcpu <id> -- Adds the CPU with <id> to  
the VM while it is off

VBoxManage modifyvm name --unplugcpu <id> -- Removes the CPU with <id>  
from the VM while it is off, CPU 0 can't be removed.

Initiating hot-add/hot-remove events:

VBoxManage controlvm name plugcpu <id> -- Adds CPU <id> while the VM  
is running

VBoxManage controlvm name unplugcpu <id> -- Removes CPU <id> while the  
VM is running.

Linux doesn't make use of new CPUs by default. You either need to  
update the guest additions which includes a service handling the events.
If you don't want to update the guest additions you can also execute  
the following command as root:

echo 1 > /sys/devices/cpus/cpu<id>/online

To eject a CPU without installed guest additions you have to do the  
following before actually ejecting the CPU:

echo 1 > /sys/devices/LNXSYSTEM:00/device:00/ACPI0004:<i>/LNXCPU:<i2>/ 

The <i> and <i2> numbers don't need to be equal and they do not match  
the <id> value used to enable a CPU. So you have to search for the  
right CPU object unfortunately.
The reason behind is to prevent ejection of CPUs while the guest may  
still use them. The above command will tell the kernel to disable the  

Alexander Eichner

Alexey Eremenko wrote:

> OK, since I have compiled a brand new VirtualBox, I would like to take
> a look at this feature too...
> 1. What are the commands for doing that ? (on host and on guest)
> 2. Which guest Linux kernels supported ?
> -- 
> -Alexey Eromenko "Technologov"
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Dr. Roland Bömer
Vorsitzender des Aufsichstrates: Martin Häring

More information about the vbox-dev mailing list