From: Nicolai Stange <nicstange@gmail.com>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: "Nicolai Stange" <nicstange@gmail.com>,
"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-efi@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Mika Penttilä" <mika.penttila@nextfour.com>
Subject: Re: [PATCH v2 1/2] x86/efi: don't allocate memmap through memblock after mm_init()
Date: Fri, 23 Dec 2016 22:12:21 +0100 [thread overview]
Message-ID: <878tr6jqoa.fsf@gmail.com> (raw)
In-Reply-To: <20161223145206.GC16838@codeblueprint.co.uk> (Matt Fleming's message of "Fri, 23 Dec 2016 14:52:06 +0000")
Matt Fleming <matt@codeblueprint.co.uk> writes:
> On Thu, 22 Dec, at 11:23:39AM, Nicolai Stange wrote:
>> So, after memblock is gone, allocations should be done through the "normal"
>> page allocator. Introduce a helper, efi_memmap_alloc() for this. Use
>> it from efi_arch_mem_reserve() and from efi_free_boot_services() as well.
>>
>> Fixes: 4bc9f92e64c8 ("x86/efi-bgrt: Use efi_mem_reserve() to avoid copying image data")
>> Signed-off-by: Nicolai Stange <nicstange@gmail.com>
> Could you also modify efi_fake_memmap() to use your new
> efi_memmap_alloc() function for consistency
Sure.
I'm planning to submit another set of patches addressing the (bounded)
memmap leaking in anything calling efi_memmap_unmap() though. In the
course of doing so, the memmap allocation sites will get touched anyway:
I'll have to store some information about how the memmap's memory has
been obtained.
> (note that all memblock_alloc()s should probably be PAGE_SIZE aligned
> like the fakemem code)?
Ok, but I'd really like to understand why: I can't find anything in
neither the code nor in the UEFI spec requiring this. And up to now,
efi_arch_mem_reserve() as well as efi_free_boot_services() used to do
those unaligned allocations...
In light of this, is there really a necessity for using whole page
allocations after mm_init() or would kmalloc() suffice here?
Provided that the memremap bits get adjusted accordingly, of course.
So, I'm thinking of turning the ->late boolean into a tristate like the
following:
Memory allocated by | Memory mapped through
--------------------|----------------------
memblock | early_memremap
memblock | memremap
kmalloc | -
Neglecting slub overhead, the use of kmalloc() over alloc_pages() would
save 4096 - 12*40 == 3616 Bytes on my system with its 12 entries under
/sys/firmware/efi/runtime-map/. Not really critical, but if it comes for
free, why not?
Thanks,
Nicolai
next prev parent reply other threads:[~2016-12-23 21:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 10:23 [PATCH v2 1/2] x86/efi: don't allocate memmap through memblock after mm_init() Nicolai Stange
2016-12-22 10:23 ` [PATCH v2 2/2] efi: efi_mem_reserve(): don't reserve " Nicolai Stange
2017-01-05 9:12 ` Dave Young
2017-01-09 11:44 ` Matt Fleming
2017-01-09 13:31 ` Mel Gorman
2017-01-09 13:45 ` Matt Fleming
2017-02-27 21:57 ` Matt Fleming
2017-01-10 0:37 ` Dave Young
2017-01-10 12:51 ` Matt Fleming
2017-01-11 8:04 ` Dave Young
2016-12-23 14:52 ` [PATCH v2 1/2] x86/efi: don't allocate memmap " Matt Fleming
2016-12-23 21:12 ` Nicolai Stange [this message]
2017-01-05 7:42 ` Ingo Molnar
2017-01-05 9:15 ` Dave Young
2017-01-05 9:39 ` Ard Biesheuvel
2017-01-05 10:15 ` Nicolai Stange
2017-01-05 11:34 ` Ard Biesheuvel
2017-01-05 12:53 ` Nicolai Stange
2017-01-04 18:40 ` Dan Williams
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=878tr6jqoa.fsf@gmail.com \
--to=nicstange@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mika.penttila@nextfour.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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