Jump to content

Kext to disable Intel Turbo Boost on Battery Power


qwerty12

Recommended Posts

Thanks for the program. You must be a super ninja to whip that up so quickly :)

 

 

Heh, when working on that I realised how dumb I am...

Re: disable turbo kext

I changed all the options (as you said) and it suceeded in building but when I install it via kext wizard, then repair permissions, reboot. nothing happens, no disabling of the turbo :(

I tried to delete the xCode output folder and start from scratch but it still didnt work. I tried 3 times.

Is the kext actually loading? Does it show up in kextstat?

Re: Battery processor control

I installed using

sudo /Users/nori/Desktop/BatteryProcessorCoreControl

and put in my password but I couldnt see any difference in core count. I am using activity monitors cpu usage window and with both AC in and out I am getting all 8 cores active :(

 

Maybe its a Lion issue? I will test with my 10.8.4 install and see if things work.

Active as in all the cores were just showing up on the screen or active as in all were showing activity? "sysctl -a | grep cpu | grep hw" should show hw.logicalcpu being less than hw.logicalcpu_max if it is working.

Link to comment
Share on other sites

Is the kext actually loading? Does it show up in kextstat?

 

 

your right, i checked kextstat and it is not listed. I assumed kextwizard would have installed it. Sorry I am pretty new to OSX so I dont really know how to diagnose why the kext wouldnt have loaded. I just reran Kext Wizard again, then kextstat and same thing. even though KW is saying the kext was installed successfully.

 

Do you have time to see if you can build it for a 10.7 target? Maybe my xCode settings are not right.

 

Active as in all the cores were just showing up on the screen or active as in all were showing activity? "sysctl -a | grep cpu | grep hw" should show hw.logicalcpu being less than hw.logicalcpu_max if it is working.

 

Sorry, I should have been more clear about the activity monitor. I have attached a pic to show what I mean regarding activity monitor. So with or without AC (after installing with sudo), I can see all 8 cores in use (as per image below). Same also when I tried with the "sysctl" commands you gave, I have the exact same outputs for with or without AC.

hw.ncpu = 8
hw.cpufrequency = 2294000000
hw.availcpu = 8
hw.ncpu: 8
hw.activecpu: 8
hw.physicalcpu: 4
hw.physicalcpu_max: 4
hw.logicalcpu: 8
hw.logicalcpu_max: 8
hw.cputype: 7
hw.cpusubtype: 4
hw.cpu64bit_capable: 1
hw.cpufamily: 1418770316
hw.cpufrequency: 2294000000
hw.cpufrequency_min: 2294000000
hw.cpufrequency_max: 2294000000
hw.cputhreadtype: 1

I ended up contacting the developer for CPUSetter and he build a version for 10.7 and it works perfectly, so if the program you wrote is ML specific, its no problems as I can use CPUSetter instead of instruments now.

post-11143-0-33828900-1374671993_thumb.png

Link to comment
Share on other sites

your right, i checked kextstat and it is not listed. I assumed kextwizard would have installed it. Sorry I am pretty new to OSX so I dont really know how to diagnose why the kext wouldnt have loaded. I just reran Kext Wizard again, then kextstat and same thing. even though KW is saying the kext was installed successfully.

 

I don't remember how to use it but kextutil has some options you can pass to it for verbose output to see why a kext isn't loading.

Do you have time to see if you can build it for a 10.7 target? Maybe my xCode settings are not right.

I can't - Xcode under Mavericks only has the 10.8 and 10.9 SDKs available.

Sorry, I should have been more clear about the activity monitor. I have attached a pic to show what I mean regarding activity monitor. So with or without AC (after installing with sudo), I can see all 8 cores in use (as per image below). Same also when I tried with the "sysctl" commands you gave, I have the exact same outputs for with or without AC.

 

I ended up contacting the developer for CPUSetter and he build a version for 10.7 and it works perfectly, so if the program you wrote is ML specific, its no problems as I can use CPUSetter instead of instruments now.

Thanks. I'm at a loss, then - the code to disable the processor is taken from a book covering OS X Tiger and SleepWatcher does something similar to what the this program does to monitor battery state (and sleep) and it claims to work with 10.7. Maybe it's because I built the binary for 10.8 (I don't seem to have a choice -- or if I do, I certainly can't find the right choices in Xcode). I do have one idea, though. I'll edit this post with another binary you can try in an hour (probably earlier, but an hour at the most).

 

EDIT: See the first post for a working version.

Link to comment
Share on other sites

Like I said earlier, YOU ARE A NINJA!

 

The BatteryProcessorCoreControl.zip works on 10.7.5!!

Do you have any suggestions/hints on making a plist?

 

And after many, many tries with xCode, I successfully built the DisableTurboBoost for Lion :) and it works like a charm!

 

I have attached it for others to enjoy.

 

Thanks so very much for your time and effort on this. I have learned a lot today!

 

Edit: tested and working on probook 4330s i7-2820qm

DisableTurboBoostBattery_Lion.zip

Link to comment
Share on other sites

The BatteryProcessorCoreControl.zip works on 10.7.5!!

Do you have any suggestions/hints on making a plist?

Great! Glad it works for you!

 

Regarding the plist, RehabMan has a simple template here: http://www.tonycrapx86.com/hp-probook/104551-cpu-package-multiplier-can-edit-2.html#post638960

 

If you're running BatteryProcessorCoreControl with arguments (like the one to turn off HT or to keep on more cores), then keep the ProgramArguments array or if not, just remove it and just use a simple Program key:

<key>Program</key>
<string>/path/to/BatteryProcessorCoreControl</string>
I recommend putting the BatteryProcessorCoreControl binary inside /usr/local/bin and setting appropriate permissions and ownership:
sudo chown root:wheel /usr/local/bin/BatteryProcessorCoreControl
sudo chmod 755 /usr/local/bin/BatteryProcessorCoreControl

And after many, many tries with xCode, I successfully built the DisableTurboBoost for Lion :) and it works like a charm!

 

I have attached it for others to enjoy.

 

Thanks so very much for your time and effort on this. I have learned a lot today!

Awesome, thanks a lot for your contribution and for doing what I couldn't. I'll add a link in the first post for those desiring a Lion version :)

Link to comment
Share on other sites

Great! Glad it works for you!

 

Regarding the plist, RehabMan has a simple template here: http://www.tonycrapx86.com/hp-probook/104551-cpu-package-multiplier-can-edit-2.html#post638960

 

If you're running BatteryProcessorCoreControl with arguments (like the one to turn off HT or to keep on more cores), then keep the ProgramArguments array or if not, just remove it and just use a simple Program key:

<key>Program</key>
<string>/path/to/BatteryProcessorCoreControl</string>
I recommend putting the BatteryProcessorCoreControl binary inside /usr/local/bin and setting appropriate permissions and ownership:
sudo chown root:wheel /usr/local/bin/BatteryProcessorCoreControl
sudo chmod 755 /usr/local/bin/BatteryProcessorCoreControl
Awesome, thanks a lot for your contribution and for doing what I couldn't. I'll add a link in the first post for those desiring a Lion version :)

 

Thanks so much for all the hints on creating a plist to get it to start on boot.

 

Everything is now working on boot and the only thing that was a bit tricky for me was the plist but I finally got it.

 

Here is a good link that I followed (for anyone else new to this whole osx thing)

http://nathangrigg.net/2012/07/schedule-jobs-using-launchd/

 

And here is my plist for anyone interested.

 

edit: corrected an error in the string of the plist below as this was not loading in Mavericks.

 

edit2: how to install BatteryProcessorCoreControl:

  1. you will need to show the hidden file location for /usr/local/bin
  2. place program in BatteryProcessorCoreControl binary inside /usr/local/bin if the bin folder is not there, create it.
  3. fix permissions:
  4. sudo chown root:wheel /usr/local/bin/BatteryProcessorCoreControl

    sudo chmod 755 /usr/local/bin/BatteryProcessorCoreControl

  5. Done :)

edit2: how to install ProcessorCoreControl Kextl:

  1. install kext using KextWizard to Extra
  2. copy the plist from below and be sure to name it the same as the string tag but with a .plist at the end and place file in /Library/LaunchDaemons/
  3. fix permissions:
  4. sudo chown 0:0 /Library/LaunchDaemons/org.qwerty12.batteryProcessorCoreControl.plist
  5. reboot and it should be working.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.qwerty12.batteryProcessorCoreControl.plist</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>    
	<key>ProgramArguments</key>
	<array>
    	<string>/usr/local/bin/BatteryProcessorCoreControl</string>
	</array>
</dict>
</plist>


Link to comment
Share on other sites

  • Administrators

Maybe we could extend on this by making a kext that not only disable turboboost but also dualcore and hyper threading ... would be a super-power-safe kext.. up for the task ?

  • Like 1
Link to comment
Share on other sites

 

Thanks so much for all the hints on creating a plist to get it to start on boot.

 

Everything is now working on boot and the only thing that was a bit tricky for me was the plist but I finally got it.

Thanks for finding out it actually works on boot. ;) Slight nitpick: the path to the BatteryProcessorCoreControl is missing its initial forward-slash. I'll point the first post to yours, though, as it's certainly better than my "hints" :-)

Maybe we could extend on this by making a kext that not only disable turboboost but also dualcore and hyper threading ... would be a super-power-safe kext.. up for the task ?

 

 

I tried as it would've been easier for me since the kext was already monitoring battery and sleep states but I couldn't find a documented/public way to turn off the processors when running inside the kernel (if it exists I'm not clever enough to find it and if it doesn't, it just places more maintenance work on me that I'd rather avoid - what if the way processors are turned off internally differs from one OS X version to another?) so I'm sticking with the user space program (which I won't be personally using, but to each their own): kext or program, they both take a little bit of memory and run in the background anyway, so what's the difference? ;)

Link to comment
Share on other sites

the path to the BatteryProcessorCoreControl is missing its initial forward-slash.

 

Fixed as suggested and thanks for that, better to be complete :) and I agree that its nicer to have it as a program rather than a kext, since a person can easily adjust the plist to pass different arguments if desired.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...