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

Search This thread

Lanchon

Senior Member
Jun 19, 2011
2,712
4,462
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
 

Acid0057

Senior Member
Mar 15, 2013
1,009
368
Hanover, Ontario
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
 
  • Like
Reactions: Lanchon

Thindboy

Senior Member
Feb 4, 2012
71
61
Vienna
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??
 

Acid0057

Senior Member
Mar 15, 2013
1,009
368
Hanover, Ontario
so no bad battery life any more?
Yes exactly. With a little more testing a final version should be coming soon. What an awesome Christmas gift!
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??
No it won't solve gps problems. I've had good luck using GPS status https://play.google.com/store/apps/details?id=com.eclipsim.gpsstatus2 and Faster GPS https://play.google.com/store/apps/details?id=org.fastergps from the Google play store. GPS status will download assistance data (A-GPS) and faster GPS setups the proper ntp server for your area. I get fixes in about 10 seconds now.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
 
Last edited:

Zile995

Senior Member
Apr 27, 2014
1,593
1,898
Belgrade
Everything is somehow faster with this kernel. I flashed the music bug fix with this kernel. Waiting for trim kernel, it will further accelerate the phone.
I noticed that the phone is not heated as before.

You're a genius because you've done a lot for us, s2 community ... And we know that you do not own this legendary phone
Thank you @Lanchon

Sent from my GT-I9100 using Tapatalk
 

Alucard

Senior Member
Jul 2, 2012
1,405
238
im not part of the cm team and my crystal ball is acting up lately so i cant answer Q1.

this is a kernel, you need to flash it. please read the downloads section.
OK so FPBug-V1-src.zip is a flashable zip for fpbug fix for every rom stock jb and kk?And cm-11-M10-i9100-music-bug-fix.zip is for cm11 m10 only?

---------- Post added at 12:36 PM ---------- Previous post was at 12:33 PM ----------

Waiting for your review for Spirit ROM once you've flashed it. :D
Im on neatrom now ,will be on kk once a stable kk apolo kernel comes out!
 
Last edited:

Mockingbird

Senior Member
Mar 24, 2012
957
261
Bucharest
What recovery does this kernel has built in? I use 11.15 cm11 custom build my markox and I want to mare sure that I can reflash the rom in a recovery if it screws up. I never used Odin since I got this phone.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 140
    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
    10
    Initial observation :

    ** The phone is not getting hot as it used to get.... I was used to the phone getting hot at its back (especially in the upper part ) when surfing web on 3G... It doesn't seem to heat that much now...

    ** Used 5 different tabs on chrome, all of them were not mobile optimized sites... And the phone didn't hang/freeze at all.. Was used to having problems with Chrome before...

    For Battery performance & overall system performance it's still too early to judge...

    Anyway, Great Job @Lanchon , You're awesome, you're with out a device, and doing all of this... Can't even think of what you gonna when you get you're friend's old device .... Hopefully we get official omni 5.0 now...
    8
    7
    Everything is somehow faster with this kernel. I flashed the music bug fix with this kernel. Waiting for trim kernel, it will further accelerate the phone.
    I noticed that the phone is not heated as before.

    You're a genius because you've done a lot for us, s2 community ... And we know that you do not own this legendary phone
    Thank you @Lanchon

    Sent from my GT-I9100 using Tapatalk
    7
    I think you shouldn't flash music fix if you flashed the kernel

    that is correct!

    WOW!! im amazed! :) is it not clear from the OP that you should NOT flash the music bug fix with this kernel???

    i mean the FAQ isnt long, it has 1 damn question lol!!! :)