From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] x86/livepatch: enable livepatching assembly source files
Date: Wed, 19 Apr 2023 10:25:49 +0200 [thread overview]
Message-ID: <ZD+ljXSEPCmPMAtN@Air-de-Roger> (raw)
In-Reply-To: <d301e110-f840-a032-c406-2f7404752783@suse.com>
On Wed, Apr 19, 2023 at 08:17:45AM +0200, Jan Beulich wrote:
> On 18.04.2023 15:06, Roger Pau Monné wrote:
> > On Tue, Apr 18, 2023 at 01:00:53PM +0200, Jan Beulich wrote:
> >> On 18.04.2023 11:24, Roger Pau Monne wrote:
> >>> --- a/xen/arch/x86/include/asm/config.h
> >>> +++ b/xen/arch/x86/include/asm/config.h
> >>> @@ -44,6 +44,20 @@
> >>> /* Linkage for x86 */
> >>> #ifdef __ASSEMBLY__
> >>> #define ALIGN .align 16,0x90
> >>> +#ifdef CONFIG_LIVEPATCH
> >>> +#define START_LP(name) \
> >>> + jmp name; \
> >>> + .pushsection .text.name, "ax", @progbits; \
> >>> + name:
> >>> +#define END_LP(name) \
> >>> + .size name, . - name; \
> >>> + .type name, @function; \
> >>> + .popsection
> >>> +#else
> >>> +#define START_LP(name) \
> >>> + name:
> >>> +#define END_LP(name)
> >>> +#endif
> >>> #define ENTRY(name) \
> >>> .globl name; \
> >>> ALIGN; \
> >>
> >> Couldn't END_LP() set type and size unconditionally? (But see also
> >> below.)
> >
> > I see, so that we could also use it for debug purposes. I guess at
> > that point it might be better to use {START,END}_FUNC() to note that
> > the macros also have an effect beyond that of livepatching.
> >
> > Maybe also introduce a START_ENTRY() that replaces ENTRY()? Albeit I
> > find START_ENTRY a weird name.
>
> So do I. {START,END}_FUNC() or whatever else are in principle fine, but
> I take it that you're aware that we meanwhile have two or even three
> concurring proposals on a general scheme of such annotations, and we
> don't seem to be able to agree on one. (I guess I'll make a design
> session proposal on this topic for Prague.)
Oh, I wasn't aware we had other proposals, I've been away on an off
quite a lot recently, and haven't been able to keep up with all
xen-devel email. Do you have any references at hand?
> One thing needs to be clear though: Macros doing things solely needed
> for LP need to not have extra effects with it disabled, and such
> macros also better wouldn't e.g. insert stray JMP when not really
> needed. Hence I expect we still want (some) LP-specific macros besides
> whatever we settle on as the generic ones.
The stray jmp can be inserted only in the livepatch case, if we end up
having to add it.
Maybe we should just go with Linux names, so initially I would like to
use:
SYM_FUNC_START{_NOALIGN}(name)
SYM_FUNC_START_LOCAL{_NOALIGN}(name)
SYM_FUNC_END(name)
> >>> --- a/xen/arch/x86/x86_64/entry.S
> >>> +++ b/xen/arch/x86/x86_64/entry.S
> >>> @@ -660,7 +660,7 @@ ENTRY(early_page_fault)
> >>>
> >>> ALIGN
> >>> /* No special register assumptions. */
> >>> -restore_all_xen:
> >>> +START_LP(restore_all_xen)
> >>> /*
> >>> * Check whether we need to switch to the per-CPU page tables, in
> >>> * case we return to late PV exit code (from an NMI or #MC).
> >>> @@ -677,6 +677,7 @@ UNLIKELY_END(exit_cr3)
> >>>
> >>> RESTORE_ALL adj=8
> >>> iretq
> >>> +END_LP(restore_all_xen)
> >>
> >> While I'm fine with this conversion, ...
> >
> > So I take that overall you would agree to adding this extra
> > information using a pair of macros similar to the proposed ones.
>
> Yes (with the above in mind, though).
Sure, thanks for the feedback.
Roger.
next prev parent reply other threads:[~2023-04-19 8:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 9:24 [PATCH] x86/livepatch: enable livepatching assembly source files Roger Pau Monne
2023-04-18 11:00 ` Jan Beulich
2023-04-18 12:48 ` Andrew Cooper
2023-04-18 13:06 ` Roger Pau Monné
2023-04-19 6:17 ` Jan Beulich
2023-04-19 8:25 ` Roger Pau Monné [this message]
2023-04-19 8:43 ` Jan Beulich
2023-04-19 11:44 ` Roger Pau Monné
2023-04-19 12:00 ` Jan Beulich
2023-04-19 13:36 ` Roger Pau Monné
2023-04-19 14:39 ` Jan Beulich
2023-04-19 15:57 ` Roger Pau Monné
2023-04-19 16:03 ` Jan Beulich
2023-04-18 12:17 ` Andrew Cooper
2023-04-18 14:14 ` Roger Pau Monné
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=ZD+ljXSEPCmPMAtN@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--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.