ClangBuiltLinux / continuous-integration

Continuous integration of latest Linux kernel with daily build of Clang & LLVM tools
https://travis-ci.com/ClangBuiltLinux/continuous-integration
Apache License 2.0
44 stars 18 forks source link

buildroot: x86: Don't optimize for the corei7 variant #121

Closed nathanchance closed 5 years ago

nathanchance commented 5 years ago

Joel reported in #120 that when passing init=/bin/bash via the kernel cmdline, there is a nice panic that happens on boot due to an invalid opcode. Nick suggested that it was possible that the rootfs was compiled with ISA extensions that aren't supported by QEMU's virtual CPU, which is exactly the case.

When I initially created these images for myself, I selected CONFIG_BR2_x86_corei7=y (as that's what I was using at the time), which selects a bunch of ISA extensions 1:

  config BR2_x86_corei7
      bool "corei7"
      select BR2_X86_CPU_HAS_MMX
      select BR2_X86_CPU_HAS_SSE
      select BR2_X86_CPU_HAS_SSE2
      select BR2_X86_CPU_HAS_SSE3
      select BR2_X86_CPU_HAS_SSSE3
      select BR2_X86_CPU_HAS_SSE4
      select BR2_X86_CPU_HAS_SSE42

I have never noticed a problem because I always use the -cpu host -enable-kvm options, which makes QEMU's CPU emulate the host's (which supported those extensions). QEMU's default cpu "qemu64" only supports SSE3 2, which Buildroot's default target variant "nocona" supports as well. Use that variant and rebuild the images so there are no more issues with init=/bin/bash.

Presubmit: https://travis-ci.com/nathanchance/continuous-integration/builds/99019841

nickdesaulniers commented 5 years ago

Just a thought, but another solution is to always run qemu with the -cpu host -enable-kvm options. Not sure if it slows down the build (doubt that it matters). Thanks for figuring out that my hypothetical was indeed the case, and the report.

nathanchance commented 5 years ago

I don't think -cpu host -enable-kvm works with Travis but I can try later. I think this is a fine solution for right now.

Thanks for the review!