From: Matt Fleming <matt@codeblueprint.co.uk>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Mario Limonciello <mario_limonciello@dell.com>,
Kees Cook <keescook@chromium.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>, X86 ML <x86@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Josh Triplett <josh@joshtriplett.org>,
Peter Jones <pjones@redhat.com>
Subject: Re: [PATCH] x86/boot: Reorganize and clean up the BIOS area reservation code
Date: Fri, 22 Jul 2016 14:00:07 +0100 [thread overview]
Message-ID: <20160722130007.GI26504@codeblueprint.co.uk> (raw)
In-Reply-To: <CALCETrV-grU=B8o8q-AbaXWe7TdZZnD4=2WvSiXm=Ei_Zttffw@mail.gmail.com>
On Thu, 21 Jul, at 03:45:14PM, Andy Lutomirski wrote:
>
> I looked at the code some more. The boot services quirk is weird and
> maybe buggy. trim_snb_memory uses memblock_reserve to reserve the
> bottom 1MB. If efi_reserve_real_mode has already reserved that range,
> then trim_snb_memory's reservation will have no effect because the efi
> code will just free it later on. The same issue will hit any code
> that reserves >1MB memory after efi has tried to temporarily reserve
> it.
Yeah, that looks like a bug. memblock_reserve() reference counting,
anyone?
> I don't have any great suggestions for cleaning it up. Perhaps the
> efi code should instead skip adding boot services memory to the memory
> map in the first place and then add it late and hand any unreserved
> bits to the buddy allocator?
The issue is that some data required at runtime may be contained in
those boot services data regions; the EFI System Resource Table is a
good example or the ACPI BGRT table. esrt_init() happens pretty early
but efi_bgrt_init() is really late in boot because we need the ACPI
subsystem to have been brought up.
Fundamentally, you can't know whether you can use the boot services
regions for allocation until after SetVirtualAddressMap() has been
called (the original bug that required the reservation quirks occurs
at SVAM time) and after drivers have read the EFI config tables and
marked their regions as reserved.
I suppose we could rewrite the page table mapping for those precious
<1MB regions to coerce the firmware into accessing different pages
instead of the 1:1 addresses and copy the regions elsewhere. Maybe.
That assumes we don't hit other firmware bugs though.
next prev parent reply other threads:[~2016-07-22 13:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 1:32 [PATCH] x86/ebda: If the EBDA is in lowmem, reserve only 4k for the EBDA Andy Lutomirski
2016-07-21 8:14 ` [PATCH] x86/boot: Reorganize and clean up the BIOS area reservation code Ingo Molnar
2016-07-21 8:29 ` H. Peter Anvin
2016-07-21 9:11 ` Ingo Molnar
2016-07-21 12:32 ` H. Peter Anvin
2016-07-21 9:14 ` Ingo Molnar
2016-07-21 8:31 ` Ingo Molnar
2016-07-21 14:58 ` Andy Lutomirski
2016-07-21 16:18 ` Ingo Molnar
2016-07-21 21:08 ` Andy Lutomirski
2016-07-21 21:28 ` H. Peter Anvin
2016-07-21 21:48 ` Andy Lutomirski
2016-07-21 22:45 ` Andy Lutomirski
2016-07-22 13:00 ` Matt Fleming [this message]
2016-07-23 1:16 ` Linus Torvalds
2016-07-26 0:41 ` Andy Lutomirski
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=20160722130007.GI26504@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mario_limonciello@dell.com \
--cc=mingo@kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=pjones@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.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 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).