Bug 206789 - exit_boot() failed efi_main() failed then hangs
Summary: exit_boot() failed efi_main() failed then hangs
Status: NEW
Alias: None
Product: EFI
Classification: Unclassified
Component: Boot (show other bugs)
Hardware: All Linux
: P1 blocking
Assignee: EFI Virtual User
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-08 11:27 UTC by Hugo Oosterkamp
Modified: 2020-04-15 17:35 UTC (History)
4 users (show)

See Also:
Kernel Version: 5.6.0-rc4-next-20200305-1.gif4ad99-vanilla
Tree: Mainline
Regression: No


Attachments
screenshot with external camera (4.38 MB, image/jpeg)
2020-03-08 11:27 UTC, Hugo Oosterkamp
Details
Print error messages (1.48 KB, patch)
2020-03-08 17:15 UTC, Arvind Sankar
Details | Diff

Description Hugo Oosterkamp 2020-03-08 11:27:56 UTC
Created attachment 287829 [details]
screenshot with external camera

Aus VIVOBOOK x512 AMD r5, opensuse TW with 5.6 rc4 repo

Dual boot system with multiple kernel flavors. After installing rc4 I did a bootup. system hangs with exit_boot() failed, efi_main() failed (see attachment)
Manual turn off, restart system and the booting option screen does not show up, instead boots straight up in windows.
Back into the bios to change the boot sequence and able to boot up again but this time in 5.5. No problems in 5.5
Comment 1 Arvind Sankar 2020-03-08 17:15:12 UTC
Created attachment 287831 [details]
Print error messages

Hi, can you try with this patch to try to drill down exactly where it fails?

Thanks
Comment 2 Arvind Sankar 2020-03-18 14:57:45 UTC
Hi Hugo, are you still having this issue with 5.6-rc? If so, could you attach the kernel (5.6) config, and dmesg log and lspci output from 5.5?

Thanks
Comment 3 Jerome C 2020-04-01 12:42:54 UTC
Hi

Arvind Sankar, I too having the same issue.

I've tried it with secure boot enabled/disabled and same result

I use Arch Linux and compiled kernel 5.6.0 ( in their testing repository ) using gcc 9.3.0 ( arch version 9.3.0-1 64bit ) with your patch

I've tried this on two platforms ( both AMD )

Laptop: HP Pavilion Laptop 15-cw1507sa
CPU+GPU: AMD Ryzen 5 3500U
BIOS: F.42 Rev.A ( latest as of 1-4-2020 )

Secure boot enabled with custom keys and tells me

EFI stub: UEFI Secure Boot is enabled.
Failed in exit_boot_services
exit_boot() failed!
efi_main() failed!

Desktop:
Mobo: Asus Prime X570-PRO
CPU: AMD Ryzen 9 3950x
BIOS: 1405 ( latest as of 1-4-2020 )
RAM: 32gb ( 8gb x 4 ) at 3600MHz
GPU: MSI Radeon RX 5700 XT Evoke OC

Secure boot disabled and tells me

Failed in exit_boot_services
exit_boot() failed!
efi_main() failed!
Comment 4 Ard Biesheuvel 2020-04-01 12:45:26 UTC
(In reply to Jerome C from comment #3)
> Hi
> 
> Arvind Sankar, I too having the same issue.
> 
> I've tried it with secure boot enabled/disabled and same result
> 
> I use Arch Linux and compiled kernel 5.6.0 ( in their testing repository )
> using gcc 9.3.0 ( arch version 9.3.0-1 64bit ) with your patch
> 
> I've tried this on two platforms ( both AMD )
> 
> Laptop: HP Pavilion Laptop 15-cw1507sa
> CPU+GPU: AMD Ryzen 5 3500U
> BIOS: F.42 Rev.A ( latest as of 1-4-2020 )
> 
> Secure boot enabled with custom keys and tells me
> 
> EFI stub: UEFI Secure Boot is enabled.
> Failed in exit_boot_services
> exit_boot() failed!
> efi_main() failed!
> 
> Desktop:
> Mobo: Asus Prime X570-PRO
> CPU: AMD Ryzen 9 3950x
> BIOS: 1405 ( latest as of 1-4-2020 )
> RAM: 32gb ( 8gb x 4 ) at 3600MHz
> GPU: MSI Radeon RX 5700 XT Evoke OC
> 
> Secure boot disabled and tells me
> 
> Failed in exit_boot_services
> exit_boot() failed!
> efi_main() failed!

Hello Jerome,

Can you try with Arvind's patch applied, please?

Also, what is your setting for CONFIG_EFI_DISABLE_PCI_DMA? What happens if you add efi=no_disable_early_pci_dma to the kernel command line?
Comment 5 Jerome C 2020-04-01 12:46:40 UTC
Hi, I stated that I've already tried the patch... I'll get back to you on the "efi=no_disable_early_pci_dma"
Comment 6 Jerome C 2020-04-01 12:51:25 UTC
Hi, It's booted with "efi=no_disable_early_pci_dma" set on my desktop, not tested it on my laptop yet
Comment 7 Ard Biesheuvel 2020-04-01 13:09:29 UTC
(In reply to Jerome C from comment #6)
> Hi, It's booted with "efi=no_disable_early_pci_dma" set on my desktop, not
> tested it on my laptop yet

OK, thanks for checking. As the Kconfig documentation states, CONFIG_EFI_DISABLE_PCI_DMA is not intended for general use, which is why it is disabled by default.
Comment 8 Jerome C 2020-04-01 13:16:26 UTC
Hiya,

I forgot to mention

CONFIG_EFI_DISABLE_PCI_DMA is not enabled in my kernel config

I've just testing the "efi=no_disable_early_pci_dma" on my laptop as well and now boots there too

Thanks for your help.

If you need any other info, let me know as I think it maybe a deeper problem than just the "efi=no_disable_early_pci_dma"

I have no Intel processors
Comment 9 Ard Biesheuvel 2020-04-01 13:20:41 UTC
(In reply to Jerome C from comment #8)
> Hiya,
> 
> I forgot to mention
> 
> CONFIG_EFI_DISABLE_PCI_DMA is not enabled in my kernel config
> 
> I've just testing the "efi=no_disable_early_pci_dma" on my laptop as well
> and now boots there too
> 

Excellent. But efi=no_disable_early_pci_dma is the default unless you set CONFIG_EFI_DISABLE_PCI_DMA=y, so this is a bit surprising.

> Thanks for your help.
> 
> If you need any other info, let me know as I think it maybe a deeper problem
> than just the "efi=no_disable_early_pci_dma"
> 

To be honest, it seems pretty obvious to me that the way efi_pci_disable_bridge_busmaster() rummages around in UEFI's driver protocol database is causing ExitBootServices() to fail. The only mystery here is why it is called in your case, since you don't have CONFIG_EFI_DISABLE_PCI_DMA defined, nor efi=disable_early_pci_dma passed on the command line.
Comment 10 Hugo Oosterkamp 2020-04-01 13:25:04 UTC
loading 5.6.0-1.g4de1111-vanilla ...
error: bad shim signature.
loading initial ramdisk ...
error: you need to load the kernel first.

press any key to continue...
Comment 11 Hugo Oosterkamp 2020-04-01 13:26:33 UTC
with 
efi=no_disable_early_pci_dma

it starts up without any issues

Correction this time working on a YOGA 910 (INTEL BOX...)
Comment 12 Ard Biesheuvel 2020-04-01 13:27:37 UTC
(In reply to Hugo Oosterkamp from comment #11)
> with 
> efi=no_disable_early_pci_dma
> 
> it starts up without any issues
> 
> Correction this time working on a YOGA 910 (INTEL BOX...)

Thanks for the data point. Could you share your kernel config please?
Comment 13 Hugo Oosterkamp 2020-04-01 13:28:12 UTC
(In reply to Hugo Oosterkamp from comment #10)
> loading 5.6.0-1.g4de1111-vanilla ...
> error: bad shim signature.
> loading initial ramdisk ...
> error: you need to load the kernel first.
> 
> press any key to continue...

Can't load a camera made screenshot bu the above is accurate
Comment 14 Jerome C 2020-04-01 13:34:37 UTC
(In reply to Ard Biesheuvel from comment #9)
> (In reply to Jerome C from comment #8)
> > Hiya,
> > 
> > I forgot to mention
> > 
> > CONFIG_EFI_DISABLE_PCI_DMA is not enabled in my kernel config
> > 
> > I've just testing the "efi=no_disable_early_pci_dma" on my laptop as well
> > and now boots there too
> > 
> 
> Excellent. But efi=no_disable_early_pci_dma is the default unless you set
> CONFIG_EFI_DISABLE_PCI_DMA=y, so this is a bit surprising.
> 
> > Thanks for your help.
> > 
> > If you need any other info, let me know as I think it maybe a deeper
> problem
> > than just the "efi=no_disable_early_pci_dma"
> > 
> 
> To be honest, it seems pretty obvious to me that the way
> efi_pci_disable_bridge_busmaster() rummages around in UEFI's driver protocol
> database is causing ExitBootServices() to fail. The only mystery here is why
> it is called in your case, since you don't have CONFIG_EFI_DISABLE_PCI_DMA
> defined, nor efi=disable_early_pci_dma passed on the command line.

This got me puzzled too as I've been grep the kernel source code and seeing that the variable "efi_disable_pci_dma" inside "drivers/firmware/efi/libstub/efi-stub-helper.c" is "static"

I don't understand it myself either
Comment 15 Ard Biesheuvel 2020-04-01 13:38:25 UTC
(In reply to Jerome C from comment #14)
> (In reply to Ard Biesheuvel from comment #9)
> > (In reply to Jerome C from comment #8)
> > > Hiya,
> > > 
> > > I forgot to mention
> > > 
> > > CONFIG_EFI_DISABLE_PCI_DMA is not enabled in my kernel config
> > > 
> > > I've just testing the "efi=no_disable_early_pci_dma" on my laptop as well
> > > and now boots there too
> > > 
> > 
> > Excellent. But efi=no_disable_early_pci_dma is the default unless you set
> > CONFIG_EFI_DISABLE_PCI_DMA=y, so this is a bit surprising.
> > 
> > > Thanks for your help.
> > > 
> > > If you need any other info, let me know as I think it maybe a deeper
> > problem
> > > than just the "efi=no_disable_early_pci_dma"
> > > 
> > 
> > To be honest, it seems pretty obvious to me that the way
> > efi_pci_disable_bridge_busmaster() rummages around in UEFI's driver
> protocol
> > database is causing ExitBootServices() to fail. The only mystery here is
> why
> > it is called in your case, since you don't have CONFIG_EFI_DISABLE_PCI_DMA
> > defined, nor efi=disable_early_pci_dma passed on the command line.
> 
> This got me puzzled too as I've been grep the kernel source code and seeing
> that the variable "efi_disable_pci_dma" inside
> "drivers/firmware/efi/libstub/efi-stub-helper.c" is "static"
> 
> I don't understand it myself either

Can you please share your kernel .config and your toolchain version?
Comment 16 Jerome C 2020-04-01 13:39:49 UTC
Oh I made a mistake on the config variable sorry

Stupid me... when I did "zcat /proc/config.gz" that was on the running instance of the kernel... that was on 5.5.13 which has it disabled...

I just did it again on 5.6.1 and it's enabled.

This is an option Arch Linux must have enabled starting with 5.6.1

dammit, I dont't like it when I do things like this

mystery solved
Comment 17 Hugo Oosterkamp 2020-04-01 13:40:40 UTC
(In reply to Ard Biesheuvel from comment #12)
> (In reply to Hugo Oosterkamp from comment #11)
> > with 
> > efi=no_disable_early_pci_dma
> > 
> > it starts up without any issues
> > 
> > Correction this time working on a YOGA 910 (INTEL BOX...)
> 
> Thanks for the data point. Could you share your kernel config please?

I did not build it myself, i pulled the kernel of the 

URL: https://download.opensuse.org/repositories/Kernel:/vanilla/standard/

repository
Comment 18 Ard Biesheuvel 2020-04-01 13:52:31 UTC
(In reply to Hugo Oosterkamp from comment #17)
> (In reply to Ard Biesheuvel from comment #12)
> > (In reply to Hugo Oosterkamp from comment #11)
> > > with 
> > > efi=no_disable_early_pci_dma
> > > 
> > > it starts up without any issues
> > > 
> > > Correction this time working on a YOGA 910 (INTEL BOX...)
> > 
> > Thanks for the data point. Could you share your kernel config please?
> 
> I did not build it myself, i pulled the kernel of the 
> 
> URL: https://download.opensuse.org/repositories/Kernel:/vanilla/standard/
> 
> repository

Are there any config files in /boot with the same version number as your kernel? If there are, could you check whether they contain CONFIG_EFI_DISABLE_PCI_DMA=y ?
Comment 19 Arvind Sankar 2020-04-01 13:54:35 UTC
(In reply to Hugo Oosterkamp from comment #17)
> (In reply to Ard Biesheuvel from comment #12)
> > (In reply to Hugo Oosterkamp from comment #11)
> > > with 
> > > efi=no_disable_early_pci_dma
> > > 
> > > it starts up without any issues
> > > 
> > > Correction this time working on a YOGA 910 (INTEL BOX...)
> > 
> > Thanks for the data point. Could you share your kernel config please?
> 
> I did not build it myself, i pulled the kernel of the 
> 
> URL: https://download.opensuse.org/repositories/Kernel:/vanilla/standard/
> 
> repository

Can you check if there is a /proc/config.gz file (after successful boot with the command line option)? If so, you can zgrep EFI_DISABLE_PCI_DMA /proc/config.gz to check if it was enabled.
Comment 20 Hugo Oosterkamp 2020-04-01 14:04:39 UTC
(In reply to Arvind Sankar from comment #19)
> (In reply to Hugo Oosterkamp from comment #17)
> > (In reply to Ard Biesheuvel from comment #12)
> > > (In reply to Hugo Oosterkamp from comment #11)
> > > > with 
> > > > efi=no_disable_early_pci_dma
> > > > 
> > > > it starts up without any issues
> > > > 
> > > > Correction this time working on a YOGA 910 (INTEL BOX...)
> > > 
> > > Thanks for the data point. Could you share your kernel config please?
> > 
> > I did not build it myself, i pulled the kernel of the 
> > 
> > URL: https://download.opensuse.org/repositories/Kernel:/vanilla/standard/
> > 
> > repository
> 
> Can you check if there is a /proc/config.gz file (after successful boot with
> the command line option)? If so, you can zgrep EFI_DISABLE_PCI_DMA
> /proc/config.gz to check if it was enabled.


zgrep EFI_DISABLE_PCI_DMA /proc/config.gz

hugo@SF:/> zgrep EFI_DISABLE_PCI_DMA /proc/config.gz
# CONFIG_EFI_DISABLE_PCI_DMA is not set
hugo@SF:/> ^C
hugo@SF:/> 

I did appended the instruction manually at startup without the efi_disable it does not get that far
Comment 21 Arvind Sankar 2020-04-01 14:05:51 UTC
Hm so Hugo's issue is still a mystery then.
Comment 22 Hugo Oosterkamp 2020-04-01 14:12:35 UTC
(In reply to Arvind Sankar from comment #21)
> Hm so Hugo's issue is still a mystery then.

In YAST kernel parameters I now have included 

 efi=no_disable_early_pci_dma 

The full string: 
splash=silent resume=/dev/disk/by-uuid/443f23e4-f2f7-4d7a-b22b-b19799cb1471 efi=no_disable_early_pci_dma 

Grub is written and upon startup it works fine but doing a

hugo@SF:/> zgrep EFI_DISABLE_PCI_DMA /proc/config.gz
# CONFIG_EFI_DISABLE_PCI_DMA is not set
hugo@SF:/> 

it still shows up as not set
Comment 23 Hugo Oosterkamp 2020-04-01 14:22:58 UTC
Strange mistery: 

i removed the option efi=no_disable_early_pci_dma from the GRUB and restarted without issues.

hugo@SF:/> zgrep EFI_DISABLE_PCI_DMA /proc/config.gz
# CONFIG_EFI_DISABLE_PCI_DMA is not set
hugo@SF:/>
Comment 24 Arvind Sankar 2020-04-01 14:38:35 UTC
(In reply to Hugo Oosterkamp from comment #23)
> Strange mistery: 
> 
> i removed the option efi=no_disable_early_pci_dma from the GRUB and
> restarted without issues.
> 
> hugo@SF:/> zgrep EFI_DISABLE_PCI_DMA /proc/config.gz
> # CONFIG_EFI_DISABLE_PCI_DMA is not set
> hugo@SF:/>

Did you update the kernel between the last time you saw it crash and now?

Although the 5.6-rc4 kernel in https://download.opensuse.org/repositories/Kernel:/linux-next/standard/x86_64/kernel-vanilla-5.6.rc4.next.20200305-1.1.g1f4ad99.x86_64.rpm also appears to have it disabled.

Note You need to log in before you can comment on or make changes to this bug.