The Linux kernels included in the Arm Reference Platforms deliverables are able to dynamically enable and disable CPUs at runtime without having to reboot the system; this is known as CPU "hotplugging".
To list all available CPUs:
# ls /sys/devices/system/cpu cpu0 cpu1 cpu2 cpu3 cpu4 cpu5
To hotplug CPU 3 out of the system:
# echo 0 > /sys/devices/system/cpu/cpu3/online [ 765.452857] CPU1: shutdown [ 765.458335] psci: CPU3 killed.
And to hotplug that CPU back in to the system:
# echo 1 > /sys/devices/system/cpu/cpu3/online
We can verify whether the CPU is disabled by reading `/proc/cpuinfo':
`/proc/cpuinfo'
# grep processor /proc/cpuinfo processor : 0 processor : 1 processor : 2 processor : 4 processor : 5
The actual effect of hotplugging a CPU out of the system will depend on your particular hardware and drivers; some systems may simply place the offlined CPUs into a busy idle loop whereas other systems such as the Juno will physically remove power from the specified core.
For more information see the PSCI specification.
The Device Tree passed to the Linux kernel defines which CPUs are available within the system, so it's also possible to control the number of running CPUs by removing the corresponding nodes from the Device Tree (see here), though this cannot be modified at runtime.
The cpuidle subsystem allows the kernel to dynamically hotplug CPUs in and out of the system based on the current workload.
Instructions for disabling cpuidle can be found in this troubleshooting document.