New issue
Advanced search Search tips

Issue 807047 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Aug 2
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

OS: Qemu consumes all memory in the system building Mesa

Project Member Reported by evgreen@chromium.org, Jan 29 2018

Issue description

While doing board bringup, I ran into a build error during Mesa that eventually consumes all memory on the machine and then dies.

The kernel that we have built has a symlink loop in it (notice I've gone a couple loops already in this directory path):
ls -la /build/cheza/var/cache/portage/sys-kernel/chromeos-kernel-4_14/source/build/i386/source/build/i386
total 296
drwxr-xr-x 3 evgreen primarygroup   4096 Jan 26 15:22 .
drwxr-xr-x 6 evgreen primarygroup   4096 Jan 25 11:08 ..
-rw-r--r-- 1 evgreen primarygroup 146736 Jan 26 15:22 .config
-rw-r--r-- 1 evgreen primarygroup 139197 Jan 26 15:22 .config.old
-rw-r--r-- 1 evgreen primarygroup    651 Jan 26 15:22 Makefile
drwxr-xr-x 4 evgreen primarygroup   4096 Jan 25 11:07 scripts
lrwxrwxrwx 1 evgreen primarygroup     45 Jan 26 15:22 source -> /mnt/host/source/src/third_party/kernel/v4.14

This becomes problematic when trying to build Mesa. During configure, Mesa runs llvm-config-host, at

/build/cheza/usr/lib/llvm/bin/llvm-config-host

This is a bash file, whose contents are:
#!/bin/bash
qemu-arm -L /build/cheza "${SYSROOT}"/usr/lib/llvm/bin/llvm-config "$@"

The problem is the -L option, defined as:

-L path       QEMU_LD_PREFIX    set the elf interpreter prefix to 'path'


Qemu goes searching for its libraries in /build/cheza, but gets lost in the mirror room of this symlink.

Ideally Qemu should not get this confused about symlink loops, or should allow specifying a narrower set of paths.




 

Comment 1 Deleted

Comment 2 by vapier@chromium.org, Jan 30 2018

upstream qemu says, for better or worse, -L is garbage and should be avoided:
  https://bugs.launchpad.net/qemu/+bug/1245703

although fundamentally, imo the llvm code should be fixed to not mess around with qemu in the first place.  it's kind of crazy nonsense that it does this.
Is there a new workaround for this? Seems like [1] isn't working any longer.

sudo rm -f /build/cheza/lib/modules/4.*/source
sudo rm -f /build/cheza/var/cache/portage/sys-kernel/chromeos-kernel-4_14/source
sudo rm -f /build/cheza/usr/lib/debug/lib/modules/4.*/source

You can try the CL at <https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1135511>, but apparently it broke some builder so not ready to land yet...
Components: Infra>Client>ChromeOS>Build
Status: Started (was: Untriaged)
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 27

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/c177f4f07559271e95d356c2265bb27342ef624d

commit c177f4f07559271e95d356c2265bb27342ef624d
Author: Evan Green <evgreen@chromium.org>
Date: Fri Jul 27 19:12:55 2018

sys-devel/llvm: Build llvm-config-host as a native build binary

Up until now, we've been building a version of LLVM for mesa that
both runs and produces binaries for the target architecture. One
wrinkle of that has been that mesa invokes llvm-config at compile
time to figure out how to compile with LLVM.

So far we've been using Qemu to emulate the ARM version of llvm-config.
This has started to cause problems, since we need to use Qemu's -L option
to point at /build/$BOARD and have llvm-config find its dynamic libraries
properly (probably just the interpreter). When there are symlink loops
in /build/$BOARD (as are created within the kernel build), Qemu gets lost
in an infinite directory traversal.

Emulating llvm-config is a suboptimal solution anyway. This change builds
llvm-config with all the same options as the ARM native compiler, but with
the build machine's CC and friends. This way we can stop with the Qemu
emulation.

BUG= chromium:807047 
TEST=emerge-cheza ./llvm-6.0.0.ebuild; emerge-cheza mesa, observe no more hang
Also ran emerge-betty llvm mesa

Change-Id: I4cda717fa0d0fe4957454c31988250dcd4953b66
Reviewed-on: https://chromium-review.googlesource.com/1135511
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>

[rename] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/sys-devel/llvm/llvm-6.0.0-r2.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa-img/mesa-img-17.1.1.ebuild
[rename] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa-img/mesa-img-17.1.1-r4.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/sys-devel/llvm/llvm-6.0.0.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa/mesa-18.2_pre1.ebuild
[rename] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/libva-amdgpu-driver/libva-amdgpu-driver-18.2_pre1-r2.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/libva-amdgpu-driver/libva-amdgpu-driver-18.2_pre1.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa/mesa-9999.ebuild
[rename] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa/mesa-18.2_pre1-r9.ebuild
[modify] https://crrev.com/c177f4f07559271e95d356c2265bb27342ef624d/media-libs/mesa-img/mesa-img-9999.ebuild

Status: Verified (was: Started)
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 7

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/cc00c0cc1abec1253e322e4fbd35226c4a342ddc

commit cc00c0cc1abec1253e322e4fbd35226c4a342ddc
Author: Evan Green <evgreen@chromium.org>
Date: Tue Aug 07 08:51:14 2018

sys-devel/arc-llvm: Clean up dead function

We recently cleaned up llvm-config-host to not use Qemu in the
main llvm package. It turns out arc-llvm is already doing this.
Remove a couple of functions that got orphaned in the process.

BUG= chromium:807047 
TEST=emerge-betty arc-llvm

Change-Id: Ib7c6400a6f8587dfb7db2b45d87ddcd3aebc5901
Reviewed-on: https://chromium-review.googlesource.com/1142522
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/cc00c0cc1abec1253e322e4fbd35226c4a342ddc/sys-devel/arc-llvm/arc-llvm-5.0.1.ebuild
[add] https://crrev.com/cc00c0cc1abec1253e322e4fbd35226c4a342ddc/sys-devel/arc-llvm/arc-llvm-5.0.1-r1.ebuild

Sign in to add a comment