cpu fun

While looking at options 2.6.18 provided, I came across cpu “hotplug”, where one can turn on/off CPUs on the fly. On my workstation(dual opteron 248) I enabled CONFIG_HOTPLUG_CPU and rebooted. A simple # echo 0 > /sys/devices/system/cpu/cpu1/online and /proc/cpuinfo only shows one processor. This showed up in dmesg:

CPU 1 is now offline
SMP alternatives: switching to UP code

After # echo 1 > /sys/devices/system/cpu/cpu1/online /proc/cpuinfo shows both CPUs and dmesg contains this:

SMP alternatives: switching to SMP code
Booting processor 1/2 APIC 0x1
Initializing CPU#1
Calibrating delay using timer specific routine.. 4410.23 BogoMIPS (lpj=22051180)
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU 1/1 -> Node 0
AMD Opteron(tm) Processor 248 stepping 0a
CPU 1: Syncing TSC to CPU 0.
CPU 1: synchronized TSC with CPU 0 (last diff 2 cycles, maxerr 821 cycles)

This makes me wonder “how much” the CPU is shut down… I wonder if this could be used as some sort of power management for SMP systems.

Time to find a ammeter….