From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v2 1/2] x86/mkelf32: pad load segment to 2Mb boundary
Date: Thu, 14 Aug 2025 16:04:59 +0200 [thread overview]
Message-ID: <aJ3tC9h0ERajD-Ya@macbook.local> (raw)
In-Reply-To: <38430fbf-a6e4-4ba9-bbff-2279108721e6@suse.com>
On Thu, Aug 14, 2025 at 09:02:35AM +0200, Jan Beulich wrote:
> On 12.08.2025 18:18, Roger Pau Monné wrote:
> > On Mon, Aug 11, 2025 at 12:49:57PM +0200, Jan Beulich wrote:
> >> @@ -339,9 +340,12 @@ int main(int argc, char **argv)
> >> (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
> >> dat_siz = (uint32_t)in64_phdr.p_filesz;
> >>
> >> - /* Do not use p_memsz: it does not include BSS alignment padding. */
> >> - /*mem_siz = (uint32_t)in64_phdr.p_memsz;*/
> >> - mem_siz = (uint32_t)(final_exec_addr - in64_phdr.p_vaddr);
> >> + /*
> >> + * We don't pad .bss in the linker script, but during early boot we map
> >> + * the Xen image using 2M pages. To avoid running into adjacent non-RAM
> >> + * regions, pad the segment to the next 2M boundary.
> >
> > Won't it be easier to pad in the linker script? We could still have
> > __bss_end before the padding, so that initialization isn't done to the
> > extra padding area. Otherwise it would be helpful to mention why the
> > padding must be done here (opposed to being done in the linker
> > script).
>
> The way the linker script currently is written doesn't lend itself to do
> the padding there: It would either mean to introduce an artificial
> padding section (which I'd dislike), or it would result in _end[] and
> __2M_rwdata_end[] also moving, which pretty clearly we don't want. Maybe
> there are other options that I simply don't see.
We could move both _end and __2M_rwdata_end inside the .bss section,
but that's also ugly IMO. I would probably prefer the extra padding
section.
> A further complication would be xen.efi's .reloc, which we don't want to
> needlessly move either. That may be coverable by pr-processor
> conditionals, but I wanted to mention the aspect nevertheless.
Yeah, we could make the extra padding section depend on pre-processor
checks. I think I would prefer the usage of such extra section rather
than mangling the elf program headers afterwards, but since we are
already doing it:
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks, Roger.
next prev parent reply other threads:[~2025-08-14 14:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 10:48 [PATCH v2 0/2] x86/mm: unmapping and marking-as-I/O in arch_init_memory() Jan Beulich
2025-08-11 10:49 ` [PATCH v2 1/2] x86/mkelf32: pad load segment to 2Mb boundary Jan Beulich
2025-08-12 16:18 ` Roger Pau Monné
2025-08-14 7:02 ` Jan Beulich
2025-08-14 14:04 ` Roger Pau Monné [this message]
2025-08-11 10:50 ` [PATCH v2 2/2] x86/mm: drop unmapping from marking-as-I/O in arch_init_memory() Jan Beulich
2025-08-12 16:30 ` Roger Pau Monné
2025-08-14 7:04 ` Jan Beulich
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=aJ3tC9h0ERajD-Ya@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.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.