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


Groups > linux.kernel > #1602721

Re: kexec regression since 4.9 caused by efi

From Omar Sandoval <osandov@osandov.com>
Newsgroups linux.kernel
Subject Re: kexec regression since 4.9 caused by efi
Date 2017-03-16 19:00 +0100
Message-ID <tlHQR-1Mk-21@gated-at.bofh.it> (permalink)
References <tiQH0-3gA-1@gated-at.bofh.it> <tiZTY-1bv-17@gated-at.bofh.it> <tj31v-3pp-11@gated-at.bofh.it> <tksKe-5zs-15@gated-at.bofh.it> <tlD0S-6Rt-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 16, 2017 at 12:41:32PM +0000, Matt Fleming wrote:
> On Mon, 13 Mar, at 03:37:48PM, Dave Young wrote:
> > 
> > Omar, could you try below patch? Looking at the efi_mem_desc_lookup, it is not
> > correct to be used in efi_arch_mem_reserve, if it passed your test, I
> > can rewrite patch log with more background and send it out:
> > 
> >         for_each_efi_memory_desc(md) {
> > 		[snip]
> >                 if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
> >                     md->type != EFI_BOOT_SERVICES_DATA &&
> >                     md->type != EFI_RUNTIME_SERVICES_DATA) {
> >                         continue;
> >                 }
> > 
> > In above code, it meant to get a md of EFI_MEMORY_RUNTIME of either boot
> > data or runtime data, this is wrong for efi_mem_reserve, because we are
> > reserving boot data which has no EFI_MEMORY_RUNTIME attribute at the
> > running time. Just is happened to work and we did not capture the error.
> 
> Wouldn't something like this be simpler?
> 
> ---
> 
> diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
> index 30031d5293c4..cdfe8c628959 100644
> --- a/arch/x86/platform/efi/quirks.c
> +++ b/arch/x86/platform/efi/quirks.c
> @@ -201,6 +201,10 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size)
>  		return;
>  	}
>  
> +	/* No need to reserve regions that will never be freed. */
> +	if (md.attribute & EFI_MEMORY_RUNTIME)
> +		return;
> +
>  	size += addr % EFI_PAGE_SIZE;
>  	size = round_up(size, EFI_PAGE_SIZE);
>  	addr = round_down(addr, EFI_PAGE_SIZE);

This works for me.

Reported-and-tested-by: Omar Sandoval <osandov@fb.com>

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


Thread

Re: kexec regression since 4.9 caused by efi Matt Fleming <matt@codeblueprint.co.uk> - 2017-03-16 13:50 +0100
  Re: kexec regression since 4.9 caused by efi Omar Sandoval <osandov@osandov.com> - 2017-03-16 19:00 +0100
  Re: kexec regression since 4.9 caused by efi Dave Young <dyoung@redhat.com> - 2017-03-17 03:30 +0100
    Re: kexec regression since 4.9 caused by efi Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-03-17 14:30 +0100
    Re: kexec regression since 4.9 caused by efi Matt Fleming <matt@codeblueprint.co.uk> - 2017-03-17 14:40 +0100
      Re: kexec regression since 4.9 caused by efi Dave Young <dyoung@redhat.com> - 2017-03-20 03:20 +0100
        Re: kexec regression since 4.9 caused by efi Dave Young <dyoung@redhat.com> - 2017-03-21 08:50 +0100
          Re: kexec regression since 4.9 caused by efi Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-03-22 17:20 +0100
            Re: kexec regression since 4.9 caused by efi Dave Young <dyoung@redhat.com> - 2017-03-23 03:50 +0100

csiph-web