Bug 8891

Summary: qemuarm64 cannot correctly boot up
Product: [Runtime] General Runtime Reporter: Chen Qi <Qi.Chen>
Component: General RuntimeAssignee: Chen Qi <Qi.Chen>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium+ CC: bogdanx.a.voiculescu, liezhi.yang, ross.burton
Version: 2.1   
Target Milestone: 2.1 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Chen Qi 2016-01-07 01:19:50 UTC
Error message as below:

systemd[1]: systemd 228 running in system mode. (-PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
systemd[1]: unhandled level 1 translation fault (11) at 0xd51c1576f0, esr 0x90000005
pgd = ffffffc018f8f000
[d51c1576f0] *pgd=0000000000000000, *pud=0000000000000000

CPU: 0 PID: 1 Comm: systemd Not tainted 4.1.15-yocto-standard #2
Hardware name: linux,dummy-virt (DT)
task: ffffffc01a8d0000 ti: ffffffc01a8d8000 task.ti: ffffffc01a8d8000
PC is at 0x5588fc2ae0
LR is at 0x5588fc2ac8
pc : [<0000005588fc2ae0>] lr : [<0000005588fc2ac8>] pstate: 00000000
sp : 0000007ff85649c0
x29: 0000007ff85649e0 x28: 0000000000000000 
x27: 00000055890a0000 x26: 00000055890a32a0 
x25: 000528b3d93604f7 x24: 00000055890a2000 
x23: 00000055890a2000 x22: 00000055890a2000 
x21: 00000055890a1000 x20: 0000007ff8565528 
x19: 00000055890a42a0 x18: 0000000000000001 
x17: 0000007f92eeafc0 x16: 00000055890a05f8 
x15: 0000000000000038 x14: 534c495455464c45 
x13: 2d2044494b4c422b x12: 20504d4f43434553 
x11: 2d20345a4c2d205a x10: 582b204c43412b20 
x9 : 0000007ff8563e70 x8 : 0000000000000042 
x7 : 7f7f7f7f7f7f7f7f x6 : 6c1f2f2f32ff284d 
x5 : 00000000000000b0 x4 : 0000000000000010 
x3 : 0000000000000001 x2 : 000000000000001c 
x1 : 0000007f930b76f0 x0 : 00000055890a0000 

systemd[1]: Caught <SEGV>, dumped core as pid 40.
systemd[1]: Freezing execution.


Hi Cris,

I see you've worked on related issues. Do you have any idea about this error?
If you know how to solve it, please just take this bug. If not, I'll work on this problem.

Regards,
Qi
Comment 1 Richard Purdie 2016-01-07 16:21:36 UTC
Is this just with systemd? Autobuilder is showing qemuarm64 is ok?
Comment 2 Ross Burton 2016-01-07 16:22:25 UTC
For reference https://autobuilder.yoctoproject.org/main/builders/nightly-arm64/builds/237 is a sysvinit qemuarm64 passing sanity.
Comment 3 Chen Qi 2016-01-08 03:20:47 UTC
Yes. The problem is only with systemd.
I've verified locally that sysvinit is OK for qemuarm64.

// Qi
Comment 4 Chen Qi 2016-01-19 08:36:27 UTC
The strange thing is if I add a 'printf' statement in the detect_vm() function before the invocation of detect_vm_cpuid(), the target could start up.

=============================================================================
chenqi@pek-hostel-deb01:~/poky/build-systemd/tmp/work/aarch64-poky-linux/systemd/1_228+gitAUTOINC+dd050decb6-r0/git [2] $ git diff src/basic/virt.c
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 1e5d6ee..7a7b38e 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -266,6 +266,8 @@ int detect_vm(void) {
         static thread_local int cached_found = _VIRTUALIZATION_INVALID;
         int r;
 
+        printf("HELLO WORLD\n");
+        log_info("[DEBUG]: 1\n");
         if (cached_found >= 0)
                 return cached_found;
 
==============================================================================

I'm wondering why printf would make such a difference.

// Qi
Comment 5 Chen Qi 2016-01-26 09:44:41 UTC
It seems that the problem is related to binutils.

Khem's patch below could fix it.
https://github.com/kraj/openembedded-core/tree/kraj/binutils-2.26

// Qi
Comment 6 Chen Qi 2016-02-15 06:10:11 UTC
commit c85c54f7f8cf253687464cfbe19cf7f305868578
Author: Khem Raj <raj.khem@gmail.com>
Date:   Sat Jan 30 06:28:38 2016 +0000

    binutils: Upgrade to 2.26
    
    (From OE-Core rev: 86ade2cc2553c942d9526c5323a11ae151653505)
    
    Signed-off-by: Khem Raj <raj.khem@gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 7 Bogdan Alexandru Voiculescu 2016-02-24 12:09:52 UTC
Verified on: 

Build Configuration:
BB_VERSION        = "1.29.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "aarch64-poky-linux"
MACHINE           = "qemuarm64"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0+snapshot-20160224"
TUNE_FEATURES     = "aarch64"
TARGET_FPU        = ""
meta
meta-yocto
meta-yocto-bsp    = "master:36b43b233c841b3c09fc17e04686b4b758780963"


with systemd setup in local.conf

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""