Jump to content

64bit p-state


  • Please log in to reply
128 replies to this topic

#1
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male
As Apple has moved com.apple.unsupported to com.apple.private in 10.6, kernel APIs are not visible from 64bit kexts without Apple's signature. As a result, I could not build 64 bit VoodooPower.

So I split the power management functionality into application and kext, where the kext simply reads/write CPU registers and the application monitors CPU ticks and notifies p-state switching to the kext.
It works in my environment ( Q9300 32/64, Phenom920 32 ). As I do not have Nehalem, I have no idea whether it works with them.

Of course, you do not need this at all if you are comfortable with 32bit ( AMD user has no choice anyway ) or using AppleIntelCPUManagement with DSDT patch. As TSC is not adjusted ( 10.6 kernel has removed rtc_stepping/rtc_stepped ), non-constant TSC CPU ( for example, K8 ) may have bad effect by the clock change.

How to use: Install VoodooPState.kext and launch PStateChanger.app.

The kext is reduced version of VoodooPower 1.2.3 ( by SuperHai ) and it generates the same p-state table. It cannot co-exist with power-management kexts which manipulates p-state (for example, VoodooPower ).

binary and source:
--- 10/20 updated : fixed memory leak & added doc icon option, avoid instant kp on Lynfield ---
ver. 1.0.3
leopard build

--- for Phenom II X6 ( kext only ).
ver. 1.0.4

Source is available (via subversion) at http://osx86drivers.sourceforge.net.

#2
mitch_de

mitch_de

    InsanelyMacaholic

  • Local Moderators
  • 2,880 posts
  • Gender:Male
  • Location:Stuttgart / Germany
Thaks i will try that.
I used voodoo minipower on my C2D in 10.5.
Itried iCPU, but it worked noz 100%. Showed pStates kooekt but didnt trottle or shows trotthling but CPU-X didnt (MSR isnt working in Snow i think).
I will report.

#3
netkas

netkas

    InsanelyMac Legend

  • Developers
  • 616 posts
  • Gender:Male
hehe

I built genericintelcpupm for x32/x64 jsut fine and it links ok against unsupported.kext

just need to use two tricks

but then this kext sometimes gives kp during bootup in x64 :D

#4
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

hehe

I built genericintelcpupm for x32/x64 jsut fine and it links ok against unsupported.kext

just need to use two tricks

but then this kext sometimes gives kp during bootup in x64 :)

How do you get the load of all the cores ?

#5
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts
Is it possible to change the throttling level?

#6
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

Is it possible to change the throttling level?

Not now. How would you like to change ?

As I included source, you can do whatever you want.
If it is p-state max/min or update interval that you want to change, look into AppDelegate and modify them.
If it is voltage max/min, you can tweak them with kext's Info.plist (Intel only).

#7
mitch_de

mitch_de

    InsanelyMacaholic

  • Local Moderators
  • 2,880 posts
  • Gender:Male
  • Location:Stuttgart / Germany
Hi, i will test your new tool soon - i dont forget it ;)
Q: What do you think about that russian iCPU (now named voodoomonitor ) Snow Leo only - do you testet it?
http://www.applelife...
I have source 1.0.3 but it looks that no newer source of that is available (1.0.7)
The bad is, i cant russian, and i got an warning asking there (problem no mV changes seen) in english ;)

i attached the 1.0.3 source and 1.07 voodoomonitor , because you need to be registered to get the DL)
I think that has its ground in superhai´s voodoopower, but i am not sure.

Attached Files



#8
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts

Not now. How would you like to change ?

As I included source, you can do whatever you want.
If it is p-state max/min or update interval that you want to change, look into AppDelegate and modify them.
If it is voltage max/min, you can tweak them with kext's Info.plist (Intel only).


I mean, it there are higher needs it will make the Frequency step up quicker.

At Moment as an Example my Dock lags, it I click a Folder on the Dock it wont rise the Frequency.

#9
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

Hi, i will test your new tool soon - i dont forget it ;)
Q: What do you think about that russian iCPU (now named voodoomonitor ) Snow Leo only - do you testet it?

They have split VoodooPower into kext/app basically based on the same idea as mine.
However, 1.0.3 app does not do anything but monitoring user's slider control and notifying the change to kext. It does not check CPU workload, though later version (VoodooMonitor.app) may do. My app does monitor workload even though the algorithm might be rough.
As far as I understand, the 1.0.3 source is incomplete. For example, GlobalThermal is never initialized but written to msr register and it's scary to test ... forgive me if I am wrong.
I also found that AMD support is missing unlike mine.


I mean, it there are higher needs it will make the Frequency step up quicker.

At Moment as an Example my Dock lags, it I click a Folder on the Dock it wont rise the Frequency.

Solution may be shortening the interval ( currently 500 ms ? ) and lowering the threshold to raise p-state ( 0.8 ) of app.
As kext's looptimer interval is 200, you also may have to change the value .
Please tell me if you find good values by experiment.

Note: by clicking any of p-state values ( p-state tab ), you can stop throttling and fix p-state to a certain level in case you want maximum performance regardless of current state ( for example, in games ). Dock lags disappear by doing so ?

#10
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts

Solution may be shortening the interval ( currently 500 ms ? ) and lowering the threshold to raise p-state ( 0.8 ) of app.
As kext's looptimer interval is 200, you also may have to change the value .
Please tell me if you find good values by experiment.

How to do it? In the source?

Note: by clicking any of p-state values ( p-state tab ), you can stop throttling and fix p-state to a certain level in case you want maximum performance regardless of current state ( for example, in games ). Dock lags disappear by doing so ?

The lag disappears then. It looks the lag appears with the lowest Pstate, 600Mhz for me.

#11
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

How to do it? In the source?


The lag disappears then. It looks the lag appears with the lowest Pstate, 600Mhz for me.

Yeah, you have to modify soruce ( PStateChangerAppDelegate.m ) and build. It is easy.

Loca the line:
updateTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5    target:self    selector:@selector(updateInfo:)    userInfo:nil    repeats:YES] retain];
Change the value "0.5" to "0.2" for shorter interval. Any value less then 0.2 is meaningless unless kext is modified.
To change threshods, locate the code block:
if(autoThrottle){if(load > 0.95){	// up to highest	newState = 0;} else if(load > 0.8){	if(newState > 0)		newState -= 1;} else if(load < 0.4){	newState += 1;} else if(load < 0.1){	// down to lowest	newState = _pstateCount-1; }
Then change the value "0.8" to "0.7", for example. In the case, you also should change "0.4" to "0.35".

600MHz is very low. What's your CPU ?

#12
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts

600MHz is very low. What's your CPU ?

T7250 2Ghz with 7 (0-7) Pstates: 2000-1800-1600-1400-1200-1000-800-600. I disabled the EFI FSB in Info.plist, if its enabled, it gets wrong FSB - 183Mhz.

*With Coolbook it works fine with 600Mhz, the throttling level is set to very high.


With these settings it feels smooth.

scheduledTimerWithTimeInterval:0.2


if(load > 0.95){	// up to highest
			newState = 0;
		} else if(load > 0.1){
			if(newState > 0)
				newState -= 1;
		} else if(load < 0.1){
			newState += 1;
		} else if(load < 0.1){	// down to lowest
			newState = _pstateCount-1;
		}

So the App has to run to get these changed Settings?

#13
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

T7250 2Ghz with 7 (0-7) Pstates: 2000-1800-1600-1400-1200-1000-800-600. I disabled the EFI FSB in Info.plist, if its enabled, it gets wrong FSB - 183Mhz.

*With Coolbook it works fine with 600Mhz, the throttling level is set to very high.


With these settings it feels it smooth.

scheduledTimerWithTimeInterval:0.2


if(load > 0.95){	// up to highest
			newState = 0;
		} else if(load > 0.1){
			if(newState > 0)
				newState -= 1;
		} else if(load < 0.1){
			newState += 1;
		} else if(load < 0.1){	// down to lowest
			newState = _pstateCount-1;
		}

So the App has to run to get these changed Settings?

It's App which does throttling. So, p-state never changes if App is not running. Does p-state change to the lowest with such settings you made ( at workload = 10%, p-state is raised ) ?

#14
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts
It goes to the lowest.

#15
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

It goes to the lowest.

Thanks, I rarely see the highest p-state except for during vide encoding. I will play with thresholds myself.

#16
mitch_de

mitch_de

    InsanelyMacaholic

  • Local Moderators
  • 2,880 posts
  • Gender:Male
  • Location:Stuttgart / Germany
For pstates checking (highest) you can also run geekbench - always much cpu load.

#17
mitch_de

mitch_de

    InsanelyMacaholic

  • Local Moderators
  • 2,880 posts
  • Gender:Male
  • Location:Stuttgart / Germany
Tested pstate with C2D E7300 2.66 GHZ/266MHz*10 OC @ 3.0 GHZ / 333 MHz*9
Works !
BUT , major problem : In Voodoopower or minipower (leo 32 Bit) there is an key in .plist which can set Pstate Limit Highest higher than 0.
Means if set to 1, cpu never will set to P-State 0.
I need this (used with Leo minivoodoopower with success !) because if pstate is set to 0, 10* 333 is much to high = KP. 3330 MHz too high. In my BIOS FSB Multi set to 9.
Can you add this P-State high(low) Limits keys in .plist for usage in the new 64 Bit version too ?
Thanks

Attached Files



#18
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male

Can you add this P-State high(low) Limits keys in .plist for usage in the new 64 Bit version too ?


Thanks.

It is possible to put the limits into application preference rather than kext plist.
I will write some code to save limits, interval and thresholds in preference soon.

#19
hnak

hnak

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 294 posts
  • Gender:Male
I updated the donwload link in my first post.
It supports preference now.

#20
mitch_de

mitch_de

    InsanelyMacaholic

  • Local Moderators
  • 2,880 posts
  • Gender:Male
  • Location:Stuttgart / Germany

I updated the donwload link in my first post.
It supports preference now.


THANKS!

But how can i set that PstateLimit High (fastest) to 1 ?
I started the Pstatechanger, PREFS and changed the P-Min (is that same as PstateLimitHigh in screenshoot i have in voodoopower?) but i only hear "DONG", error beep. If i leave the Pstatechanger and run again the vefore added new values are not saved. I clicked APPLY + SAVE but onl heared the DONG sound.
Also no .plist was created in the preferences (home).

I must have that Pstate Limit before i can load the .kext, because without that KP if short Pstate 0.

Can i put that key (which name ?) in the .kext itself as an workaround ?

Here the screenshoot of my voodoopower .plist, which works perfect chaning that Limit from 0 > 1

Attached Files







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy