From: Mark Salter <msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-efi <linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Langsdorf <mlangsdo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: issue with MEMBLOCK_NOMAP
Date: Fri, 29 Jan 2016 10:53:07 -0500 [thread overview]
Message-ID: <1454082787.2821.58.camel@redhat.com> (raw)
In-Reply-To: <CAKv+Gu97eRFX80+mvFpv85Zc0=B=aa-LXM6KcNAQ+6Kxz3ZTZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Fri, 2016-01-29 at 15:06 +0100, Ard Biesheuvel wrote:
> On 29 January 2016 at 15:00, Mark Salter <msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > Hi Ard,
> >
> > I ran into an issue with your MEMBLOCK_NOMAP changes on a particular
> > firmware. The symptom is the kernel panics at boot time when it hits
> > an unmapped page while unpacking the initramfs. As it turns out, the
> > start of the initramfs shares a 64k kernel page with the UEFI memmap.
> > I can avoid the problem with:
> >
> > @@ -203,7 +203,7 @@ void __init efi_init(void)
> >
> > reserve_regions();
> > early_memunmap(memmap.map, params.mmap_size);
> > - memblock_mark_nomap(params.mmap & PAGE_MASK,
> > - PAGE_ALIGN(params.mmap_size +
> > - (params.mmap & ~PAGE_MASK)));
> > + memblock_reserve(params.mmap & PAGE_MASK,
> > + PAGE_ALIGN(params.mmap_size +
> > + (params.mmap & ~PAGE_MASK)));
> > }
> >
> >
> > But it makes me worry about the same potential problem with
> > other reserved regions which we nomap. What do you think?
> >
>
> So I take it this initramfs allocation is not made by the stub but by
> GRUB? Since the stub rounds all allocations to 64 KB ...
>
Yes. GRUB.
> In any case, regardless of the underlying cause, if any part of the
> initramfs turns out not to be covered by the linear mapping, we should
> invoke your code to move it. So I think it should be a matter of
> refining the logic in relocate_initrd() to do the right thing in this
> case
That thought had crossed my mind. I think it would be easy enough to
trigger the copy if first or last page of initrd is unmapped. Somewhat
related to this is that I want to rework this old patch to deal with
acpi tables outside mapped ram:
https://lkml.org/lkml/2015/5/14/357
Basically, we should be able to just do:
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 15e0aad..4ea638c 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -32,7 +32,7 @@
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
acpi_size size)
{
- if (!page_is_ram(phys >> PAGE_SHIFT))
+ if (!memblock_is_memory(phys))
return ioremap(phys, size);
return ioremap_cache(phys, size);
But this doesn't currently work wrt mem= which works by removing
the end range of memblocks. If I have mem= use the nomap flag
rather than removing the range, the above acpi_os_ioremap change
works, but other issues crop up due to memblock_end_of_DRAM()
returning end of all DRAM regardless of mem=. So we end up with
PFNs and struct pages for memory which will never be in linear
map. Fixing memblock_end_of_DRAM() to look at the flags and
return end of mapped DRAM gets things working but I wonder about
other potential trouble spots with this approach. Any thoughts?
>
> Your suggested change will break 32-bit ARM, since we use
> ioremap_nocache() to map the UEFI memory map, and ARM does not allow
> that on ranges that are part of the linear mapping.
okay. I'll put together a patch to the initrd relocating code.
Thanks!
next prev parent reply other threads:[~2016-01-29 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 14:00 issue with MEMBLOCK_NOMAP Mark Salter
[not found] ` <1454076020.2821.39.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-01-29 14:06 ` Ard Biesheuvel
[not found] ` <CAKv+Gu97eRFX80+mvFpv85Zc0=B=aa-LXM6KcNAQ+6Kxz3ZTZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-29 15:53 ` Mark Salter [this message]
[not found] ` <1454082787.2821.58.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-01-29 16:16 ` Ard Biesheuvel
[not found] ` <CAKv+Gu-QMewJT5wyKTYy3QsgsO3nWtSGJ3XKy-6DHsWEwJ-9xg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-29 17:57 ` Mark Salter
[not found] ` <1454090235.2821.66.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-01-29 18:09 ` 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=1454082787.2821.58.camel@redhat.com \
--to=msalter-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mlangsdo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.