Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1326551

Re: [PATCH] x86/efi: skip bgrt init for kexec reboot

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] x86/efi: skip bgrt init for kexec reboot
Date 2016-02-04 11:10 +0100
Message-ID <qYp1p-7ay-29@gated-at.bofh.it> (permalink)
References <qVwsp-2JC-3@gated-at.bofh.it> <qYdtg-7qy-11@gated-at.bofh.it> <qYez1-8kz-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 03 Feb, at 10:53:33PM, Matt Fleming wrote:
> On Thu, 04 Feb, at 05:42:00AM, Dave Young wrote:
> > 
> > On 01/27/16 at 07:20pm, Dave Young wrote:
> > > For kexec reboot the bgrt image address could contains random data because
> > > we have freed boot service areas in 1st kernel boot phase. One possible
> > > result is kmalloc fail in efi_bgrt_init due to large random image size.
> > > 
> > > So change efi_late_init to avoid efi_bgrt_init in case kexec boot.
> > > 
> > > Signed-off-by: Dave Young <dyoung@redhat.com>
> > > ---
> > >  arch/x86/platform/efi/efi.c |    3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > --- linux-x86.orig/arch/x86/platform/efi/efi.c
> > > +++ linux-x86/arch/x86/platform/efi/efi.c
> > > @@ -531,7 +531,8 @@ void __init efi_init(void)
> > >  
> > >  void __init efi_late_init(void)
> > >  {
> > > -	efi_bgrt_init();
> > > +	if (!efi_setup)
> > > +		efi_bgrt_init();
> > >  }
> > >  
> > >  void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
> > 
> > Matt, opinions about this patch?
> 
> Yeah, I'm not happy seeing efi_setup escaping into even more places,
> nor am I happy to see more code paths introduced where kexec boot is
> special-cased.
> 
> I'll reply with more details tomorrow.

OK, let me expand upon that rather terse feedback. 

This patch highlights a general problem I see in the EFI code which is
that we're continuously increasing the number of execution paths
through the boot code. This makes it increasingly difficult to modify
the code without introducing bugs and regressions.

I was bitten by this recently with the EFI separate page table rework,
which led to commit 753b11ef8e92 ("x86/efi: Setup separate EFI page
tables in kexec paths"), i.e I forgot to update the special kexec
virtual mapping function.

We should be reducing the use of 'efi_setup', not adding more uses.

As an aside, I've always had a problem with using 'efi_setup' to
indicate when we've been booted via kexec. If a developer with no
prior knowledge reads those if conditions they are going to have zero
clue what the code means. 

Now, specifically for the issue you've raised, would it not make more
sense for kexec to build its own ACPI tables and omit those entries
that are not valid, e.g. BGRT? I can imagine that the BGRT driver
won't be the only driver with this problem. Let's re-use the existing
error paths that handle missing/invalid tables.

Fundamentally I don't think there should be a discernible difference
between "Booted via kexec" and "That ACPI table does not exist".

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Dave Young <dyoung@redhat.com> - 2016-02-03 22:50 +0100
  Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-04 00:00 +0100
    Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-04 11:10 +0100
      Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Dave Young <dyoung@redhat.com> - 2016-02-04 12:10 +0100
        Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-04 13:00 +0100
          Re: [PATCH] x86/efi: skip bgrt init for kexec reboot Dave Young <dyoung@redhat.com> - 2016-02-05 01:50 +0100

csiph-web