Ubuntu 18.04 qemu kvm+gl error

Moderators: mdrjr, odroid

Ubuntu 18.04 qemu kvm+gl error

Unread postby antonyk » Thu Sep 06, 2018 7:53 pm

Hello.

I've installed Ubuntu 18.04 on my odroid xu4, then followed the steps at https://wiki.odroid.com/odroid-xu4/application_note/software/kvm. Recompiled kernel version is 4.14.66, kvm is enabled:
odroid@odroid:~$ dmesg | grep kvm
[ 0.987923] kvm [1]: 8-bit VMID
[ 0.989259] kvm [1]: vgic interrupt IRQ16
[ 0.989590] kvm [1]: Hyp mode initialized successfully
odroid@odroid:~$ uname -a
Linux odroid 4.14.66+ #1 SMP PREEMPT Wed Sep 5 16:04:37 UTC 2018 armv7l armv7l armv7l GNU/Linux

Now I'm trying to run some sort of android os. When I start qemu without KVM, the guest kernel starts fine and prints it's log. But if I enable KVM, qemu just hangs up forever without any output at all.
I've tried it with stock qemu and with recompiled one. I've also tried with taskset and without it. The command line is:
taskset 0x00000010 ~/qemu/arm-softmmu/qemu-system-arm \
-cpu cortex-a15 -enable-kvm \
-machine type=virt \
-append "console=ttyAMA0,38400 init=/init vt.global_cursor_default=0 androidboot.selinux=permissive debug drm.debug=1" \
-m 1536 \
-serial mon:stdio \
-kernel zImage \
-initrd ramdisk.img \
-drive index=0,if=none,id=system,file=system.img,format=raw \
-device virtio-blk-pci,drive=system \
-drive index=1,if=none,id=cache,file=cache.img,format=raw \
-device virtio-blk-pci,drive=cache \
-drive index=2,if=none,id=userdata,file=userdata.img,format=raw \
-device virtio-blk-pci,drive=userdata \
-drive index=3,if=none,id=vendor,file=vendor.img,format=raw \
-device virtio-blk-pci,drive=vendor \
-netdev user,id=mynet,hostfwd=tcp::5555-:5555 \
-device virtio-net-pci,netdev=mynet \
-device virtio-keyboard-pci \
-d guest_errors \
-nodefaults \
-device VGA -display gtk \
$*

(ofc I have to disable -device VGA -display gtk for stock qemu).
Now I assign qemu to cpu 4, which is cortex-a15:
processor : 4
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 102.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc0f
CPU revision : 3


If I set qemu flag "-d all" while running with kvm I get
CPU Reset (CPU 0)
R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=00000000
PSR=40000000 -Z-- A usr26
CPU Reset (CPU 0)
R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=00000000
PSR=400001d3 -Z-- A svc32

and that's all.

Odroid Ubuntu 16 guest, built by instructions on odroid WIKI kvm page, works well though.

What can be the cause? Maybe it is related to virtio?
Last edited by antonyk on Wed Sep 12, 2018 3:33 am, edited 1 time in total.
antonyk
 
Posts: 3
Joined: Thu Sep 06, 2018 7:40 pm
languages_spoken: english
ODROIDs: odroid xu 4

Re: Ubuntu 18.04 qemu kvm error

Unread postby antonyk » Tue Sep 11, 2018 2:12 am

It turns out to be qemu regression. Build of qemu 2.8 with some patches successfully runs KVM, though I have to patch android kernel source to enforce timer's 'clock-frequency' value.
antonyk
 
Posts: 3
Joined: Thu Sep 06, 2018 7:40 pm
languages_spoken: english
ODROIDs: odroid xu 4

Re: Ubuntu 18.04 qemu kvm error

Unread postby antonyk » Wed Sep 12, 2018 3:31 am

After some more research I've found out that guest 'clock-frequency' kernel patch solves KVM-freeze issue even on qemu 2.12 and 3.0. For some reason under qemu 2.11+ non-patched kernel freezes at start, but on qemu 2.8 it has enough time to print message about timer failure.

Now, when I'm trying to run qemu 2.12 with "-device VGA -display gtk,gl=on" I get error about OpenGL (and about exynos_dri.so on older qemu versions). Without graphics guest just crashes after successfull boot (android is very bad at working without graphics).
I can run qemu 3.0 with "-device VGA -display gtk,gl=es", but under qemu 3.0 guest seems to fail mounting virtio drives and hangs.

This means now I have either qemu 2.12 with FileSystem and NO graphics, or qemu 3.0 with graphics and NO FileSystem. :lol:
antonyk
 
Posts: 3
Joined: Thu Sep 06, 2018 7:40 pm
languages_spoken: english
ODROIDs: odroid xu 4


Return to Ubuntu

Who is online

Users browsing this forum: No registered users and 2 guests