From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
<xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 2/2] livepatch: set -f{function,data}-sections compiler option
Date: Tue, 8 Mar 2022 15:46:34 +0100 [thread overview]
Message-ID: <YidsSmPV1Pqulp+h@Air-de-Roger> (raw)
In-Reply-To: <c35415ef-b3c1-cc1c-2fb2-aa2de2602cd5@suse.com>
On Tue, Mar 08, 2022 at 03:09:17PM +0100, Jan Beulich wrote:
> On 08.03.2022 14:49, Roger Pau Monne wrote:
> > If livepatching support is enabled build the hypervisor with
> > -f{function,data}-sections compiler options, which is required by the
> > livepatching tools to detect changes and create livepatches.
> >
> > This shouldn't result in any functional change on the hypervisor
> > binary image, but does however require some changes in the linker
> > script in order to handle that each function and data item will now be
> > placed into its own section in object files. As a result add catch-all
> > for .text, .data and .bss in order to merge each individual item
> > section into the final image.
> >
> > The main difference will be that .text.startup will end up being part
> > of .text rather than .init, and thus won't be freed. .text.exit will
> > also be part of .text rather than dropped. Overall this could make the
> > image bigger, and package some .text code in a sub-optimal way.
> >
> > On Arm the .data.read_mostly needs to be moved ahead of the .data
> > section like it's already done on x86, so the .data.* catch-all
> > doesn't also include .data.read_mostly. The alignment of
> > .data.read_mostly also needs to be set to PAGE_SIZE so it doesn't end
> > up being placed at the tail of a read-only page from the previous
> > section. While there move the alignment of the .data section ahead of
> > the section declaration, like it's done for other sections.
> >
> > The benefit of having CONFIG_LIVEPATCH enable those compiler option
> > is that the livepatch build tools no longer need to fiddle with the
> > build system in order to enable them. Note the current livepatch tools
> > are broken after the recent build changes due to the way they
> > attempt to set -f{function,data}-sections.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
> > --- a/xen/arch/x86/xen.lds.S
> > +++ b/xen/arch/x86/xen.lds.S
> > @@ -88,6 +88,9 @@ SECTIONS
> > *(.text.unlikely .text.*_unlikely .text.unlikely.*)
> >
> > *(.text)
> > +#ifdef CONFIG_CC_SPLIT_SECTIONS
> > + *(.text.*)
> > +#endif
> > *(.text.__x86_indirect_thunk_*)
> > *(.text.page_aligned)
>
> These last two now will not have any effect anymore when
> CC_SPLIT_SECTIONS=y. This may have undesirable effects on the
> overall size when there is more than one object with a
> .text.page_aligned contribution. In .data ...
Agreed. I wondered whether to move those ahead of the main text
section, so likely:
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.page_aligned)
*(.text.__x86_indirect_thunk_*)
*(.text)
#ifdef CONFIG_CC_SPLIT_SECTIONS
*(.text.*)
#endif
FWIW, Linux seems fine to package .text.page_aligned together with the
rest of .text using the .text.[0-9a-zA-Z_]* catch-all.
> > @@ -292,9 +295,7 @@ SECTIONS
> >
> > DECL_SECTION(.data) {
> > *(.data.page_aligned)
> > - *(.data)
> > - *(.data.rel)
> > - *(.data.rel.*)
> > + *(.data .data.*)
> > } PHDR(text)
>
> ... this continues to be named first. I wonder whether we wouldn't
> want to use SORT_BY_ALIGNMENT (if available) instead in both places.
We could use the command line option if available
(--sort-section=alignment) to sort all wildcard sections?
Thanks, Roger.
next prev parent reply other threads:[~2022-03-08 14:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 13:49 [PATCH v3 0/2] livepatch: enable -f{function,data}-sections compiler option Roger Pau Monne
2022-03-08 13:49 ` [PATCH v3 1/2] xen/build: put image header into a separate section Roger Pau Monne
2022-03-08 13:57 ` Jan Beulich
2022-03-08 14:18 ` Roger Pau Monné
2022-03-08 15:08 ` Jan Beulich
2022-03-08 16:36 ` Roger Pau Monné
2022-03-08 16:54 ` Jan Beulich
2022-03-08 14:11 ` Andrew Cooper
2022-03-08 14:25 ` Roger Pau Monné
2022-03-08 13:49 ` [PATCH v3 2/2] livepatch: set -f{function,data}-sections compiler option Roger Pau Monne
2022-03-08 14:09 ` Jan Beulich
2022-03-08 14:46 ` Roger Pau Monné [this message]
2022-03-08 15:13 ` Jan Beulich
2022-03-08 16:41 ` Roger Pau Monné
2022-03-08 16:58 ` Jan Beulich
2022-03-09 9:30 ` Roger Pau Monné
2022-03-09 10:22 ` Jan Beulich
2022-03-09 19:06 ` Andrew Cooper
2022-03-08 14:52 ` [PATCH v3 0/2] livepatch: enable " Julien Grall
2022-03-09 12:28 ` Roger Pau Monné
2022-03-09 17:01 ` Julien Grall
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=YidsSmPV1Pqulp+h@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--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.