Bug 699313 - Fedora 15 Beta fails to boot on thinkpad w520 in EFI mode
Fedora 15 Beta fails to boot on thinkpad w520 in EFI mode
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
15
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: John Feeney
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-25 00:26 EDT by liucougar
Modified: 2013-01-10 02:37 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-25 01:04:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Output of "memmap" from the UEFI Shell (8.41 KB, text/plain)
2011-05-02 08:57 EDT, Volker Braun
no flags Details
Output of "devtree" from the UEFI Shell (7.42 KB, text/plain)
2011-05-02 08:58 EDT, Volker Braun
no flags Details
screenshots of reboot crash message (245.88 KB, image/jpeg)
2011-06-06 04:18 EDT, liucougar
no flags Details
Screenshot of X220 hang on restart with EFI enabled 3.0.0-rc1-00049-g1fa7b6a kernel (1.84 MB, image/jpeg)
2011-06-06 09:36 EDT, Matěj Laitl
no flags Details
dmesg from 3.0-rc1-something booting ThinkPad X220 in EFI mode (61.54 KB, text/plain)
2011-06-06 09:50 EDT, Matěj Laitl
no flags Details
dmesg on thinkpad w520 with 2.6.38.6 with EFI patches (72.97 KB, text/plain)
2011-06-06 15:50 EDT, liucougar
no flags Details

  None (edit)
Description liucougar 2011-04-25 00:26:54 EDT
Description of problem:
UEFI is set as the first boot option in thinkpad w520 BIOS settings, and Fedora 15 Beta fails to boot

Version-Release number of selected component (if applicable):
Fedora 15 Beta

How reproducible:


Steps to Reproduce:
1. boot from Fedora 15 Beta USB (created from the ISO)
2. select Fedora-15-Beta in the grub menu
3. at the top-left corner, I see:
Trying to allocate 940 pages for VMLINU2
[Linux-EFI, setup=0x1014, size=0x3ab7d0]
    [Initrd, addr=0x770de000, size=0x8a1e96c]

Actual results:
nothing is printed after these 3 lines, and it hangs there forever

Expected results:
it boots

Additional info:
by specifying noefi on the kernel line in grub makes it boot; with Fedora 15 Alpha, I encounter another bug https://bugzilla.redhat.com/show_bug.cgi?id=683693 where it does not boot with EFI either
Comment 1 liucougar 2011-04-25 12:53:35 EDT
forgot to mention: this thinkpad w520 has 16GB installed memory
Comment 2 Chuck Ebbert 2011-04-26 21:52:25 EDT
In bug 683693 you report that re-adding the EFI physical mode patch makes it boot, is that correct?
Comment 3 Matthew Garrett 2011-04-26 22:05:14 EDT
Boot and then explode on efivars use, so it's a choose your poison kind of exercise. We can't readd the physical mode patch - we need to figure out why SetVirtualAddressMap() is failing.
Comment 4 liucougar 2011-04-26 22:29:46 EDT
yes, with physical mode, I can indeed boot, but I have to not compile in efivars, otherwise I hit bug 683693

but physical mode patch introduces some side-effect, such as on every reboot, I will receive this error:
BUG: bug: unable to handle kernel paging request at 0x......

and it does not reboot

I find similar bug reports on ubuntu:
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/635439
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/721576

I'd love to have my machine boot without that physical mode patch under UEFI

let me know if you need anything I can provide
Comment 5 Jarrod Frates 2011-04-27 16:40:09 EDT
Duplicate of bug 659905?  I haven't tried the physical mode patch, but the underlying symptoms look the same.
Comment 6 liucougar 2011-04-27 17:59:35 EDT
(In reply to comment #5)
> Duplicate of bug 659905?  I haven't tried the physical mode patch, but the
> underlying symptoms look the same.

yes, it does look quite similar. Jarrod, do you know what's your UEFI firmware make and revision? my thinkpad w520 has the following info (reported by UEFI Shell, "ver" command):
EFI Specification Revision : 2.0
EFI Vendor             : Phoenix Technologies Ltd.
EFI Revision            : 4660.22136

also, if you try physical mode patch, you have to turn off the efivars (not compile it in) and not load it on boot (I think the efivars module is either in the initrd image or compiled into the kernel on Fedora 15 Alpha installation disk, and there is no way to disable it on boot command line)
Comment 7 liucougar 2011-04-27 19:44:03 EDT
I also notice this row in dmesg when I boot up with physical mode patch, can it be the cause of the crash in SetVirtualAddressMap() without physical mode patch?

[ 0.000000] Kernel-defined memdesc doesn't match the one from EFI!
Comment 8 Matthew Garrett 2011-04-27 20:12:34 EDT
This turns out to be Linux complaining about something the specification explicitly allows. I've submitted a patch to get rid of it.
Comment 9 Jarrod Frates 2011-04-27 20:41:22 EDT
I would love to provide the EFI revision, but AFAICT, this model does not have a UEFI shell available for it.  Even the diagnostics disc does not provide the information, and mechanisms that provide it for workstation and server models do not appear to function on this notebook.  If you know of a bootable environment that would provide it, I will be happy--ecstatic, even--to look it up.

Matthew: I'll watch for updates and try it on my system as soon as it's published.
Comment 10 liucougar 2011-04-27 20:51:32 EDT
(In reply to comment #9)
> I would love to provide the EFI revision, but AFAICT, this model does not have
> a UEFI shell available for it.  Even the diagnostics disc does not provide the
> information, and mechanisms that provide it for workstation and server models
> do not appear to function on this notebook.  If you know of a bootable
> environment that would provide it, I will be happy--ecstatic, even--to look it
> up.
you could install one yourself, download the following file, rename it shellx64.efi and move it to (ESP)/EFI/shellx64.efi
http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=EdkShellBinPkg/FullShell/X64/Shell_Full.efi;hb=HEAD

then modify your grub-efi to add one entry, take a look at the last menuentry in the grub.conf file attached to the following bug report:
https://savannah.gnu.org/bugs/?33162

> Matthew: I'll watch for updates and try it on my system as soon as it's
> published.
I think Matthew's patch only fixes the warning, it does not make it boot, yet
Comment 11 Jarrod Frates 2011-04-28 12:52:05 EDT
Darn.  I just got a little over-excited.

Unfortunately, at this point, I do not have a functional Linux installation on the notebook.  Are there any other ways of getting it to run, such as a bootable CD?
Comment 12 Matthew Garrett 2011-04-28 13:05:32 EDT
Yes, disable EFI booting in the BIOS.
Comment 13 Volker Braun 2011-05-02 07:37:05 EDT
I ran into the same bug on my W520, also with 16GB RAM. Switching to Legacy boot in the BIOS works (though not with a GPT-formatted disk), but makes the boot initialization process noticeably slower. So I spent some time trying to get UEFI boot working with Fedora 15 beta. 

How to reproduce:

1. I dd'ed the efidisk.img from the F15 beta to a USB stick and booted from there. Boot hangs as in the ticket description. 


2. Editing the kernel command line and adding "noefi" allows the Linux kernel to boot and the F15 installer works fine until it is time for the reboot. System fails to boot. 


3. Anaconda did not create a EFI System Partition (ESP). There is no gdisk in efidisk.img (?!?) and parted is too buggy/featureless to manually create the ESP. I removed the SSD from the laptop and created the ESP on my F14 desktop with gdisk.


4. Cannot run efibootmgr because of "noefi". Fails with

Fatal: Couldn't open either sysfs or procfs directories for accessing EFI
variables.
Try 'modprobe efivars' as root.

And the modprobe efivars doesn't work, of course.


5. I copied grub.efi to (ESP)/EFI/BOOT/BOOTX64.EFI and manually created a grub legacy configuration file at (ESP)/EFI/BOOT/BOOTX64.CONF  Since these are the default EFI boot loaders, the thinkpad will load them without using efibootmgr.

At this point, I can EFI boot Fedora 15 beta.


I also tried the UEFI Shell from comment 10. I found no way to select the shell during bootup. The grub.cfg that is linked from comment 10 is using grub2 syntax, I'm pretty sure that that won't work with Fedoras legacy (efi-patched) grub. So I overwrote grub at (ESP)/EFI/BOOT/BOOTX64.EFI  The shell then loads as it should. "ver" returns

EFI Specification Revision : 2.0
EFI Vendor                 : Phoenix Technologies Ltd.
EFI Revision               : 4660.22136
Comment 14 Volker Braun 2011-05-02 08:57:57 EDT
Created attachment 496253 [details]
Output of "memmap" from the UEFI Shell
Comment 15 Volker Braun 2011-05-02 08:58:34 EDT
Created attachment 496254 [details]
Output of "devtree" from the UEFI Shell
Comment 16 liucougar 2011-05-08 15:12:44 EDT
a bit more info from https://bugs.launchpad.net/ubuntu/+source/linux/+bug/705588

this same error happens when enable virtualbox EFI boot option (Settings -> System -> Enable EFI) and boot the CD in EFI mode

maybe it's easier to debug this kernel issue in virtualbox?
Comment 17 liucougar 2011-05-08 18:56:16 EDT
Hi Matthew Garrett, I just noticed you submitted 5 patches to lkml (details https://lkml.org/lkml/2011/5/5/246 )

does it fix this issue for you on thinkpad w520?
Comment 18 Matthew Garrett 2011-05-08 19:24:34 EDT
If I had a W520, I could tell you...

I'll try to find out if we have access to any this week.
Comment 19 liucougar 2011-05-08 22:22:31 EDT
I tried these 5 patches against 3.6.38, and unfortunately it still does not boot :(

something else is still not working

Matthew, thanks for working on this
Comment 20 liucougar 2011-05-20 18:53:29 EDT
all the 5 patches in a single file: https://lkml.org/lkml/2011/5/19/616

another patch in the work: https://lkml.org/lkml/2011/5/19/377
Comment 21 liucougar 2011-06-01 23:48:51 EDT
the other patch is landed: https://lkml.org/lkml/2011/6/1/172

haven't yet got around to try it out
Comment 22 liucougar 2011-06-06 02:55:46 EDT
just applied patch https://lkml.org/lkml/2011/6/1/172 (on top of https://lkml.org/lkml/2011/5/19/616 I had to manually merge one changes in efi_64.c file) to my 3.6.38, and my thinkpad w520 finally boots fine in EFI mode 

finally I can remove noefi on my kernel boot line

thanks Matthew
Comment 23 liucougar 2011-06-06 04:16:47 EDT
the 5 patches plus the one in https://lkml.org/lkml/2011/6/1/172 are all required for thinkpad w520 to boot (tested on 2.6.38.4 and 2.6.38.6)

efivars can be loaded successfully (did not actually try using it)

but even with all these patches, kernel crashes and freezes on reboot, will add attachement of some screen shots
Comment 24 liucougar 2011-06-06 04:18:48 EDT
Created attachment 503169 [details]
screenshots of reboot crash message
Comment 25 Matěj Laitl 2011-06-06 09:36:29 EDT
Created attachment 503224 [details]
Screenshot of X220 hang on restart with EFI enabled 3.0.0-rc1-00049-g1fa7b6a kernel

I have similar problems, with Linux 3.0-rc1 my ThinkPad X220 laptop boots fine, but often hangs during restarts. See the screenshot.
Comment 26 Matthew Garrett 2011-06-06 09:46:35 EDT
It's jumping to a physical address while in virtual mode. This is so far outside the EFI spec that it's not even funny, so I'm completely unsurprised. Can you attach dmesg from an EFI boot?
Comment 27 Matěj Laitl 2011-06-06 09:50:37 EDT
Created attachment 503228 [details]
dmesg from 3.0-rc1-something booting ThinkPad X220 in EFI mode

Here you go... :)
Comment 28 Matthew Garrett 2011-06-06 10:05:27 EDT
Yup, the address it's trying to access is the physical address of one of the runtime sections. Everything about this is incompetent. Alternatives here are either to set up a physical page table for rebooting or just ignore the EFI reboot and use the existing methods instead. Can you try passing 

reboot=a

to your boot parameters and see if that successfully reboots?
Comment 29 Matěj Laitl 2011-06-06 10:28:04 EDT
(In reply to comment #28)
> Can you try passing  reboot=a to your boot parameters and see if that
> successfully reboots?

With reboot=a my system reboots just fine. (at least 2 times I tested it)
Comment 30 liucougar 2011-06-06 15:50:54 EDT
Created attachment 503315 [details]
dmesg on thinkpad w520 with 2.6.38.6 with EFI patches

my thinkpad w520 can reboots fine with reboot=a kernel command line argument with these EFI patches

it reboots without crashes even if I disable BIOS boot support (so only pure UEFI boot is enabled).

however, I did notice the following error in my dmesg:

[    0.000591] Call Trace:
[    0.000598]  [<ffffffff810a09b5>] ? bad_page+0x95/0xe0
[    0.000601]  [<ffffffff810a1314>] ? free_pages_prepare+0x94/0xa0
[    0.000605]  [<ffffffff810a2168>] ? free_hot_cold_page+0x48/0x1a0
[    0.000610]  [<ffffffff816088eb>] ? free_bootmem_late+0x37/0x4c
[    0.000613]  [<ffffffff8160466d>] ? efi_enter_virtual_mode+0x24d/0x337
[    0.000618]  [<ffffffff815f3bd2>] ? start_kernel+0x28e/0x2ed
[    0.000621]  [<ffffffff815f33d7>] ? x86_64_start_kernel+0xf3/0xf7

the full dmesg log is attached. the same error is present in Matěj Laitl's X220 dmesg as well
Comment 31 Matthew Garrett 2011-06-06 16:23:03 EDT
Yeah, there's a patch for that heading upstream. Thanks for testing!
Comment 32 liucougar 2011-06-06 16:27:16 EDT
good to know. 

could you add a comment here with the link to the LKML page with the patch when it's sent to upstream? thanks
Comment 33 liucougar 2011-06-06 18:37:37 EDT
oh, Matthew, you were talking about this patch https://lkml.org/lkml/2011/6/6/314 to fix that bad_page, right?
Comment 34 Matthew Garrett 2011-06-06 19:58:12 EDT
That's the one, yes.
Comment 35 Chuck Ebbert 2011-06-25 01:04:23 EDT
There are still problems with EFI in 3.0-rc, and even if we eventually get the fixes into F15 there will not be an official respin of the install disks. Please test rawhide/F16.

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