[JB+][3.0.8/2.6.32 kernel] CM10.1 Android 4.2.2 for the Defy(+)

Blechd0se

Inactive Recognized Developer
Sep 19, 2012
459
4,507
0
Stuttgart
Hello guys,

i wanted to share some information here about trim. Many of you encountered problems with my new kernel, however i have seen no
useful log (its not your fault, i just had to point out how to give logs properly).
I spend a lot of time debugging it and figuring out why it works for some and for some not.
Here is my kernel log, in case you want to see/learn something about that.

My investigation is, that trim only crashes on startup. In the first ~2 minutes the system load is around 100%, if the discard option
is enabled or if trim gets executed in this window its likely that the kernel crashes (see log how exactly).
I went through all upstream patches and merged them in, however this couldn't fix the problem.

So i am assuming there must be some deadlock/race condition in those 2 minutes where trim tries to access /data while
another process tries exactly the same.
So i decided to write my own patch for this; patch on github

Now the funny things; trim works now on bootup for me, no crashes / no kernel panic,
however while its trimming you shouldn't interact with the device itself to be sure.
Actually this might be a huge deal, have a look at the current mainline kernel here .

It doesn't seem that its fixed there. This either means my patch won't work or they fixed it otherwise or (and thats the point)
it isn't fixed on upstream. If its the last case this could be my first contribution to upstream.

I just wanted to share this (since its a development thread after all) and want to hear some thoughts about this (developers are welcome!).
I don't know if this fixes everything, i have tested it only on 4.2 with the method mentioned above.

Maybe someone might have some ideas about that. Any feedback is highly appreciated! :)
 

niksy+

Senior Member
Jan 16, 2012
1,357
1,082
0
Blechd0se, I can only confirm what you said... I've experienced reboots when trying to use the phone right after booting (while it's still loading widgets in the launcher, for example), but I failed to acquire the last_kmsg log :/ I'm on 4.3 (CM10.2, the 31st of August build by carlo)

Other than that, the fstrim command in Terminal worked fine for me, so I guess trim is working fine (on my phone) except that problem with the possible deadlock.

Could you create a .txt file with the list of the logs (along with a short how-to on getting them) that we can (and should) provide and put it up on your site?
 

Blechd0se

Inactive Recognized Developer
Sep 19, 2012
459
4,507
0
Stuttgart
Blechd0se, I can only confirm what you said... I've experienced reboots when trying to use the phone right after booting (while it's still loading widgets in the launcher, for example), but I failed to acquire the last_kmsg log :/ I'm on 4.3 (CM10.2, the 31st of August build by carlo)

Other than that, the fstrim command in Terminal worked fine for me, so I guess trim is working fine (on my phone) except that problem with the possible deadlock.

Could you create a .txt file with the list of the logs (along with a short how-to on getting them) that we can (and should) provide and put it up on your site?
Yes i can do some sort of how to debug on the defy, at least the very basic steps :)
Will do this tomorrow. I can also release another kernel to test my changes, if desired.
This will also include some performance updates on ext4 driver and trim :)
 

atulclassic

Senior Member
Feb 20, 2013
1,099
916
113
Mumbai
After running the ROM for a few days, I found that the phone didn't sleep at all after switching off data. I had a massive battery drop. BBS showed nothing except some entries under kernel wakelock - SCIM and GKI_LOCK_TIMER. Toggling airplane mode on and off 're-enabled' deep sleep. I've experienced this problems on all AeroKernel ROMs, mainly CM10.1 and Slimbean. Speaking of apps the only app installed was Whatsapp, as my defy+ has become my secondary phone.

Sent from my MB526 using xda app-developers app
toggling airplane mode helped me resolving deep sleep issue..thanks buddy!!!

---------- Post added at 10:52 AM ---------- Previous post was at 10:25 AM ----------
 

ccav2000

Senior Member
Dec 19, 2010
2,057
1,122
0
Manga Cafe
Slight OT, @Quarx just stated in Facebook that he will resume development soon, as soon as he has access to his development PC again.

---------- Post added at 08:47 AM ---------- Previous post was at 08:34 AM ----------

Hello guys,

i wanted to share some information here about trim. Many of you encountered problems with my new kernel, however i have seen no
useful log (its not your fault, i just had to point out how to give logs properly).
I spend a lot of time debugging it and figuring out why it works for some and for some not.
Here is my kernel log, in case you want to see/learn something about that.

My investigation is, that trim only crashes on startup. In the first ~2 minutes the system load is around 100%, if the discard option
is enabled or if trim gets executed in this window its likely that the kernel crashes (see log how exactly).
I went through all upstream patches and merged them in, however this couldn't fix the problem.

So i am assuming there must be some deadlock/race condition in those 2 minutes where trim tries to access /data while
another process tries exactly the same.
So i decided to write my own patch for this; patch on github

Now the funny things; trim works now on bootup for me, no crashes / no kernel panic,
however while its trimming you shouldn't interact with the device itself to be sure.
Actually this might be a huge deal, have a look at the current mainline kernel here .

It doesn't seem that its fixed there. This either means my patch won't work or they fixed it otherwise or (and thats the point)
it isn't fixed on upstream. If its the last case this could be my first contribution to upstream.

I just wanted to share this (since its a development thread after all) and want to hear some thoughts about this (developers are welcome!).
I don't know if this fixes everything, i have tested it only on 4.2 with the method mentioned above.

Maybe someone might have some ideas about that. Any feedback is highly appreciated! :)
Yep, I did notice on your GitHub. On a personal note, I will soon move again to CM10.1 (maybe even today), since the DEFY will become my secondary device (ordered a new device already). So I will be able to test things more freely, having the DEFY as primary restricts me a lot to how far I can go, since I absolutely need it to work. Waiting for a test kernel now!
 

overclockthesun

Senior Member
Jul 29, 2011
431
270
0
Mumbai (Bombay)
Hello guys,

i wanted to share some information here about trim. Many of you encountered problems with my new kernel, however i have seen no
useful log (its not your fault, i just had to point out how to give logs properly).
I spend a lot of time debugging it and figuring out why it works for some and for some not.
Here is my kernel log, in case you want to see/learn something about that.

My investigation is, that trim only crashes on startup. In the first ~2 minutes the system load is around 100%, if the discard option
is enabled or if trim gets executed in this window its likely that the kernel crashes (see log how exactly).
I went through all upstream patches and merged them in, however this couldn't fix the problem.

So i am assuming there must be some deadlock/race condition in those 2 minutes where trim tries to access /data while
another process tries exactly the same.
So i decided to write my own patch for this; patch on github

Now the funny things; trim works now on bootup for me, no crashes / no kernel panic,
however while its trimming you shouldn't interact with the device itself to be sure.
Actually this might be a huge deal, have a look at the current mainline kernel here .

It doesn't seem that its fixed there. This either means my patch won't work or they fixed it otherwise or (and thats the point)
it isn't fixed on upstream. If its the last case this could be my first contribution to upstream.

I just wanted to share this (since its a development thread after all) and want to hear some thoughts about this (developers are welcome!).
I don't know if this fixes everything, i have tested it only on 4.2 with the method mentioned above.

Maybe someone might have some ideas about that. Any feedback is highly appreciated! :)

@Blechd0se I agree. as you may have seen from my screenshots, trim works now.

But I tried various combinations to get back my error and this is what I found.

TRIM will not work for me "if" and if only I flash to JB 4.2 directly from Froyo (SEA in my case).

But if I first flash CM7.2 and then flash JB over it ...perfect :) It does work perfectly. Oh and even I noticed that if the cpu is under load the system crashes and reboots abruptly. Ditto for doing any other work while TRIM is running. Just opening file manager caused a crash for me.

I can provide logcats but unfortunately all my previous logs are lost. For some strange reason my sdcard got corrupted 3 times in last 3 days. Thats maybe because I am trying to get the Swap partition working.

One question Blech, does TRIM invoke itself automatically by some parameters or do we have to always run it manually in terminal.
 
  • Like
Reactions: okij

cyrusct82

Senior Member
Aug 22, 2010
1,576
730
143
Constanţa
Oh! my data was corrupted today after reboot. Can i recover data or data is corrupted at all ?

P.s. i don't use swap
Has anyone thinked that those data losses are from ext4 format. I'm on ext3 and never got a data loss.
Every time I formatted to ext 4 I've got boot loops and problems like apps FC.

Sent from my MB526 using xda app-developers app
 
  • Like
Reactions: claudiobastos

hotdog125

Senior Member
Sep 19, 2012
992
405
0
Bangalore
Has anyone thinked that those data losses are from ext4 format. I'm on ext3 and never got a data loss.
Every time I formatted to ext 4 I've got boot loops and problems like apps FC.

Sent from my MB526 using xda app-developers app
I got data corruption at uptime approx. 24-32 hours atleast 3-4 times with 31.08 kernel. No such problem on 25.08 kernel.
 

trurl3

Senior Member
Apr 12, 2011
984
236
0
Warszawa
i recover all data and copy to PC. Then format sd and copy files to sd back. But now defy don't boot with sd. If i remove sd it boot successfully.
With SD i only see red M and i can't start boot menu :(
Try to reformat SD and boot your Defy with empty SD card. I'm affraid recovered data are not suitable...
 

hotdog125

Senior Member
Sep 19, 2012
992
405
0
Bangalore
I tried decompiling SystemUI.apk to mod it. I got errors decompiling only on CM10 and CM10.1 quarx build. Unofficial builds and other ROMs based on CM could decompile with no problem. What could be wrong?

The log-
c:\apktool>apktool d SystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Shashank\apktool\framework\1.apk
I: Loaded.
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x0108066b
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x0108066b
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x0108066c
W: Could not decode attr value, using undecoded value instead: ns=android, name=
drawable, value=0x0108066c
I: Decoding values */* XMLs...
I: Done.
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x0108066b
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:62)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResSca
larValue.java:44)
at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:4
0)
at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlRe
sourceParser.java:313)
at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValu
e(XmlPullParserDelegate.java:69)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartT
ag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(Stati
cXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamD
ecoder.java:80)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDe
coder.java:130)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamD
ecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:1
07)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:9
1)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:238
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
 
Last edited:

thekguy

Senior Member
Nov 13, 2009
845
252
0
Mumbai
Copy framework-res.apk from build to the directory, and before decoding run the command "apktool if framework-res.apk"
Try in a new directory as well, copying only apktool and necessary files to it.
What exactly are you modding?

Sent from my MB526 using Tapatalk 2
 
Last edited:

hotdog125

Senior Member
Sep 19, 2012
992
405
0
Bangalore
Copy framework-res.apk from build to the directory, and before decoding run the command "apktool if framework-res.apk"
What exactly are you modding?

Sent from my MB526 using Tapatalk 2
That's the first thing I tried after I got the error. Still didn't work. I wanted to mod the clock in the status bar to show seconds.
What's weird is that it decompiles fine on sunnyqeen's and carlo93's builds and other ROMs based on CM.