Enabling IKS after boot crashes Android

Bug #1183781 reported by Tixy (Jon Medhurst)
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro big.LITTLE
Fix Released
High
vishal

Bug Description

If an IKS enabled Android kernel is booted with IKS off and then it is turned on after boot with:

   echo 1 >/sys/kernel/bL_switcher/active

then some seconds later the ActivityManager dies, causing all of Android services to be shutdown and restarted. See attached log. Subsequent toggling of IKS off and on doesn't seem to cause problems again.

I speculate that Android doesn't cope with the change of CPU topology when IKS is first enabled, e.g. the number of cpus goes from 5 to 2 but it could be trying to still get stats for all 5 cpus leading to the array bounds failure in the log.

Observed on the 13.05 release candidate candidate build: https://android-build.linaro.org/builds/~linaro-android/vexpress-linaro-mp/#build=301

Revision history for this message
Tixy (Jon Medhurst) (tixy) wrote :
Revision history for this message
Naresh Kamboju (naresh-kamboju) wrote :

root@android:/ # echo 0 > /sys/kernel/bL_switcher/active
root@android:/ # echo 1 > /sys/kernel/bL_switcher/active
root@android:/ # echo 0 > /sys/kernel/bL_switcher/active
root@android:/ # echo 0 > /sys/kernel/bL_switcher/active naresh-kamboju@hackbox:~$
naresh-kamboju@hackbox:~$

Amit Kucheria (amitk)
Changed in linaro-big-little-system:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
vishal (vishalbhoj) wrote :

Do you have logcat output ?

Revision history for this message
Tixy (Jon Medhurst) (tixy) wrote :

logcat output is in comment #1 but I didn't trim it so it's not obvious where to look. The point where ActivityManager crashes is at the log line which says "W/dalvikvm( 2374): threadid=14: thread exiting with uncaught exception (group=0x40f63930)", i.e. this is the interesting bit...

W/dalvikvm( 2374): threadid=14: thread exiting with uncaught exception (group=0x40f63930)
E/AndroidRuntime( 2374): *** FATAL EXCEPTION IN SYSTEM PROCESS: ActivityManager
E/AndroidRuntime( 2374): java.lang.ArrayIndexOutOfBoundsException: length=8; index=8
E/AndroidRuntime( 2374): at com.android.internal.os.ProcessStats.getCpuSpeedTimes(ProcessStats.java:573)
E/AndroidRuntime( 2374): at com.android.internal.os.ProcessStats.getLastCpuSpeedTimes(ProcessStats.java:546)
E/AndroidRuntime( 2374): at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1734)
E/AndroidRuntime( 2374): at com.android.server.am.ActivityManagerService.batteryNeedsCpuUpdate(ActivityManagerService.java:1786)
E/AndroidRuntime( 2374): at com.android.internal.os.BatteryStatsImpl$MyHandler.handleMessage(BatteryStatsImpl.java:129)
E/AndroidRuntime( 2374): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2374): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2374): at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1480)

Revision history for this message
Naresh Kamboju (naresh-kamboju) wrote :

please find complete log for logcat
https://pastebin.linaro.org/view/154aad23

Revision history for this message
Amit Kucheria (amitk) wrote :

Assigned to Nico to see if this a kernel problem before punting it over to the Android folks.

Changed in linaro-big-little-system:
assignee: nobody → Nicolas Pitre (npitre)
assignee: Nicolas Pitre (npitre) → nobody
Amit Kucheria (amitk)
Changed in linaro-big-little-system:
assignee: nobody → vishal (vishalbhoj)
Revision history for this message
Scott Bambrough (scottb) wrote :

What happens if we try this in an Ubuntu or ALIP image?

Revision history for this message
Tixy (Jon Medhurst) (tixy) wrote : Re: [Bug 1183781] Re: Enabling IKS after boot crashes Android

On Wed, 2013-06-12 at 18:04 +0000, Scott Bambrough wrote:
> What happens if we try this in an Ubuntu or ALIP image?

Linaro doesn't produce those images any more, but I tried an ALIP build
from last year with a kernel I built myself and toggling IKS on and off
whilst poking around with the GUI did seem to cause anything untoward to
happen.

Revision history for this message
vishal (vishalbhoj) wrote :

The issue is only on Android where Activitymanager assumes that the number of operating points and cores won't change and this is causing the crash. I am going to start working on the issue this week.

Revision history for this message
vishal (vishalbhoj) wrote :
Revision history for this message
Tixy (Jon Medhurst) (tixy) wrote :
vishal (vishalbhoj)
Changed in linaro-big-little-system:
status: Confirmed → Fix Committed
Revision history for this message
Scott Bambrough (scottb) wrote :

Will we try and upstream this patchset to Android?

On Thu, Jun 20, 2013 at 6:07 AM, vishal <email address hidden> wrote:

> ** Changed in: linaro-big-little-system
> Status: Confirmed => Fix Committed
>
> --
> You received this bug notification because you are a member of Linaro
> Landing Team: ARM, which is subscribed to the bug report.
> https://bugs.launchpad.net/bugs/1183781
>
> Title:
> Enabling IKS after boot crashes Android
>
> Status in Linaro big.LITTLE:
> Fix Committed
>
> Bug description:
> If an IKS enabled Android kernel is booted with IKS off and then it is
> turned on after boot with:
>
> echo 1 >/sys/kernel/bL_switcher/active
>
> then some seconds later the ActivityManager dies, causing all of
> Android services to be shutdown and restarted. See attached log.
> Subsequent toggling of IKS off and on doesn't seem to cause problems
> again.
>
> I speculate that Android doesn't cope with the change of CPU topology
> when IKS is first enabled, e.g. the number of cpus goes from 5 to 2
> but it could be trying to still get stats for all 5 cpus leading to
> the array bounds failure in the log.
>
> Observed on the 13.05 release candidate candidate build: https
> ://android-build.linaro.org/builds/~linaro-android/vexpress-linaro-
> mp/#build=301
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/linaro-big-little-system/+bug/1183781/+subscriptions
>

--
Scott Bambrough
Technical Director, Member Services
Linaro <http://www.linaro.org>

Changed in linaro-big-little-system:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.