Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

wbyung

macrumors member
Original poster
Jan 16, 2009
36
0
Guys,

I'm done with CoolBook which has not been updated for a while and the latest version 2.14 doesn't support my Mac Mini 2.26. So I decided to look around to see if there is any open source SpeedStep driver.

And I found xnu-speedstep.

It was stated that undervolt function was implemented but I find that the kext has some problem remembering the user defined voltage.

I decided to modify the kext FOR MY OWN CPU.

I ran CPUTest to load up the CPUs and undervolted from 1.175V to 0.975V and let it run for a while.

0.95V would give kernel panic immediately.

Then I rewrote the Auto-throttle section to disable frequency stepping and fix the frequency at the highest and undervolt. Basically everytime the timer runs it checks if the voltage and frequency is correct and recorrect if neccesary.

The compiled kext would
1) fix the CPU at the highest frequency
2) fix the voltage at 0.975V

At full load the power consumption is lowered from 14W to just 9W.

If you are certain your CPU can run at 0.975V, try using it at your own risk.
Copy kext to /System/Library/Extensions/

Run the following in terminal to change permissions and load kext

chown -R root /System/Library/Extensions/IntelEnhancedSpeedStep.kext
chmod -R 755 /System/Library/Extensions/IntelEnhancedSpeedStep.kext
kextunload /System/Library/Extensions/IntelEnhancedSpeedStep.kext
kextload /System/Library/Extensions/IntelEnhancedSpeedStep.kext
dmesg | grep IntelEnhancedSpeedStep
sysctl -a | grep throttle
If not, edit the attached XCode project.

The kext doesn't give consistent readings via sysctl. The debugger message loads the register directly from the CPU and confirms the buggy sysctl interface.

dmesg | grep IntelEnhancedSpeedStep
IntelEnhancedSpeedStep: DBG Autothrottle: CPU load 1000 /10 pc
IntelEnhancedSpeedStep: DBG Starting throttle with CTL 0x815
IntelEnhancedSpeedStep: DBG Throttle done.
IntelEnhancedSpeedStep: DBG Autothrottle: CPU load 1000 /10 pc
IntelEnhancedSpeedStep: DBG Starting throttle with CTL 0x815
IntelEnhancedSpeedStep: DBG Throttle done.
IntelEnhancedSpeedStep: DBG Autothrottle: CPU load 1000 /10 pc
IntelEnhancedSpeedStep: DBG Starting throttle with CTL 0x815
IntelEnhancedSpeedStep: DBG Throttle done.
IntelEnhancedSpeedStep: DBG Autothrottle: CPU load 1000 /10 pc
IntelEnhancedSpeedStep: DBG Starting throttle with CTL 0x815
IntelEnhancedSpeedStep: DBG Throttle done.
IntelEnhancedSpeedStep: DBG Autothrottle: CPU load 1000 /10 pc
IntelEnhancedSpeedStep: DBG Starting throttle with CTL 0x815

Here is how the hex digits are read:

815 in binary is 1000 0001 0101

First 4 bits represent the frequency ID (multiplier). You would notice that the kext truncates the half multiplier.

FID = 8
8 X 266 = 2128

Next 8 bit represent the voltage ID

VID = 21
Voltage = 21 X 125 + 7125 = 10000 --> 1000mV

This is basically it. I could not think of anything else to post here at the moment.
 

Attachments

  • xnu-speedstep-modified.zip
    122.3 KB · Views: 362

milk242

macrumors 6502a
Jun 28, 2007
694
12
Seems interesting, but I'm wearing of modifying my kexts without fully understanding everything. Are you basically modifying xnu-speedstep?
 

wbyung

macrumors member
Original poster
Jan 16, 2009
36
0
Seems interesting, but I'm wearing of modifying my kexts without fully understanding everything. Are you basically modifying xnu-speedstep?

Yes. I'm modifying the source code of xnu-speedstep.

I am now running at 8.5 X 266 = 2.26GHz at 1.025V.

Full load power consumption is down from 14.2W to 10.5W.

The way xnu-speedstep handles power states is buggy. The highest pstate which is 2.26GHz doesn't show up via sysctl as 2.26GHz but instead 2.12GHz. I found the bug which misread the CPU register. In the original source code it checks if the first bit of the FID is "1". This is not the case in VoodooPower which checks the second bit.

I modified the source code to change the register to 0x4819.

"4" = 0100
"8" = 1000

4 is the "half multiplier"
8 is the multiplier

FID = 72
VID = 25

Then I deleted AppleIntelCPUPowerManagement.kext to remove the Apple's Speedstep implementation.

The end result is not a cooler running mac. In fact I think it's running warmer because Apple tends to put the CPU off the highest state unless CPU load is very high. However I do notice the OSX GUI is a little smoother.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.