Xen, CPUFreq and the Core i5 CPU

A while ago I updated my main fileserver (which was an old P4!) to a new Intel Core i5 CPU & associated hardware. I've managed to do some more tweaking today and found some very interesting things.

All Intel i5 CPUs (and probably the i3 & i7 as well) have this feature called Intel Turbo Boost. In short, what this does is to make your CPU run faster when it needs to - and as long as it doesn't get too hot etc. This gives a nice performance boost without having to overclock the CPU all the time to squeeze out a little more performance.

There are however a few things you need to configure correctly to make sure Turbo Boost works on your system:

1) Configure cpuspeed to use the acpi_cpufreq module. Once this is done, have a look at scaling_available_frequencies. You should see something like this:

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 3326000 3325000 3192000 3059000 2926000 2793000 2660000 2527000 2394000 1197000

This tells us we can scale between 1197Mhz and 3325Mhz. Note the entry for 3326Mhz. This is the way linux shows us the Intel Turbo Boost functionality.

2) It's probably wise to use the ondemand governer for cpufreq. This will allow the system to ramp up its clock speed as required, then back it off automatically when things are a bit quieter.

3) Check to see that loads in Xen DomUs are correctly ramping up the CPU speed. To do this, I used this command:

watch "xm list; echo; cat /proc/cpuinfo | grep MHz"

This will show what DomU systems are running every 2 seconds, as well as the frequency that each core is running at. My system is currently an i5 661 (2 cores, 4 threads), so I see:

cpu MHz : 1197.000 cpu MHz : 1197.000 cpu MHz : 3325.082 cpu MHz : 3325.082

The last 2 entries are the hyperthreads for core0 and core1 respectively. You will note that the frequency of the extra threads do not change - but the cores will. When you do some activity in a DomU, you should see one or both of the cores clock up as required.

I love technology when it works properly :)


Comments powered by Disqus