qemu-x86_64 fails on A72 cores, but runs nice on A53 ones :)
#1
I have tried to emulate a chroot for x86_64 architecture and it gave me inconsistent results, random successes and fails:
Code:
jinks /disco2/chroot/amd64 # chroot . /bin/bash
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
root@jinks / # exit
exit
jinks /disco2/chroot/amd64 # chroot . /bin/bash
Instrucción ilegal
jinks /disco2/chroot/amd64 # chroot . /bin/bash
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Violación de segmento
jinks /disco2/chroot/amd64 # chroot . /bin/bash
root@jinks / # ls
Instrucción ilegal
jinks /disco2/chroot/amd64 # bin   dev  home  lib32     media  opt   root  sbin  tmp  var
boot  etc  lib   lib64  mnt    proc  run   sys   usr

jinks /disco2/chroot/amd64 #

Finally I got it to work, by forbidding to run on the last 2 cores:
Code:
jinks /disco2/chroot/amd64 # schedtool -a 0xf -e chroot . /bin/bash
jinks / # ls
bin   dev  home  lib32  media  opt   root  sbin  tmp  var
boot  etc  lib   lib64  mnt    proc  run   sys   usr
jinks / # exit
exit
jinks /disco2/chroot/amd64 #

And it is stable.

A bit more of information:
Code:
# uname -a; qemu-x86_64 --version; gcc --version
Linux jinks 4.4.154 #8 SMP Fri Oct 12 00:42:01 CEST 2018 aarch64 GNU/Linux
qemu-x86_64 version 2.12.1
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc. ...
#2
(10-11-2018, 07:32 PM)guannais Wrote: I have tried to emulate a chroot for x86_64 architecture and it gave me inconsistent results, random successes and fails:
Code:
jinks /disco2/chroot/amd64 # chroot . /bin/bash
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
root@jinks / # exit
exit
jinks /disco2/chroot/amd64 # chroot . /bin/bash
Instrucción ilegal
jinks /disco2/chroot/amd64 # chroot . /bin/bash
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Violación de segmento
jinks /disco2/chroot/amd64 # chroot . /bin/bash
root@jinks / # ls
Instrucción ilegal
jinks /disco2/chroot/amd64 # bin   dev  home  lib32     media  opt   root  sbin  tmp  var
boot  etc  lib   lib64  mnt    proc  run   sys   usr

jinks /disco2/chroot/amd64 #

Finally I got it to work, by forbidding to run on the last 2 cores:
Code:
jinks /disco2/chroot/amd64 # schedtool -a 0xf -e chroot . /bin/bash
jinks / # ls
bin   dev  home  lib32  media  opt   root  sbin  tmp  var
boot  etc  lib   lib64  mnt    proc  run   sys   usr
jinks / # exit
exit
jinks /disco2/chroot/amd64 #

And it is stable.

A bit more of information:
Code:
# uname -a; qemu-x86_64 --version; gcc --version
Linux jinks 4.4.154 #8 SMP Fri Oct 12 00:42:01 CEST 2018 aarch64 GNU/Linux
qemu-x86_64 version 2.12.1
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc. ...

So what is your compiler?
#3
It is GCC 7.3.0.
#4
(10-13-2018, 08:58 AM)guannais Wrote: It is GCC 7.3.0.

Sorry and thanks for that, I haven saw it in above.

I had some problems in the past when I tried to tune compilation process, using both a72 and a53, but not with Quemu..
The Solution I found was , "the common ground", compile for A53..
Then no more problems..

The quemu you are using was compiled by you?

I found some instructions,
https://www.atrixnet.com/compile-qemu-fr...ckinstall/

But they need better tune on configure.ac, they use explicit call, on configure directly..if you tune configure.ac, you could avoid explicit arguments passed to configure.

This is an option, and make some debug, of it.
Probably its duo to A72 being a 3 way superscaler, out of order, with 2 speculative out of order branch's, I think, but I am not sure, about speculation implemented on A72.
I was asking about compiler, because compiler have been receiving a lot of attention because of meltdown and spectre

Compiling it you can have a better, control of whats going on.
#5
Hello guannais,

One thing that ocurred me, looking into gcc 7.3 Documentation..

Try to compile Quemu with:
Code:
-march=armv8-a+crc -mtune=cortex-a72.cortex-a53

In this way code will be optimized for Big.Litle cluster..
#6
(11-01-2018, 01:48 PM)tuxd3v Wrote: Hello guannais,

One thing that ocurred me, looking into gcc 7.3 Documentation..

Try to compile Quemu with:
Code:
-march=armv8-a+crc -mtune=cortex-a72.cortex-a53

In this way code will be optimized for Big.Litle cluster..

Thanks for the performance advice Smile

Since "qemu" recompiles the code on the fly it may be a problem with the code generator for ARM. What is strange is that any A72 core should be binary compatible with any A53 one, just the armv8-a instruction set.

I was compiling with those flags:

Code:
CFLAGS="-march=armv8-a+simd+crc -mtune=cortex-a53 -mfix-cortex-a53-843419 -Os -pipe"
which I inherited from the setup of my Odroid-C2.
#7
Smile 
(11-03-2018, 08:43 PM)guannais Wrote: Thanks for the performance advice [Image: smile.png]

Since "qemu" recompiles the code on the fly it may be a problem with the code generator for ARM. What is strange is that any A72 core should be binary compatible with any A53 one, just the armv8-a instruction set.

I was compiling with those flags:

Code:
CFLAGS="-march=armv8-a+simd+crc -mtune=cortex-a53 -mfix-cortex-a53-843419 -Os -pipe"
which I inherited from the setup of my Odroid-C2.

You welcome,

In theory,
Code:
-march=armv8-a+crypto+crc

Should enable: { "fp asimd" + "aes pmull sha1 sha2" } + { "crc32" }

But if you look into the definitions, that its not clear..
https://code.woboq.org/gcc/gcc/config/aa...s.def.html

So better do a explicit request:

Code:
-march=armv8-a+simd+crypto+crc
This should enable: "fp asimd" } + { "aes pmull sha1 sha2} + { "crc32" }
not sure about: evtstrm : kernel event stream using generic architected timer.. "

I think that landed in gcc 8.x, when you use crypto, it already add fp+simd, but I don't know if its already in stable version.. so I tell him explicitly to use the extensions..


Possibly Related Threads…
Thread Author Replies Views Last Post
  Linux Host - QEMU Android Guest? rik-shaw 0 2,263 07-09-2020, 08:02 PM
Last Post: rik-shaw
  qemu-x86_64 on rockpro? pfremm 3 5,408 05-14-2019, 07:36 AM
Last Post: Crrlow

Forum Jump:


Users browsing this thread: 2 Guest(s)