qemu-efi built w/ gcc-6 doesn't boot in KVM mode

Bug #1632875 reported by dann frazier
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
edk2 (Ubuntu)
Fix Released
High
dann frazier
Yakkety
Fix Released
High
dann frazier

Bug Description

qemu-efi_0~20160813.de74668f-1 hangs when booting it in QEMU under KVM, though it does seem to work OK when running fully emulated.

$ cp /usr/share/AAVMF/AAVMF_*.fd /tmp
$ sudo qemu-system-aarch64 -enable-kvm -m 2048 -cpu host -M virt,gic_version=host -nographic -pflash /tmp/AAVMF_CODE.fd -pflash /tmp/AAVMF_VARS.fd
WARNING: Image format was not specified for '/tmp/AAVMF_CODE.fd' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for '/tmp/AAVMF_VARS.fd' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
[hang]

Revision history for this message
dann frazier (dannf) wrote :

I've pushed a branch here that, along with some other cleanups, reverts to using gcc-5 for building qemu-efi:

git://git.launchpad.net/~dannf/ubuntu/+source/edk2 gcc5

tags: added: patch
Changed in edk2 (Ubuntu):
importance: Undecided → High
summary: - qemu-efi built w/ gcc-6 doesn't boot
+ qemu-efi built w/ gcc-6 doesn't boot in KVM mode
dann frazier (dannf)
Changed in edk2 (Ubuntu Yakkety):
status: New → Confirmed
Revision history for this message
Ard Biesheuvel (ard-biesheuvel) wrote :

This may be related to issues we encountered with LTO. Could you use the GCC49 profile instead? The only difference between GCC49 and GCC5 is whether LTO is enabled, they can both be used with a GCC that is in fact 6.x

Revision history for this message
dann frazier (dannf) wrote : Re: [Bug 1632875] Re: qemu-efi built w/ gcc-6 doesn't boot in KVM mode

On Oct 15, 2016 02:35, "Ard Biesheuvel" <email address hidden> wrote:
>
> This may be related to issues we encountered with LTO. Could you use the
> GCC49 profile instead? The only difference between GCC49 and GCC5 is
> whether LTO is enabled, they can both be used with a GCC that is in fact
> 6.x

Thanks Ard!
We actually still do use the GCC49 profile, and that works with gcc-4.9 and
gcc-5, but not with gcc-6. I'm planning on bisecting gcc to try and
understand why.

Indeed, the GCC5 profile with gcc-5 does lead to a early crash in UEFI, and
that goes away if I drop the lto optimizations.

  -dann

> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1632875
>
> Title:
> qemu-efi built w/ gcc-6 doesn't boot in KVM mode
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/1632875/+subscriptions
>
> Launchpad-Notification-Type: bug
> Launchpad-Bug: distribution=ubuntu; sourcepackage=edk2;
component=universe; status=Confirmed; importance=High; assignee=None;
> Launchpad-Bug: distribution=ubuntu; distroseries=yakkety;
sourcepackage=edk2; component=universe; status=Confirmed; importance=High;
assignee=None;
> Launchpad-Bug-Tags: patch
> Launchpad-Bug-Information-Type: Public
> Launchpad-Bug-Private: no
> Launchpad-Bug-Security-Vulnerability: no
> Launchpad-Bug-Commenters: ard-biesheuvel dannf
> Launchpad-Bug-Reporter: dann frazier (dannf)
> Launchpad-Bug-Modifier: Ard Biesheuvel (ard-biesheuvel)
> Launchpad-Message-Rationale: Subscriber
> Launchpad-Message-For: dannf

Revision history for this message
dann frazier (dannf) wrote :

Turns out that a qemu-efi built by gcc master works in KVM mode. So I did some GCC bisecting to try and identify A) What change after GCC 6.2 made it start working again and B) What change occurred between GCC 5 and 6.2 that broke it to begin with.

A) What change after GCC 6.2 made it start working again?
master started working again after:
# first boots commit: [c76c65ae09761b460a9c015112ca03f34aab25ff] 2016-10-13 Richard Biener <email address hidden>

I don't understand this change enough to know why it would have any effect, and it wasn't trivial enough for me to backport it to gcc-6 to test it on it's own.

B) What change occurred between GCC 5 and 6.2 that broke it to begin with?
The breakage started with:
# first bad commit: [e57ef194b2cbbc8f178bdb6259e3bf3d2d4512e3] bb-reorder: Add -freorder-blocks-algorithm= and wire it up

Based on that, I tried rebuilding qemu-efi with both -fno-reorder-blocks and -freorder-blocks-algorithm=stc. Both worked - so perhaps one of them is a better option than reverting to gcc-5.

Revision history for this message
dann frazier (dannf) wrote :

I've pushed a branch w/ the -freorder-blocks-algorithm=stc workaround to:
  git://git.launchpad.net/~dannf/ubuntu/+source/edk2 reorder-blocks

It also includes some other build system fixes/cleanups. I propose we push that to sid & sync to zesty, then cherry pick just the first patch for a yakkety SRU.

dann frazier (dannf)
Changed in edk2 (Ubuntu):
assignee: nobody → dann frazier (dannf)
Changed in edk2 (Ubuntu Yakkety):
assignee: nobody → dann frazier (dannf)
Changed in edk2 (Ubuntu):
status: Confirmed → In Progress
Changed in edk2 (Ubuntu Yakkety):
status: Confirmed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package edk2 - 0~20160813.de74668f-2

---------------
edk2 (0~20160813.de74668f-2) unstable; urgency=medium

  [ dann frazier ]
  * d/p/arm64-reorder-blocks-algorithm.diff: Workaround to fix
    booting in KVM mode. LP: #1632875.
  * debian/rules: Export compiler prefix variable to simplify
    build-qemu-efi target.
  * debian/rules: Make the target dependencies on setup-build explicit.
  * debian/rules: Set the aarch64 toolchain prefix agnostically of the
    toolchain tag being used.
  * debian/rules: Respect EDK2_TOOLCHAIN tag when building ovmf.

 -- Steve Langasek <email address hidden> Wed, 19 Oct 2016 13:07:08 -0700

Changed in edk2 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello dann, or anyone else affected,

Accepted edk2 into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/edk2/0~20160813.de74668f-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in edk2 (Ubuntu Yakkety):
status: Triaged → Fix Committed
tags: added: verification-needed
dann frazier (dannf)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package edk2 - 0~20160813.de74668f-1ubuntu0.1

---------------
edk2 (0~20160813.de74668f-1ubuntu0.1) yakkety; urgency=medium

  * d/p/arm64-reorder-blocks-algorithm.diff: Workaround to fix
    booting in KVM mode. LP: #1632875.

 -- dann frazier <email address hidden> Mon, 24 Oct 2016 15:53:34 -0600

Changed in edk2 (Ubuntu Yakkety):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for edk2 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
dann frazier (dannf) wrote :

Removing gcc from the affected list. Ard recognized this issue as the one fixed by the following:
  https://github.com/tianocore/edk2/commit/8866d337ea9eba258e942585b172d57d39376e70

no longer affects: gcc-6 (Ubuntu Yakkety)
no longer affects: gcc-6 (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.