linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"ardb@kernel.org" <ardb@kernel.org>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"joe@perches.com" <joe@perches.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [PATCH 08/15] efi/x86: Move command-line initrd loading to efi_main
Date: Wed, 27 May 2020 19:02:09 -0400	[thread overview]
Message-ID: <20200527230209.GA3575079@rani.riverdale.lan> (raw)
In-Reply-To: <CAPcyv4jOCY=kxeZVWsS0Xc36jmPr7DSR_sFrsMeoiEs+iEfbEA@mail.gmail.com>

On Wed, May 27, 2020 at 03:56:45PM -0700, Dan Williams wrote:
> On Wed, May 27, 2020 at 3:47 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > On Wed, May 27, 2020 at 10:30:18PM +0000, Williams, Dan J wrote:
> > > On Fri, 2020-05-08 at 20:01 +0200, Ard Biesheuvel wrote:
> > > > From: Arvind Sankar <nivedita@alum.mit.edu>
> > > >
> > > > Consolidate the initrd loading in efi_main.
> > > >
> > > > The command line options now need to be parsed only once.
> > > >
> > > > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> > > > Link:
> > > > https://lore.kernel.org/r/20200430182843.2510180-9-nivedita@alum.mit.edu
> > > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > >
> > > Hi,
> > >
> > > This patch patch in tip/master as:
> > >
> > > 987053a30016 efi/x86: Move command-line initrd loading to efi_main
> > >
> > > ...regresses my nfs root configuration. It hangs trying to mount the
> > > nfs root filesystem "root=/dev/nfs ip=dhcp".
> > >
> > > It does not revert cleanly.
> > >
> > >
> >
> > Does this fix it?
> >
> > diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> > index defeb6035109..f53362efef84 100644
> > --- a/drivers/firmware/efi/libstub/x86-stub.c
> > +++ b/drivers/firmware/efi/libstub/x86-stub.c
> > @@ -771,10 +771,12 @@ unsigned long efi_main(efi_handle_t handle,
> >                         efi_err("Failed to load initrd!\n");
> >                         goto fail;
> >                 }
> > -               efi_set_u64_split(addr, &hdr->ramdisk_image,
> > -                                 &boot_params->ext_ramdisk_image);
> > -               efi_set_u64_split(size, &hdr->ramdisk_size,
> > -                                 &boot_params->ext_ramdisk_size);
> > +               if (size > 0) {
> > +                       efi_set_u64_split(addr, &hdr->ramdisk_image,
> > +                                         &boot_params->ext_ramdisk_image);
> > +                       efi_set_u64_split(size, &hdr->ramdisk_size,
> > +                                         &boot_params->ext_ramdisk_size);
> > +               }
> 
> I'll give it a shot, but my guess would have been something related to
> the fact that this patch moves the initrd loading relative to when the
> command line is being parsed. In this case it's a dracut initrd built
> by:
> 
>     dracut -m "nfs network base"
> 
> ...with a kernel built with:
> 
> CONFIG_IP_PNP_DHCP=y
> 
> ...and a built-in network interface. The behavior seems to be that the
> kernel gets an IP address just fine, but there's no initrd userspace
> to mount nfs and the kernel eventually gives up looking for root.

It's an oversight in this patch: I set addr/size to 0 in the case where
the EFI stub is not supposed to handle the initrd loading (because a
bootloader ran before it and was responsible for handling the loading),
but then those 0's get written into the bootparams structure anyway,
blowing away whatever the bootloader had loaded.

  reply	other threads:[~2020-05-27 23:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 18:01 [GIT PULL 00/15] More EFI changes for v5.8 Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 01/15] efi/x86: Use correct size for boot_params Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 02/15] efi/libstub: Add a helper function to split 64-bit values Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 03/15] efi/libstub: Move pr_efi/pr_efi_err into efi namespace Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 04/15] efi/x86: Use efi_err for error messages Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 05/15] efi/gop: " Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 06/15] efi/tpm: " Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 07/15] efi/libstub: Upgrade ignored dtb= argument message to error Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 08/15] efi/x86: Move command-line initrd loading to efi_main Ard Biesheuvel
2020-05-27 22:30   ` Williams, Dan J
2020-05-27 22:46     ` Arvind Sankar
2020-05-27 22:56       ` Dan Williams
2020-05-27 23:02         ` Arvind Sankar [this message]
2020-05-27 23:13           ` Dan Williams
2020-05-27 23:26             ` [PATCH] efi/x86: Don't blow away existing initrd Arvind Sankar
2020-05-28  6:34               ` Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 09/15] efi/libstub: Unify initrd loading across architectures Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 10/15] efi/x86: Support builtin command line Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 11/15] efi/libstub: Check return value of efi_parse_options Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 12/15] efi/libstub: Fix mixed mode boot issue after macro refactor Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 13/15] efi/libstub/x86: Work around LLVM ELF quirk build regression Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 14/15] efi/libstub: Make efi_printk() input argument const char* Ard Biesheuvel
2020-05-08 18:01 ` [PATCH 15/15] efi/libstub: Correct comment typos Ard Biesheuvel
2020-05-14  9:05 ` [GIT PULL 00/15] More EFI changes for v5.8 Ard Biesheuvel
2020-05-20  7:20   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200527230209.GA3575079@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=joe@perches.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).