From: James Morse <james.morse@arm.com>
To: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: linux-efi@vger.kernel.org, ard.biesheuvel@linaro.org,
jhugo@codeaurora.org, Bhupesh Sharma <bhsharma@redhat.com>,
tbaicar@codeaurora.org, kexec@lists.infradead.org,
Bhupesh SHARMA <bhupesh.linux@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC] arm64: extra entries in /proc/iomem for kexec
Date: Tue, 24 Apr 2018 17:08:57 +0100 [thread overview]
Message-ID: <954d8b58-579a-c688-36f3-dc8d4b13cef8@arm.com> (raw)
In-Reply-To: <20180416100831.GF13168@linaro.org>
Hi Akashi,
On 16/04/18 11:08, AKASHI Takahiro wrote:
> On Thu, Apr 12, 2018 at 05:01:52PM +0100, James Morse wrote:
>> On 05/04/18 03:42, AKASHI Takahiro wrote:
>>> On Mon, Apr 02, 2018 at 10:53:32AM +0900, AKASHI Takahiro wrote:
>>>> Basically, changes that I made on /proc/iomem in my new format D were:
>>>> 1. to move NOMAP region entries, formerly named "reserved" and now named
>>>> "reserved (no map)", under System RAM
>>>> 2. to add new entries for firmware-reserved regions as "reserved" also
>>>> under System RAM
>>>>
>>>> On the other hand, current kexec-tools, in particular kexec command,
>>>> only scan top-level "System RAM" entries as well as "reserved" entries.
>>
>> as well as?
>
> I had few words here.
> The current kexec-tools assumes that "reserved" entries appear only
> at the top level. So,
>
>> Does this mean kexec will pick up the reserved region if its written as:
>> | 00001000-0009d7ff : System RAM
>> | 00001000-00001fff : reserved
>
> if this is the case, the range "0x1000-0x1fff" is added to an internal
> list of memory ranges
I found this in get_memory_ranges_iomem_cb()...
> but will later be *ignored* by locate_hole() function
> due to its memory type.
Ugh. Great.
> That is, the range can potentially be overwritten by loaded kernel/initrd.
So two kernel bugs, one user-space bug, all conspiring.
>>>> either because
>>>> a. new kernel (or initrd/dtb) may have been allocated on a NOMAP region
>>>> which are not suitable for usable memory, or
>>>> b. new kernel (or initrd/dtb) may have been allocated on a reserved region
>>>> whose contents can be overwritten.
>>>>
>>>> While we see (b) even today, (a) is a backward compatibility issue.
>>
>> (a) doesn't happen because request_standard_resources() checks
>> memblock_is_nomap(), and reports those regions as 'reserved'.
>
> I might have confused you. The assumption here was that we adopt format (D),
> where all NOMAP regions are sub nodes of "System RAM", but still use
> the current kexec-tools.
> As I said above, this will end up an un-expected behavior.
I'd like to fix this without having to fix user-space at the same time. It looks
like no-one else has second level reserved regions, so we can't blame
kexec-tools for looking straight at them, then ignoring them.
>> We can't expect user-space to upgrade to fix this issue.
>
> I'm not sure what you mean here; we can't fix the issue anyway
> without changing user-space/kexec-tools as kexec_load system call totally
> relies on parameters passed by kexec-tools.
> (The only difference is whether we need additional kernel changes or not.)
It looks like this was always broken because the efi memory map isn't listed as
'reserved' in /proc/iomem. The fallout for the new stuff is secondary.
>>> # I don't know yet whether people are happy with this fix, and also have
>>> kernel patches for my other approaches. They are neither not much
>>> complicated.
>>
>> I don't think we should fix this in userspace, exporting all the
>> memblock_reserved() regions as 'reserved' in /proc/iomem looks like the right
>> thing to do.
>
> Again, if you modify /proc/iomem, you have to update kexec-tools, too.
If we squash the memblock_reserved() stuff down so it appears as a top level
'reserved' region too, I don't think we do. This prevents the efi-memory-map
being overwritten on kernels since kexec was merged.
Its horribly fiddly to do this. The kernel code/data are special reserved
regions that we already describe as a subset of system-ram, even though they are
both also fragments of a bigger memblock_reserved() block.
While we can walk memblock for regions that aren't reserved, allocating memory
in the loop changes what is reserved. That one O(N) walk ends up being four...
I'm almost done tearing my hair out, I should have a working patch soon...
>> wasn't there going to be another version, with the core EFI
>> stuff split out?
>
> ? I don't remember well ...
https://lkml.org/lkml/2018/2/1/496
Thanks,
James
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2018-04-24 16:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 8:29 [RFC] arm64: extra entries in /proc/iomem for kexec AKASHI Takahiro
2018-03-14 8:39 ` Ard Biesheuvel
2018-03-15 4:41 ` AKASHI Takahiro
2018-03-15 7:33 ` Ard Biesheuvel
2018-03-19 19:48 ` Bhupesh Sharma
2018-03-27 10:16 ` AKASHI Takahiro
2018-03-27 13:32 ` James Morse
2018-04-02 1:53 ` AKASHI Takahiro
2018-04-05 2:42 ` AKASHI Takahiro
2018-04-12 16:01 ` James Morse
2018-04-16 10:08 ` AKASHI Takahiro
2018-04-24 16:08 ` James Morse [this message]
2018-04-25 9:20 ` AKASHI Takahiro
2018-04-25 13:22 ` James Morse
2018-04-26 7:40 ` AKASHI Takahiro
2018-04-26 14:26 ` James Morse
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=954d8b58-579a-c688-36f3-dc8d4b13cef8@arm.com \
--to=james.morse@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bhsharma@redhat.com \
--cc=bhupesh.linux@gmail.com \
--cc=jhugo@codeaurora.org \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=takahiro.akashi@linaro.org \
--cc=tbaicar@codeaurora.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