Will 'PowerNow' Cause Trouble in Linux?
Vandermar asks: "AMD's 'PowerNow' promises to vary clock speed in 50mhz increments on the fly similar to Crusoe. If I remember correctly, Linus had to make changes to the Linux kernel to keep it from freaking out when the clock speed changed. Will the variable clock speed of AMD's new mobile chips require changes to the kernel (or will PowerNow need to be disabled)? How was the kernel modified to allow it to run on Transmeta chips?"
There's currently code in the kernel to handle Speedstep changes. Normally, CPU speed changes won't affect anything, as users of older laptops will know. However, as the kernel uses timing loops for some things, if the speed of your CPU changes you might experience problems when changing CPU speed, since the timing loops won't be the right duration.
That's why the speedstep changes are in there, to recalibrate the loops when the CPU changes speed. If the new CPUs use a different method to notify speed changes (or whatever, I'm not precisely sure how it works), another case will probably have to be added but it should be minimal. And running Linux before such changes are made will probably be pretty safe, you'll just have a potential for problems.
(I think the speedstep changes are in all recent 2.2 kernels, but I don't think they're user-visible in any way.)
Alan Cox wrote:
> > Correct. Transmeta Longrun and Intel Speedstep do change the clock
> > frequency, though; however, at least Transmeta will still present a
> > constant-frequency TSC to the RDTSC instruction. Don't know about
> > Intel.
>
> I believe Intel also keeps constant TSC.
>
> > (Now, some broken Cyrix chips would lose or not increment the TSC when
> > throttled.)
>
> They stop the TSC when the CPU is suspended completely. Thats actually very
> nice behaviour on a power sensitive device.
2.2.16 and beyond support SpeedStep, et al.
I can't actually provide links, but I can provide some Linux common-knowledge.
As most Linux specialists probably know, the kernel calculates a rough estimate of the system's speed in BogoMIPs (bogus MIPs) when it is first initialized. This figure probably gets used a lot for imposing delays etc., especially I/O wise, where an I/O wait period is much smaller than the x86 clock chip's maximum speed. I can't be 100% certain of this because I'm not a mighty kernel hacker yet =P.
A word of technical detail on the x86 clock chip (skip if bored): every x86 chipset since the PC (I think) has at the very least a single system clock chip on it which gets split into three separate clock master signals. One is for DRAM Refresh (so you can't monkey with that one--much); another is equally vital, although I don't remember exactly what it does. The third is spare for system use, but is by default used for maintaining the BIOS software clock, whether a Real Time Clock (RTC) circuit is present or not.
This third signal can be set to a pretty high frequency, but it is sometimes not high enough to impose I/O wait periods in hardware drivers without making those wait periods longer than necessary and impacting system performance. I think this is usually where BogoMIPs get used...
The bad thing about BogoMIPs is that they are only a rough figure of performance and often get used as a more precise measure than they really are (usually not in a stable kernel though).
The bad thing about BogoMIPs and PowerNow is that BogoMIPs will become even *less* accurate than before. This is probably a very serious problem, as up until now, the kernel has been able to assume that a CPU will stay at the same speed it had at boot time and thus assume a fair degree of consistency in the actual BogoMIPs rate at any time. This assumption is no longer valid with PowerNow.
So...my guess is that this PowerNow thing WILL cause a severe problem--not just with Linux, but possibly with many other operating systems as well. This problem could be worked out, though; the kernel is capable of monitoring CPU clock frequency, so that clock speed at any given time, combined with clock speed at the time of BogoMIPs calculation, could be used to calculate a factor to apply to the original BogoMIPS calculation and thus get a fairly accurate current BogoMIPS calculation. This would probably impact performance a bit.
I'd guess that in future kernels, you would see the "Support PowerNOW!" config option within the CPU Features submenu of the kernel config script. For those who don't know about this (and are actually interested in knowing), check the Kernel-HOWTO at Linuxdoc.org .
Hoo...all that karma whoring. I feel dirty now...I think I'll take a shower.
Kelledin Tane, the Dreaming Minstrel
http://kelledin.tripod.com/scovsms.jpg