Bug 1187982

Summary: Android Emulator doesn't work on 3.18.3 and above
Product: [Fedora] Fedora Reporter: Sudhir Khanger <sudhir>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: adrian.sandu, drindt, gansalmon, guido.aulisi, itamar, jforbes, jonathan, kernel-maint, madhu.chinakonda, mchehab
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-21 04:52:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
emulator -verbose output when not working
none
emulator -verbose output when working under 3.17.4
none
dmesg on 3.18.7 without nvidia driver
none
dmesg on 3.17.4 without nvidia driver emulator works fine
none
Emulator debug-all on 3.17.4
none
Android 5.0 emulator debug log
none
emulator configuration
none
emulator debug messages
none
Same problem on 3.19.2 gentoo
none
Android 5 API 22 emulator -debug-all on 3.19.3 none

Description Sudhir Khanger 2015-02-01 06:57:19 UTC
Created attachment 986625 [details]
emulator -verbose output when not working

Description of problem: Android Emulator just shows black screen when run on kernel-3.18.3 and kernel-3.18.4 from updates-testing. It works fine in kernel-3.17.4-301.fc21.x86_64.


Version-Release number of selected component (if applicable):


How reproducible:Always


Steps to Reproduce:
1. emulator -avd <image-name>
2.
3.

Actual results: Android Emulator doesn't boot. Just shows a black screen.


Expected results:


Additional info:

Comment 1 Sudhir Khanger 2015-02-01 06:58:23 UTC
Created attachment 986626 [details]
emulator -verbose output when working under 3.17.4

Comment 2 Sudhir Khanger 2015-02-10 05:44:39 UTC
The problem exists on kernel-3.18.5-201.fc21.x86_64 too. Nexus 4 works for API 10 to API 19 but doesn't with API 21. Nexus 5 and 6 aren't working at all. Other hardware profile work too.

Comment 3 Guido Aulisi 2015-02-12 08:47:50 UTC
I'm having the same problem with kernel 3.18.5-101.fc20.x86_64.

Using strace I got these messages looping:

ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = -1 EINTR (Interrupted system call)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn()                          = -1 EINTR (Interrupted system call)
select(27, [11 25 26], [], [], {0, 0})  = 0 (Timeout)
select(27, [11 25 26], [], [], {0, 0})  = 0 (Timeout)
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0
ioctl(16, KVM_RUN, 0)                   = 0

Comment 4 Sudhir Khanger 2015-02-12 09:15:08 UTC
3.18.6-200.fc21.x86_64 from updates-testing also fails to start Android Emulator.

Comment 5 Guido Aulisi 2015-02-18 14:46:21 UTC
3.18.7-100.fc20.x86_64 works with android 4.4.2 on KVM also with google services. I didn't try android 5, but I don't think this is kernel related.

Comment 6 Sudhir Khanger 2015-02-19 07:46:53 UTC
Guido,

Yes, 4.x.x works. 5.0 emulator doesn't work.

5.0 emulator work on 3.17.x but doesn't on 3.18.x series. Any reason you think this is not kernel related?

Comment 7 Justin M. Forbes 2015-02-19 13:42:47 UTC
Sudhir, can you reproduce without the nvidia driver loaded, in an untainted kernel just to rule that out?

Comment 8 Sudhir Khanger 2015-02-19 19:55:23 UTC
Justin,

I installed everything from scratch including Fedora 21, Android Studio, SDK, emulator images, etc. I can also reproduce the problem without Nvidia drivers installed.

On 3.17.4 which comes with Fedora 21 I see connection refused line but it continues but on 3.18.x and 3.19.x it is stuck at he connection refused error.

emulator: Error while connecting to socket '127.0.0.1:1970': 111 -> Connection refused
emulator: ASC 127.0.0.1:1970: Retrying connection. Connector FD = 32
emulator: Error while connecting to socket '127.0.0.1:1970': 111 -> Connection refused
emulator: ASC 127.0.0.1:1970: Retrying connection. Connector FD = 32

Thanks.

Comment 9 Sudhir Khanger 2015-02-19 19:57:00 UTC
Created attachment 993767 [details]
dmesg on 3.18.7 without nvidia driver

Comment 10 Sudhir Khanger 2015-02-19 19:59:48 UTC
Created attachment 993768 [details]
dmesg on 3.17.4 without nvidia driver emulator works fine

Comment 11 Sudhir Khanger 2015-02-19 20:00:49 UTC
Created attachment 993769 [details]
Emulator debug-all on 3.17.4

Comment 12 Sudhir Khanger 2015-03-01 11:30:55 UTC
Problem continues to exist in kernel-4.0.0-0.rc1.git1.2.fc23.x86_64.

Comment 13 Sudhir Khanger 2015-03-01 13:26:06 UTC
Created attachment 996756 [details]
Android 5.0 emulator debug log

I have been trying out kernel post 3.17.4 which came pre-installed. Android 5.0 emulator works with 3.17.8-300.fc21.x86_64. After that we moved to 3.18.x series and it stopped working.

Did we or upstream change anything related to Android 5.0 emulator that comes in your mind that could cause this issue?

Comment 14 Sudhir Khanger 2015-03-12 18:34:22 UTC
Android Emulator API 22 which was released today is a also not working.

Any pointers on how to resolve or pin point this problem would be very much appreciated.

Comment 15 Daniel Rindt 2015-03-22 08:53:21 UTC
After installing kernel-3.19.1-201 everyhing is back working.

Comment 16 Sudhir Khanger 2015-03-22 09:02:55 UTC
@Daniel Rindt Are you sure Android emulator 5.0 and 5.1 work on kernel-3.19.1-201? A while back when I tried Rawhide nodebug kernel-4.0.0-0.rc1.git1.2.fc23.x86_64 it didn't work for me.

Comment 17 Daniel Rindt 2015-03-22 09:29:16 UTC
(In reply to Sudhir Khanger from comment #16)
> @Daniel Rindt Are you sure Android emulator 5.0 and 5.1 work on
> kernel-3.19.1-201? A while back when I tried Rawhide nodebug
> kernel-4.0.0-0.rc1.git1.2.fc23.x86_64 it didn't work for me.

Absolutely, i wouldn't write it then.

Comment 18 Daniel Rindt 2015-03-23 07:28:16 UTC
(In reply to Sudhir Khanger from comment #16)
> @Daniel Rindt Are you sure Android emulator 5.0 and 5.1 work on
> kernel-3.19.1-201? A while back when I tried Rawhide nodebug
> kernel-4.0.0-0.rc1.git1.2.fc23.x86_64 it didn't work for me.

The emulator as said is back working again. But there are quite other issues with the latest kernel. Power saving an usb is just painfully. Same with SATA links which frequently throws issues by writing. Not to forget my ABRT is flooding with MCE stuff which is not to analyze because of empty mcelog. So better stick on 3.17.4-301 for now.

Comment 19 Sudhir Khanger 2015-03-23 07:39:45 UTC
I get MCE warning every 15 minutes. It probably has something to do with your system hardware. I had to uninstall abrt to get rid of those.

Do you use hardware acceleration for your emulators via kvm?

By any chance could you please attach the output of following command.

emulator -avd <image-name> -debug all

Comment 20 Daniel Rindt 2015-03-23 07:50:40 UTC
(In reply to Sudhir Khanger from comment #19)
> I get MCE warning every 15 minutes. It probably has something to do with
> your system hardware. I had to uninstall abrt to get rid of those.

It's not really clear to me whats going on there. This looks to me weird. The device is totally new and works fine. But the logs are getting bigger and bigger with "empty" mcelog messages.

> Do you use hardware acceleration for your emulators via kvm?

Yes with "kvm_intel".

> By any chance could you please attach the output of following command.
> emulator -avd <image-name> -debug all

Attached for you config and debug log as requested.

Comment 21 Daniel Rindt 2015-03-23 07:51:36 UTC
Created attachment 1005230 [details]
emulator configuration

Comment 22 Daniel Rindt 2015-03-23 07:52:03 UTC
Created attachment 1005231 [details]
emulator debug messages

Comment 23 Adrian Sandu 2015-03-31 12:19:53 UTC
Created attachment 1008993 [details]
Same problem on 3.19.2 gentoo

A little bit offtopic (I use another distribution .. don't think it matters though) but I seem to have the same problem ..

Comment 24 Sudhir Khanger 2015-03-31 13:03:28 UTC
Adrian,

Do you still have Android Emulator 5.0 or above not working with Fedora 3.19.x?

BTW I don't think you have to explicitly enable kvm if you had the emulator image created by Android Studio. And neither you want to use emulator64-x86. Simply using 'emulator -avd Nexus_5_API_22' will do the job. Guessing from the name of you emulator image you seem to be using Android Studion.

/opt/android-sdk-update-manager/tools/emulator64-x86 -debug all -verbose -gpu on -netdelay none -netspeed full -avd Nexus_5_API_22 -qemu -enable-kvm -m 1024

Thanks.

Comment 25 Adrian Sandu 2015-03-31 13:10:17 UTC
Sorry for the confusion, I'm on Gentoo ( server ). My desktop ( fedora ) doesn't have issues yet ( haven't upgraded either for a while now ).

I am using Android Studio .. I don't know what emulator version I have though ( emulator -version doesn't yell anything regarded to a version number )

I was wondering if you guys identified the problem .. maybe you can tell me what exactly was so I can try and cherrypick the patch in my kernel ( I compile my own ).

Comment 26 Sudhir Khanger 2015-03-31 13:19:09 UTC
When I said Android emulator version I meant the API_22 part from the Nexus_5_API_22 which you have to choose yourself when creating an emulator image.

Comment 27 Adrian Sandu 2015-03-31 14:16:14 UTC
Ok. Yeah, It was 5.0.1.

Comment 28 Adrian Sandu 2015-03-31 14:39:42 UTC
Also. I too had 3.16.7 without issues then I upgraded to 3.19.2 and the problem appeared. I'm mostly using a Nexus 5 hardware profile with Android API 22 ( Android 5.1 ) and default ( non-google-api ) x86_64 image.

Comment 29 Sudhir Khanger 2015-03-31 17:13:37 UTC
Adrian,

Daniel above commented that he doesn't have this problems with 3.19.x. Are you saying you are not able to get a working Android emulator 5.x on your system running kernel 3.19.2?

Comment 30 Adrian Sandu 2015-03-31 20:25:20 UTC
Yes. That's why I posted my debug log in thr first place.
Also.. Like I said before.. I'm not having this problem on a fedora box.. I'm having it on a gentoo box running a custom build kernel ( with aufs patches and various other tweaks that don't matter in this situation ).

Comment 31 Sudhir Khanger 2015-04-05 19:12:44 UTC
Created attachment 1011206 [details]
Android 5 API 22 emulator -debug-all on 3.19.3

Like @Adrian Sandu I too can confirm that Android emulator 5.0 API 22 is still broken on Fedora running 3.19.3-200.fc21.x86_64

Comment 32 Fedora Kernel Team 2015-04-28 18:32:03 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 21 kernel bugs.

Fedora 21 has now been rebased to 3.19.5-200.fc21.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 22, and are still experiencing this issue, please change the version to Fedora 22.

If you experience different issues, please open a new bug report for those.

Comment 33 Sudhir Khanger 2015-05-01 17:38:08 UTC
The bug still exists on 3.19.5-200.fc21.

Comment 34 Adrian Sandu 2015-05-08 16:32:15 UTC
Same goes for kernel 4.0.1

Comment 35 Adrian Sandu 2015-05-24 17:25:24 UTC
After much bisect .. Here's the conclusion I got to:
It's not a fedora issue. It's a kernel issue. It's been broken since before 3.18.0-rc1 !

Hope this helps !!!


[dexter@localhost linux-stable]$ git bisect bad
d7a2a246a1b5a0b0c803e800019600051e1e6f1a is the first bad commit
commit d7a2a246a1b5a0b0c803e800019600051e1e6f1a
Author: Wanpeng Li <wanpeng.li.com>
Date:   Tue Aug 19 17:04:40 2014 +0800

    KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs
    
    Section 11.11.2.3 of the SDM mentions "All other bits in the IA32_MTRR_PHYSBASEn
    and IA32_MTRR_PHYSMASKn registers are reserved; the processor generates a
    general-protection exception(#GP) if software attempts to write to them". This
    patch do it in kvm.
    
    Signed-off-by: Wanpeng Li <wanpeng.li.com>
    Signed-off-by: Paolo Bonzini <pbonzini>

:040000 040000 bbf87a3fa19f36defb6aea6002be8523b292b160 a4fc4fe26a8872c52f0a858b3082c9efd3edfeca M	arch

[dexter@localhost linux-stable]$ git bisect log
git bisect start
# good: [bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9] Linux 3.17
git bisect good bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
# bad: [f114040e3ea6e07372334ade75d1ee0775c355e1] Linux 3.18-rc1
git bisect bad f114040e3ea6e07372334ade75d1ee0775c355e1
# bad: [35a9ad8af0bb0fa3525e6d0d20e32551d226f38e] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
git bisect bad 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e
# bad: [683a52a10148e929fb4844f9237f059a47c0b01b] Merge tag 'tty-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 683a52a10148e929fb4844f9237f059a47c0b01b
# good: [76272ab3f348d303eb31a5a061601ca8e0f9c5ce] staging: rtl8821ae: remove driver
git bisect good 76272ab3f348d303eb31a5a061601ca8e0f9c5ce
# bad: [e4e65676f272adb63655a2ca95207e8212d282f1] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
git bisect bad e4e65676f272adb63655a2ca95207e8212d282f1
# good: [39520eea198a7fbba35f4c7cffb4323f78455716] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
git bisect good 39520eea198a7fbba35f4c7cffb4323f78455716
# good: [57d104c153d3d6d7bea60089e80f37501851ed2c] ufs: add UFS power management support
git bisect good 57d104c153d3d6d7bea60089e80f37501851ed2c
# skip: [9da48b5502622f9f0e49df957521ec43a0c9f4c1] arm/arm64: KVM: vgic: Fix SGI writes to GICD_I{CS}PENDR0
git bisect skip 9da48b5502622f9f0e49df957521ec43a0c9f4c1
# skip: [7e362919a59e6fc60e08ad1cf0b047291d1ca2e9] arm/arm64: KVM: vgic: Clarify and correct vgic documentation
git bisect skip 7e362919a59e6fc60e08ad1cf0b047291d1ca2e9
# skip: [c1bfb577addd4867a82c4f235824a315d5afb94a] arm/arm64: KVM: vgic: switch to dynamic allocation
git bisect skip c1bfb577addd4867a82c4f235824a315d5afb94a
# bad: [a7c0b07d570848e50fce4d31ac01313484d6b844] KVM: nVMX: nested TPR shadow/threshold emulation
git bisect bad a7c0b07d570848e50fce4d31ac01313484d6b844
# bad: [54ad89b05ec49b90790de814647b244d3d2cc5ca] kvm: x86: fix tracing for 32-bit
git bisect bad 54ad89b05ec49b90790de814647b244d3d2cc5ca
# bad: [592f085847f4ea753586dfe6ce75ba37d5992a45] KVM: emulate: do not return X86EMUL_PROPAGATE_FAULT explicitly
git bisect bad 592f085847f4ea753586dfe6ce75ba37d5992a45
# good: [adfb5d2746bfbe692324bd26a6de05a3a036b38e] KVM: x86: fix check legal type of Variable Range MTRRs
git bisect good adfb5d2746bfbe692324bd26a6de05a3a036b38e
# bad: [1e1b6c26443547b05925ae4a4494884c92eb7d95] KVM: x86: recalculate_apic_map after enabling apic
git bisect bad 1e1b6c26443547b05925ae4a4494884c92eb7d95
# bad: [d7a2a246a1b5a0b0c803e800019600051e1e6f1a] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs
git bisect bad d7a2a246a1b5a0b0c803e800019600051e1e6f1a
# first bad commit: [d7a2a246a1b5a0b0c803e800019600051e1e6f1a] KVM: x86: #GP when attempts to write reserved bits of Variable Range MTRRs

Comment 36 Sudhir Khanger 2015-05-24 17:36:38 UTC
Adrian have you thought about filing a bug report upstream. I would do it myself but I am afraid I might miscommunicate. If you do so please post the report link here. Thanks for looking into it.

Comment 37 Adrian Sandu 2015-05-24 18:22:56 UTC
Sure !

https://code.google.com/p/android/issues/detail?id=174557
https://bugzilla.kernel.org/show_bug.cgi?id=98841

Also mailed the author. Let's hope this gets it fixed.

Comment 38 Sudhir Khanger 2015-05-24 18:24:35 UTC
Thank you.

Comment 39 Adrian Sandu 2015-05-24 18:30:56 UTC
You welcome.
Can you update this bug's version to 22 ?

Comment 40 Adrian Sandu 2015-05-29 15:25:28 UTC
Bug still present in 4.0.4-301.fc22.x86_64

Comment 41 Adrian Sandu 2015-06-26 18:05:08 UTC
Still present in 4.0.5-300.fc22.x86_64

Comment 42 Sudhir Khanger 2015-07-16 03:17:39 UTC
Has anyone tried the fix posted on Android Issue tracker? I don't have a Fedora machine to give it a try.

https://code.google.com/p/android/issues/detail?id=174557#c10

Comment 43 Daniel Rindt 2015-07-16 17:13:54 UTC
I can confirm that replacing the bios.bin fixes the issue.

Comment 44 Sudhir Khanger 2015-07-21 04:52:26 UTC
https://code.google.com/p/android/issues/detail?id=174557#c10

Workaround is already posted and Google will release an updated emulator at some point of time. This is not Fedora bug. I am closing it. Thanks everyone for investigating and helping resolve this issue.