[CentOS] Questions on cpu frequency scaling AMD vs. Intel

Sun Aug 3 12:31:19 UTC 2008
Kai Schaetzl <maillists at conactive.com>

I've been playing and comparing frequency scaling between AMD and Intel 
CPUs yesterday and there seem to be great differences between AMD and 
Intel and some gotchas. This is all on CentOS 5.2 with latest Xen kernels 
(which are supposed to be powersaving-enabled since 5.2).

AMD:
It seems once I get the AMD CPU to use the ondemand governor it works very 
well and very efficiently. But this is not set by default, one has to set 
ondemand explicitely in /etc/sysconfig/cpuspeed and run cpuspeed on 
bootup. Otherwise it just knows about userspace and performance and 
defaults to performance.

Intel:
On the other side ondemand is on for Intel CPUs automatically, but it 
doesn't seem to work. No matter if I run cpuspeed or not the current 
frequency is shown as 2000000. This is the scaling_min_freq for both CPUs 
I checked. The scaling_max_freq is 2.333/2.5. One is a Xeon Dual Core, one 
a Xeon Quad Core.

With "not seem to work" for Intel I mean it doesn't act on demand as it 
should. I tested by gzipping and gunzipping a 4 GB image file. I used top 
to observe CPU utilization. With a dual core the idle percentage stays 
around 50% for a while and only goes below this threshold near the end of 
the operation. I deduce that means that gzip can make use of only one core 
and only when it comes to writing to disk or using other external tools it 
can utilize more CPU power because that task is taken over to the other 
core. Same observation with quad core (and 75%). There is no difference 
between AMD and Intel in this respect, but the task seems to run a bit 
more efficiently on an AMD CPU - e.g. it is able to max out idle at 0% at 
least for short periods while this is almost impossible to observe with 
the Intel CPUs. The timing also shows that the AMD is the fastest one. 
(The AMD, a very new low voltage X2, also runs at 2500 max.)

My question: why don't the Intel CPUs don't scale up on demand? Could 
there be a bug in the driver that it measures overall utilization (which 
is at 50% most of the time) and not single core utilization, thus never 
reaching the threshold for scaling up? up_threshold is at 80 for both 
CPUs. (cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold)

I have a somewhat related question. That very new AMD CPU mentioned above 
was not recognized by CentOS 5.2 and the current frequency was shown as 
800000 (instead of 2500000), although it was running in full speed. The 
latest kernel corrected this. It's still unknown, but the frequency is now 
calculated correctly and thus frequency scaling works now (it didn't work 
when it was miscalculating at 800000). On the other hand, I have an older 
low-voltage AMD CPU (probably about 2 years on the market) that is 
recognized as X2 3800+ but frequency scaling fails because it 
miscalculates the current speed to 800 MHz as well. Is there anything I 
can do about that? Where could I check whether this CPU should be 
supported in full and frequency scaling working? (I'm not sure, but I 
think it may have actually worked when it was running in a different 
motherboard.)

Kai

-- 
Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com