From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
Wei Liu <wl@xen.org>
Subject: Re: [PATCH 2/2] x86/trampoline: load the GDT located in the trampoline page
Date: Tue, 2 May 2023 12:34:01 +0200 [thread overview]
Message-ID: <ZFDnGaNXhI7PLOBM@Air-de-Roger> (raw)
In-Reply-To: <11b24761-9268-e647-7316-0bffb549ae6d@citrix.com>
On Tue, May 02, 2023 at 10:43:13AM +0100, Andrew Cooper wrote:
> On 02/05/2023 10:22 am, Roger Pau Monne wrote:
> > When booting the BSP the portion of the code executed from the
> > trampoline page will be using the GDT located in the hypervisor
> > .text.head section rather than the GDT located in the trampoline page.
>
> It's more subtle than this.
>
> gdt_boot_descr references the trampoline GDT, but by it's position in
> the main Xen image.
Right, gdt_boot_descr GDTR references gdt_48, but the instance on the
Xen .text section, not the trampoline.
I've tried to explain this in the commit message, but maybe I've
failed to do so.
> >
> > If skip_realmode is not set the GDT located in the trampoline page
> > will be loaded after having executed the BIOS call, otherwise the GDT
> > from .text.head will be used for all the protected mode trampoline
> > code execution.
> >
> > Note that both gdt_boot_descr and gdt_48 contain the same entries, but
> > the former is located inside the hypervisor .text section, while the
> > later lives in the relocated trampoline page.
> >
> > This is not harmful as-is, as both GDTs contain the same entries, but
> > for consistency with the APs switch the BSP trampoline code to also
> > use the GDT on the trampoline page.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, although ...
>
> > ---
> > xen/arch/x86/boot/trampoline.S | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
> > index cdecf949b410..e4b4b9091d0c 100644
> > --- a/xen/arch/x86/boot/trampoline.S
> > +++ b/xen/arch/x86/boot/trampoline.S
> > @@ -164,6 +164,12 @@ GLOBAL(trampoline_cpu_started)
> >
> > .code32
> > trampoline_boot_cpu_entry:
> > + /*
> > + * Load the GDT from the relocated trampoline page rather than the
> > + * hypervisor .text section.
> > + */
> > + lgdt bootsym_rel(gdt_48, 4)
>
> ... I'd suggest rewording this to simply /* Switch to trampoline GDT */,
> or perhaps with an "alias" in there somewhere.
"Switch to the relocated trampoline GDT." maybe?
Thanks, Roger.
prev parent reply other threads:[~2023-05-02 10:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 9:22 [PATCH 0/2] x86: init improvements Roger Pau Monne
2023-05-02 9:22 ` [PATCH 1/2] x86/head: check base address alignment Roger Pau Monne
2023-05-02 9:54 ` Andrew Cooper
2023-05-02 10:28 ` Jan Beulich
2023-05-02 10:51 ` Roger Pau Monné
2023-05-02 11:05 ` Jan Beulich
2023-05-02 11:11 ` Jan Beulich
2023-05-02 13:02 ` Roger Pau Monné
2023-05-02 13:27 ` Jan Beulich
2023-05-02 10:28 ` Roger Pau Monné
2023-05-02 10:34 ` Jan Beulich
2023-05-02 10:35 ` Andrew Cooper
2023-05-02 9:22 ` [PATCH 2/2] x86/trampoline: load the GDT located in the trampoline page Roger Pau Monne
2023-05-02 9:43 ` Andrew Cooper
2023-05-02 10:34 ` 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=ZFDnGaNXhI7PLOBM@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.