From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Xenia Ragiadakou <xenia.ragiadakou@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] x86/hvm/dom0: fix PVH initrd and metadata placement
Date: Thu, 26 Oct 2023 16:58:31 +0200 [thread overview]
Message-ID: <ZTp-l6Kysgu0_xXL@macbook> (raw)
In-Reply-To: <a4d4cac5-3987-4891-8aac-c5f559a02b59@amd.com>
On Thu, Oct 26, 2023 at 03:09:04PM +0300, Xenia Ragiadakou wrote:
> On 26/10/23 14:41, Jan Beulich wrote:
> > On 26.10.2023 12:31, Andrew Cooper wrote:
> > > On 26/10/2023 9:34 am, Xenia Ragiadakou wrote:
> > > > On 26/10/23 10:35, Jan Beulich wrote:
> > > > > On 26.10.2023 08:45, Xenia Ragiadakou wrote:
> > > > > > Given that start < kernel_end and end > kernel_start, the logic that
> > > > > > determines the best placement for dom0 initrd and metadata, does not
> > > > > > take into account the two cases below:
> > > > > > (1) start > kernel_start && end > kernel_end
> > > > > > (2) start < kernel_start && end < kernel_end
> > > > > >
> > > > > > In case (1), the evaluation will result in end = kernel_start
> > > > > > i.e. end < start, and will load initrd in the middle of the kernel.
> > > > > > In case (2), the evaluation will result in start = kernel_end
> > > > > > i.e. end < start, and will load initrd at kernel_end, that is out
> > > > > > of the memory region under evaluation.
> > > > > I agree there is a problem if the kernel range overlaps but is not fully
> > > > > contained in the E820 range under inspection. I'd like to ask though
> > > > > under what conditions that can happen, as it seems suspicious for the
> > > > > kernel range to span multiple E820 ranges.
> > > > We tried to boot Zephyr as pvh dom0 and its load address was under 1MB.
> > > >
> > > > I know ... that maybe shouldn't have been permitted at all, but
> > > > nevertheless we hit this issue.
> > >
> > > Zephyr is linked to run at 4k. That's what the ELF Headers say, and the
> > > entrypoint is not position-independent.
> > Very interesting. What size is their kernel? And, Xenia, can you provide
> > the E820 map that you were finding the collision with?
>
> Sure.
>
> Xen-e820 RAM map:
>
> [0000000000000000, 000000000009fbff] (usable)
> [000000000009fc00, 000000000009ffff] (reserved)
> [00000000000f0000, 00000000000fffff] (reserved)
> [0000000000100000, 000000007ffdefff] (usable)
> [000000007ffdf000, 000000007fffffff] (reserved)
> [00000000b0000000, 00000000bfffffff] (reserved)
> [00000000fed1c000, 00000000fed1ffff] (reserved)
> [00000000fffc0000, 00000000ffffffff] (reserved)
> [0000000100000000, 000000027fffffff] (usable)
>
> (XEN) ELF: phdr: paddr=0x1000 memsz=0x8000
> (XEN) ELF: phdr: paddr=0x100000 memsz=0x28a90
> (XEN) ELF: phdr: paddr=0x128aa0 memsz=0x7560
> (XEN) ELF: memory: 0x1000 -> 0x130000
Interesting, so far we have accommodated for the program headers
containing physical addresses for a mostly contiguous region, and the
assumption was that it would all fit into a single RAM region.
If we have to support elfs with such scattered loaded regions we
should start using a rangeset or similar in find_memory() in order to
have a clear picture of the available memory ranges suitable to load
the kernel metadata.
Thanks, Roger.
prev parent reply other threads:[~2023-10-26 14:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 6:45 [PATCH] x86/hvm/dom0: fix PVH initrd and metadata placement Xenia Ragiadakou
2023-10-26 7:35 ` Jan Beulich
2023-10-26 8:34 ` Xenia Ragiadakou
2023-10-26 8:45 ` Jan Beulich
2023-10-26 9:46 ` Xenia Ragiadakou
2023-10-26 11:51 ` Jan Beulich
2023-10-26 12:35 ` Xenia Ragiadakou
2023-10-26 12:37 ` Jan Beulich
2023-10-26 13:58 ` Xenia Ragiadakou
2023-10-26 14:55 ` Jan Beulich
2023-10-26 15:01 ` Roger Pau Monné
2023-10-26 16:55 ` Xenia Ragiadakou
2023-10-27 6:37 ` Jan Beulich
2023-10-27 11:18 ` Xenia Ragiadakou
2023-10-27 12:01 ` Jan Beulich
2023-10-30 7:37 ` Xenia Ragiadakou
2023-10-30 11:18 ` Roger Pau Monné
2023-10-30 12:12 ` Jan Beulich
2023-10-26 10:31 ` Andrew Cooper
2023-10-26 11:41 ` Jan Beulich
2023-10-26 12:09 ` Xenia Ragiadakou
2023-10-26 12:35 ` Jan Beulich
2023-10-26 14:58 ` Roger Pau Monné [this message]
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=ZTp-l6Kysgu0_xXL@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xenia.ragiadakou@amd.com \
/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.