FORUMS
Remove All Ads from XDA

[MOD][KERNEL] Live OC

715 posts
Thanks Meter: 1,726
 
By Ezekeel, Retired Recognized Developer on 4th October 2011, 01:46 AM
Post Reply Email Thread
We all know Morfic's popular TEUV kernel which features a low maximum frequency of just 880MHz, but still shows an excellent performance. The secret sauce is the increased bus speed of 220MHz compared to the stock frequency of 200MHz. The problem is that every Nexus S behaves differently because of production tolerances for the CPU and not all devices are able to handle this increased bus speed.

Thus it would be nice to have some way for the user to individually adjust the bus speed to match the overclocking capabilities of their device. Unfortunately with TEUV the bus speed has to be defined on compilation time thus the only way would be to release different versions with different bus speeds which, frankly, would be a pain in the ass. So I implemented a way to change the bus speed on-the-fly while the device is running. In contrast to TEUV not only the bus speed for the maximum frequency but for all states is increased by the same percentage (might change this later, especially for the minimum state).

In '/sys/class/misc/liveoc' change the performance by passing a value from 100 to 120 to 'oc_value' (100 = stock performance, 120 = +20% performance; 100 is default). The bus speed and frequencies for all states will be adjusted accordingly.


I am currently running my Nexus with an increased performance +10% using the stock frequencies 100->110, 200->220, 400->440, 800->880 and 1000->1100 and after increasing the voltage for the maximum state by 25mV 30mV everything is working fine without a reboot for 24h now. The battery drain however seems to be pretty high so it might be a good idea to leave the lowest frequency state untouched. Time and your feedback will tell. Seems like the sleep frequency fix also took care of the high battery drain.


Changes to the source: http://www.pastie.org/2634833


BUGFIX:

The sleep frequency is also adjusted according to the selected OC value, so a proper sleep frequency is chosen when the device is suspended.

Bug fix: http://www.pastie.org/2635644


BUGFIX #2:

When OC value is changed, the minimum and maximum frequency limits set by the user are adjusted according to the new frequencies.

Bugfix: http://www.pastie.org/2691219


BUGFIX #3:

Made sure the bus speeds and frequencies are not changed while a frequency change is currently ongoing.

Bugfix: http://www.pastie.org/2710098


BUGFIX #4:

Instead of a spin lock (which leads to problems) we use a mutex to make sure the bus and frequencies are not changed while a frequency change is ongoing.

Bugfix: http://www.pastie.org/2710386


BUGFIX #5:

If no mutex lock can be obtained, an error value is returned to inform the caller that the frequency was not changed.

Bugfix: http://www.pastie.org/2746226


BUGFIX #6:

1. Reverting back to mutex_lock to make sure no important request like enabling/disabling further frequency changes are skipped.
2. The mutex is unlocked before the CPUfreq stats are resetted. With the above modification this seems necessary to avoid lockups when changing the OC value.
3. The frequencies and bus speed are updated only when the selected OC value actually did change.

Bugfix: http://www.pastie.org/2756640


BUGFIX #7:

Maximum OC value increased to 150.

Bugfix: http://www.pastie.org/2768535


No further patches will be published here. I have set up a git repo for all my tweaks. Each mod has its own branch to keep the tweaks cleanly separated and one can simply pull the latest patches from the corresponding branch.

https://github.com/Ezekeel/GLaDOS-nexus-s/tree/liveoc



Thanks to Morfic for his help.
The Following 51 Users Say Thank You to Ezekeel For This Useful Post: [ View ] Gift Ezekeel Ad-Free
4th October 2011, 01:48 AM |#2  
kevinngck1's Avatar
Senior Member
Thanks Meter: 46
 
More
What are creative guy…so many useful mod. Great!!

Sent from my NOOB Nexus S with the poor english by using XDA Premium App
4th October 2011, 01:52 AM |#3  
Igotsanevo4g's Avatar
Senior Member
Flag San Diego
Thanks Meter: 65
 
More
Just when I start to think what else can this guy come out with.. lol

Trying it now

Sent from my Nexus S 4G using Tapatalk
The Following User Says Thank You to Igotsanevo4g For This Useful Post: [ View ] Gift Igotsanevo4g Ad-Free
4th October 2011, 01:53 AM |#4  
kevinngck1's Avatar
Senior Member
Thanks Meter: 46
 
More
Is the liveoc file just included in morfic teuv kernel???

Sent from my NOOB Nexus S with the poor english by using XDA Premium App
4th October 2011, 01:56 AM |#5  
Ezekeel's Avatar
OP Retired Recognized Developer
Thanks Meter: 1,726
 
More
Quote:
Originally Posted by kevinngck1

Is the liveoc file just included in morfic teuv kernel???

Sent from my NOOB Nexus S with the poor english by using XDA Premium App

Morfic's TEUV kernel was the inspiration for this mod. It is not implemented in any kernel yet.
4th October 2011, 04:06 AM |#6  
Ezekeel's Avatar
OP Retired Recognized Developer
Thanks Meter: 1,726
 
More
The first bugfix.

The sleep frequency is also adjusted according to the selected OC value, so a proper sleep frequency is chosen when the device is suspended.

Bug fix: http://www.pastie.org/2635644
4th October 2011, 04:13 AM |#7  
franciscofranco's Avatar
Recognized Developer
Flag Carcavelos
Thanks Meter: 137,510
 
Donate to Me
More
Pretty impressive idea and implementation.

Although I don't have this phone (hope to get one soon as it's for a great price here in Portugal), I stumbled upon this thread and I liked it very much. Keep it up!
4th October 2011, 04:37 AM |#8  
Member
Thanks Meter: 6
 
More
This is eactly what I want!!!
You're my hero
4th October 2011, 04:52 AM |#9  
simms22's Avatar
Recognized Contributor - R.I.P
BROOKLYN!
Thanks Meter: 26,395
 
More
Quote:
Originally Posted by Ezekeel

We all know Morfic's popular TEUV kernel which features a low maximum frequency of just 880MHz, but still shows an excellent performance. The secret sauce is the increased bus speed of 220MHz compared to the stock frequency of 200MHz. The problem is that every Nexus S behaves differently because of production tolerances for the CPU and not all devices are able to handle this increased bus speed.

Thus it would be nice to have some way for the user to individually adjust the bus speed to match the overclocking capabilities of their device. Unfortunately with TEUV the bus speed has to be defined on compilation time thus the only way would be to release different versions with different bus speeds which, frankly, would be a pain in the ass. So I implemented a way to change the bus speed on-the-fly while the device is running. In contrast to TEUV not only the bus speed for the maximum frequency but for all states is increased by the same percentage (might change this later, especially for the minimum state).

In '/sys/class/misc/liveoc' change the performance by passing a value from 100 to 120 to 'oc_value' (100 = stock performance, 120 = +20% performance; 100 is default). The bus speed and frequencies for all states will be adjusted accordingly.


I am currently running my Nexus with an increased performance +10% using the stock frequencies 100->110, 200->220, 400->440, 800->880 and 1000->1100 and after increasing the voltage for the maximum state by 25mV everything is working fine without a reboot for 24h now. The battery drain however seems to be pretty high so it might be a good idea to leave the lowest frequency state untouched. Time and your feedback will tell.


Changes to the source: http://www.pastie.org/2634833


BUGFIX:

The sleep frequency is also adjusted according to the selected OC value, so a proper sleep frequency is chosen when the device is suspended.

Bug fix: http://www.pastie.org/2635644


Thanks to Morfic for his help.


very nice.
i wonder why the increased battery drain. are you still getting similar numbers in setcpu's "time in state" as you were with teuv?
4th October 2011, 04:53 AM |#10  
window7's Avatar
Senior Member
Thanks Meter: 297
 
More
My goodness! Ezekeel! You're just that excellent!
4th October 2011, 04:57 AM |#11  
cdesai's Avatar
Inactive Recognized Developer
Flag IN YOUR HEAD
Thanks Meter: 4,123
 
Donate to Me
More
Nice idea, although I don't have a nexus S, (thanks @tapatalk for showing me this thread)
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes