Closed sorgelig closed 11 years ago
I disabled the alignment trap on purpose, the architecture should have no issue with non-aligned access.
I'll investigate this further, might be due to how the toolchain generated the code.
Probably, in THUMB mode there won't be a problem since it's aligned at 2. But this part of code is in ARM mode. If you will find a better solution for unaligned access, please post it here.
We should try to move to newer GCC versions. I had tried 4.7 at the beginning of the kernel, but it gave me page faults on the exFat modules which I didn't figure out. 4.8 would be even better.
I read on some unaligned issues which have been fixed in 4.6.3, so I guess I'll test that next.
I've tried 4.6.3 and 4.7.(forgot) compilers and checked code of icmp_echo function. I didn't find anything different there. Anyway, if i understood right, unaligned access trap just intercept exception, read the data (let's say byte by byte) and return it to original code. If it really so, then why don't let this trap to live? It won't affect performance as long as data is aligned. And it's better than reboots ;)
Yes I'm reverting the commit for the time being.
I've got 2 reboots while my phone was sleeping. After looking into /proc/last_kmsg i've found that both times it's been caused by icmp_echo due to unaligned access:
this particular instruction: .text:C058D348 LDMIA R1, {R0,R1}
Of course it cannot read from such address as 0xdfb480ba. I'm not sure if it's usual way to have unaligned data in this structure or not, but i have this issue.
Comparing to Samsung's source, I've found that unaligned access trap is not enabled in Perseus kernel.
Bellow is the patch to fix this issue. I'm not 100% it will be fixed, but i didn't encounter spontaneous reboots since then. I've saw some users on XDA reported about spontaneous reboots while phone is in sleep state. So, most likely they have the same issue as me.