qemu, aarch64, binfmt: can the execution speed be improved?
Hello, I followed the instructions at https://nerdstuff.org/posts/ 2020/2020-003_simplest_way_to_create_an_arm_chroot/ and successfully chroot'ed in the generic aarch64 image available at https://archlinuxarm.org/platforms/armv8/generic on a host running x86_64 arch. I installed qemu-user-static and qemu-user-static-binfmt, restarted systemd- binfmt as advised and the chroot worked using arch-chroot. The slow execution speed has been surprising, I would say roughly 10 times slower than on native x86_64 (building a library, 53 mins instead of < 5). I understand that there's an overhead translation instructions for another architecture. qemu is always advertised as a *fast* emulator, so I'm wondering if I'm missing something. I wish to know if there's some way to speed up execution time in the chroot, some magic configuration to apply. That's my first attempt in this direction. Thank you for any input.
On 6/2/24 7:17 PM, SET wrote:
Hello,
I followed the instructions at
https://nerdstuff.org/posts/ 2020/2020-003_simplest_way_to_create_an_arm_chroot/
and successfully chroot'ed in the generic aarch64 image available at
https://archlinuxarm.org/platforms/armv8/generic
on a host running x86_64 arch.
I installed qemu-user-static and qemu-user-static-binfmt, restarted systemd- binfmt as advised and the chroot worked using arch-chroot.
The slow execution speed has been surprising, I would say roughly 10 times slower than on native x86_64 (building a library, 53 mins instead of < 5). I understand that there's an overhead translation instructions for another architecture. qemu is always advertised as a *fast* emulator, so I'm wondering if I'm missing something.
I wish to know if there's some way to speed up execution time in the chroot, some magic configuration to apply. That's my first attempt in this direction.
Thank you for any input.
I do not think you can speed it up. GitHub is using qemu for build actions under the hood and I suppose GitHub have qemu containers optimized as much as possible. If you click on "build matrix" then you will see that compilation times of my C++ project looks similar: https://github.com/BlackZork/mqmgateway/actions/runs/9338661004 Regards, Łukasz
Le mardi 4 juin 2024 17:39:41 UTC+2 Łukasz Michalski a écrit :
you will see that compilation times of my C++ project looks similar:
Yep, it's clear from the Matrix:build times of your project that one should expect this slowness. It's acceptable since it is not native execution, the magnitude is just surprising for a newcomer. I don't know if it's documented somewhere in qemu. Thank you for this clarification.
I repost my reply for the list: Hello, I don't know any magic trick to do what you asked; What I usually do is to use distcc on the guest, and on the host run distccd-armv8. This way you can speed up compilation, though I can't tell you exactly by how much. You are not using native compilation though but cross-compilation this way. You can look at the distcc page on the wiki to know how to compile with distcc with or without makepkg. distccd-alarm-armv8 is available on the AUR. Cheers Le dim. 2 juin 2024 à 21:53, SET <set@nmset.info> a écrit :
Hello,
I followed the instructions at
https://nerdstuff.org/posts/ 2020/2020-003_simplest_way_to_create_an_arm_chroot/
and successfully chroot'ed in the generic aarch64 image available at
https://archlinuxarm.org/platforms/armv8/generic
on a host running x86_64 arch.
I installed qemu-user-static and qemu-user-static-binfmt, restarted systemd- binfmt as advised and the chroot worked using arch-chroot.
The slow execution speed has been surprising, I would say roughly 10 times slower than on native x86_64 (building a library, 53 mins instead of < 5). I understand that there's an overhead translation instructions for another architecture. qemu is always advertised as a *fast* emulator, so I'm wondering if I'm missing something.
I wish to know if there's some way to speed up execution time in the chroot, some magic configuration to apply. That's my first attempt in this direction.
Thank you for any input.
Here is some data. I compiled the driver from the repo at https://github.com/aircrack-ng/rtl8812au x86_64 (the host with cpu=i5-8500): 43s `make -j4` arm7h (qemu/systemd-nspawn): 33m `make` arm7h (qemu/systemd-nspawn): 7m44s `make -j4` arm7h (qemu/systemd-nspawn): 2m47s `make -j4 CC=distcc CXX=distcc` arm7h (rpi3b, native): 23m `make` arm7h (rpi3b, native): 8m40s `make -j4` Le mar. 4 juin 2024 à 19:42, solsTiCe d'Hiver <solstice.dhiver@gmail.com> a écrit :
I repost my reply for the list:
Hello,
I don't know any magic trick to do what you asked;
What I usually do is to use distcc on the guest, and on the host run distccd-armv8.
This way you can speed up compilation, though I can't tell you exactly by how much. You are not using native compilation though but cross-compilation this way.
You can look at the distcc page on the wiki to know how to compile with distcc with or without makepkg. distccd-alarm-armv8 is available on the AUR.
Cheers
Le dim. 2 juin 2024 à 21:53, SET <set@nmset.info> a écrit :
Hello,
I followed the instructions at
https://nerdstuff.org/posts/ 2020/2020-003_simplest_way_to_create_an_arm_chroot/
and successfully chroot'ed in the generic aarch64 image available at
https://archlinuxarm.org/platforms/armv8/generic
on a host running x86_64 arch.
I installed qemu-user-static and qemu-user-static-binfmt, restarted systemd- binfmt as advised and the chroot worked using arch-chroot.
The slow execution speed has been surprising, I would say roughly 10 times slower than on native x86_64 (building a library, 53 mins instead of < 5). I understand that there's an overhead translation instructions for another architecture. qemu is always advertised as a *fast* emulator, so I'm wondering if I'm missing something.
I wish to know if there's some way to speed up execution time in the chroot, some magic configuration to apply. That's my first attempt in this direction.
Thank you for any input.
participants (3)
-
SET
-
solsTiCe d'Hiver
-
Łukasz Michalski