FORUMS

[Kernel] FPBug: First really stable 4.x kernel for the Galaxy S2 i9100

2,703 posts
Thanks Meter: 4,475
 
By Lanchon, Senior Member on 19th December 2014, 04:47 PM
Post Reply Email Thread
FPBug: Meet the very first stable kernel for the Galaxy S2 i9100, S2 AT&T i777, S2 Epic 4G Touch d710 and Note n7000 since Gingerbread days

Every single Android 4.x kernel for these devices has had a serious bug (FPBug) that randomly corrupts the state of processes, starting with Samsungs's stock ICS and JB and spanning every custom kernel out there newer than Gingerbread.

STATS: 500+ kernel downloads in 2 days, wow!

RELATED: Make sure you check out my TRIM-enabled kernels updated with the FPBug fix.
UPDATE: A fix for FPBug has been merged into CyanogenMod's cm-11.0 branch! The fix has not made it to the stable/cm-11.0 and cm-12.0 branches yet. Changes: this one and the previous 12. Commits: this one and the previous 12. The 20150111 nightlies are the first official CM 11 nightlies to incorporate the fix.
A little bit of history

As Android got more complex, the effects of this bug grew more visible, to the point of making the platform completely unstable for some users. Complex apps would fail for no reason, GSM, 3G and WiFi connectivity would randomly be lost, music playback would stop and require a reboot, camera would fail, internal storage and SD cards would become inaccessible, installed apps would disappear, users would experience battery drain issues ranging from inability to enter deep sleep all the way to phones becoming very hot, and the list goes on and on.

These failures all seemed unrelated and their cause was very hard to track down. Partly because events happened randomly and were not reproducible, but mostly because the bug undermines the very assumptions programmers deal with when creating any kind of code. And so years passed and the common cause of all this pain was never identified. Many ROM developers abandoned the platform out of frustration.

Then finally this past March, when analyzing the random loss of access to storage, user cgx observed a corruption event for the first time, and a connection between all these unrelated issues, sometimes hypothesized, was suddenly found. The corruption seemed to have happened in the stack, but it was later suspected then confirmed that the corruption actually happened directly in the registers of the floating point unit of the CPU. Yet processes that did not use floating point at all were also affected, because the GCC compiler typically spills registers into the FPU and uses FP and NEON instructions for optimization.

These findings allowed the creation of a stopgap fix for the "music bug" that shielded the FUSE process (which manages access to storage) from corruption in the FPU. The fix was widely applied and effectively eliminated all bugs resulting from sudden loss of storage access and returned the platform to pre-Android 4.3 stability levels: ie, sort of stable enough to be used as a daily driver. Later a working detector for the elusive bug was made and it was confirmed that all kernels since Gingerbread were affected (a thing that was already suspected given that the FirefoxOS people had described similar symptoms in 2012 under stock Samsung ICS). Finally enough of a root cause was hypothesized and a fix was worked out. And if this were not good enough news, user Entropy512, the exynos platform hero who saved us all from brickbug, has hinted that official Lollipop from Omni is now a possibility.

A short description of what the fix does can be found here.

Update

User zeitferne worked non-stop throughout this weekend and made amazing progress. He found a couple of missing commits that are apparently needed for the FPU state tracking to work through power state changes, he discovered that the FPU in CPU0 is the one that actually gets the corruption, he found an explanation why this bug never affected the 4412 platform (Galaxy S3, Note 2, etc), he narrowed down the conditions for the corruption, and finally output an alternative patchset that apparently fixes the FPU state restore optimization rather than just disabling it as mine does.

Kernel developers are encouraged to merge his changes in lieu of mine once enough testing is done and @zeitferne green-lights the patches. This is important as it might fix as-of-yet undetected bugs or prevent bugs arising from future changes. In the meantime, eager maintainers can merge my fix which is by now well tested. Users will only see a small (<< 1% ?) performance increase with zeitferne's patchset and don't really need to bother with this; my advice for them would be to wait for the changes to trickle into their kernel of choice. AMAZING JOB ZEI!!!
2nd UPDATE: @zeitferne has green-lit his patchset! Kernel maintainers merging it please take note: 1) Make sure my fix is removed before applying his, otherwise there will be a small performance hit in the resulting kernel. 2) Both our fixes also affect the 4412 platform (i9300, n7100, etc) in slightly different ways, and the effects of this have not been properly tested. I must recommend that some testing be done before distributing FPBug-fixed 4412 kernels. Please report your test results back to this thread.

WARNING: A problem was reported with zeitferne's patchset.

FOLLOW UP: @zeitferne made some changes to his patchset and initial testing looks good.

AND FINALLY: The patchset was merged into cm-11.0! (See this change and the 12 previous ones.)
Downloads

You will find kernels for various CyanogenMod releases, M-snapshots and nightlies here. These kernels are guaranteed to work only with the exact matching version of CM specified in the last part of their filenames. But in reality they should work with most versions of CM that are close enough. (Don't ask me about this, I don't know, I don't even have any of these phones! Just try them and see for yourself if you are feeling a little adventurous.) For other ROMs i expect this fix to be merged in a matter of days after some more testing is done. Please be patient, and KitKat users can flash my music bug fix in the meantime.

FAQ

Q. I have flashed your music bug fix in the past. Can I flash your kernel?
A. Yes! The music bug fix has no downsides. In fact, as a side effect, that fix makes your phone slightly faster and saves some battery so it should be merged in all ROMs IMHO. If you already have it installed leave it in place, but do not flash it again the next time you upgrade the OS. Please do not flash it just for the sake of optimization: since it is based on CM11 M10, it would actually be a downgrade.

XDA:DevDB Information
FPBug-i9100, Kernel for the Samsung Galaxy S II

Contributors
Lanchon
Source Code: https://www.androidfilehost.com/?w=files&flid=22853

Kernel Special Features:

Version Information
Status: Testing

Created 2014-12-19
Last Updated 2015-01-14
The Following 140 Users Say Thank You to Lanchon For This Useful Post: [ View ] Gift Lanchon Ad-Free
19th December 2014, 04:57 PM |#2  
Lanchon's Avatar
OP Senior Member
Thanks Meter: 4,475
 
Donate to Me
More
(reserved)
The Following 8 Users Say Thank You to Lanchon For This Useful Post: [ View ] Gift Lanchon Ad-Free
19th December 2014, 06:05 PM |#3  
Member
Thanks Meter: 21
 
More
Is the BLN included ?

Quote:
Originally Posted by Lanchon

And if this were not good enough news, user Entropy512, the exynos platform hero who saved us all from brickbug, has hinted that official Lollipop from Omni is now a possibility.

It's not about i9100 ? Right ?
19th December 2014, 06:40 PM |#4  
Acid0057's Avatar
Senior Member
Flag Hanover, Ontario
Thanks Meter: 369
 
More
Can't wait till testing is complete and you merge the fix into your trim kernel for the i9100 lanchon. Thanks to all the programmers, testers and commenters in the bug thread for their hard work.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
The Following User Says Thank You to Acid0057 For This Useful Post: [ View ] Gift Acid0057 Ad-Free
19th December 2014, 06:42 PM |#5  
Lanchon's Avatar
OP Senior Member
Thanks Meter: 4,475
 
Donate to Me
More
Quote:
Originally Posted by DarkJohn

Is the BLN included ?


It's not about i9100 ? Right ?

yes, he refers to the i9100 and the n7000
The Following 2 Users Say Thank You to Lanchon For This Useful Post: [ View ] Gift Lanchon Ad-Free
19th December 2014, 06:43 PM |#6  
Lanchon's Avatar
OP Senior Member
Thanks Meter: 4,475
 
Donate to Me
More
Quote:
Originally Posted by DarkJohn

Is the BLN included ?


It's not about i9100 ? Right ?

these are all standard CM kernels. please request features on the CM thread.
The Following 3 Users Say Thank You to Lanchon For This Useful Post: [ View ] Gift Lanchon Ad-Free
19th December 2014, 06:46 PM |#7  
Member
Thanks Meter: 21
 
More
Quote:
Originally Posted by Lanchon

yes, he refers to the i9100 and the n7000

Oh God ! Lollipop
I am anxious
19th December 2014, 07:41 PM |#8  
sharp87's Avatar
Senior Member
Thanks Meter: 414
 
More
@Lanchon thank you very much for ur hard work
The Following 2 Users Say Thank You to sharp87 For This Useful Post: [ View ] Gift sharp87 Ad-Free
19th December 2014, 07:43 PM |#9  
ahmedelhofy's Avatar
Senior Member
Flag Shebin El-Koum
Thanks Meter: 512
 
More
Dammit... Never wanted to use CM again... I think I will have to at least for now until it gets integrated in other kernels

Great Job @Lanchon
The Following User Says Thank You to ahmedelhofy For This Useful Post: [ View ] Gift ahmedelhofy Ad-Free
20th December 2014, 12:38 AM |#10  
Member
Flag Vienna
Thanks Meter: 61
 
More
i never had any GPS problems on my i9100 before ICS. Since JB it has gotten sooooo much worse. I tried atleast 20 different ROMs (JB, KK) and 5 different Navigation Apps. Nothing helps. Currently i am on CM11 M12 Snapshot. Still not better...

Could this kernel also help me with the GPS Problem??
20th December 2014, 12:57 AM |#11  
Senior Member
Flag Kandy
Thanks Meter: 36
 
More
Smile
so no bad battery life any more?
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