All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Juergen Gross <jgross@suse.com>
Cc: andrew.cooper3@citrix.com, daniel.kiper@oracle.com,
	alex.thorlton@hpe.com, xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/3] xen/x86: split boot trampoline into permanent and temporary part
Date: Wed, 22 Mar 2017 05:33:11 -0600	[thread overview]
Message-ID: <58D26F070200007800146281@prv-mh.provo.novell.com> (raw)
In-Reply-To: <20170321131023.26810-2-jgross@suse.com>

>>> On 21.03.17 at 14:10, <jgross@suse.com> wrote:
> The hypervisor needs a trampoline in low memory for early boot and
> later for bringing up cpus and during wakeup from suspend. Today this
> trampoline is kept completely even if most of it isn't needed later.
> 
> Split the trampoline into a permanent part and a temporary part needed
> at early boot only. Introduce a new entry at the boundary.

s/entry/label/?

> Reduce the stack for wakeup coding in order for the permanent

"coding"?

> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -587,6 +587,8 @@ cmdline_parse_early:
>  reloc:
>  #include "reloc.S"
>  
> +        .align 16

Why?

>  ENTRY(trampoline_start)

ENTRY() already does this, with proper NOP padding.

> --- a/xen/arch/x86/boot/trampoline.S
> +++ b/xen/arch/x86/boot/trampoline.S
> @@ -1,4 +1,20 @@
> -        .code16
> +/*
> + * Trampoline code relocated to low memory.
> + *
> + * Care must taken when referencing symbols: they live in the relocated
> + * trampoline and in the hypervisor binary. The hypervisor symbols can either
> + * be accessed by their virtual address or by the physical address. When
> + * using the physical address eventually the physical start address of the
> + * hypervisor must be taken into account: after early boot the hypervisor
> + * will copy itself to high memory and writes its physical start address to
> + * trampoline_xen_phys_start in the low memory trampoline copy.
> + *
> + * Parts of the trampoline are needed for early boot only, while some other
> + * parts are needed as long as the hypervisor is active (e.g. wakeup code
> + * after suspend, bringup code for secondary cpus). The permanent parts should
> + * not reference any temporary low memory trampoline parts as those parts are
> + * not guaranteed to persist.
> + */

It would of course be nice if we had a way to enforce this
restriction, but I can't seem to be able to think of a workable
one.

> @@ -131,6 +151,12 @@ start64:
>          movabs  $__high_start,%rax
>          jmpq    *%rax
>  
> +#include "wakeup.S"
> +
> +ENTRY(trampoline_temp_start)

s/temp/boot/ ?

> --- a/xen/arch/x86/boot/wakeup.S
> +++ b/xen/arch/x86/boot/wakeup.S
> @@ -173,6 +173,8 @@ bogus_saved_magic:
>          movw    $0x0e00 + 'S', 0xb8014
>          jmp     bogus_saved_magic
>  
> +/* Stack for wakeup: rest of first trampoline page. */
>          .align  16
> -        .fill   PAGE_SIZE,1,0
> +.Lwakeup_stack_start:
> +        .fill   PAGE_SIZE - (.Lwakeup_stack_start - trampoline_start),1,0
>  wakeup_stack:

Is this stack being used at boot time? If not, what's the point of
putting a gap in here? Instead it could simply be calculated by its
users as trampoline_start + PAGE_SIZE, overwriting whatever
was left there. All that would then be desirable would be a
BUILD_BUG_ON()-like construct to make sure the stack won't
grow too small.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-03-22 11:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 13:10 [PATCH 0/3] xen: support of large memory maps Juergen Gross
2017-03-21 13:10 ` [PATCH 1/3] xen/x86: split boot trampoline into permanent and temporary part Juergen Gross
2017-03-22 11:33   ` Jan Beulich [this message]
     [not found]   ` <58D26F070200007800146281@suse.com>
2017-03-22 11:50     ` Juergen Gross
2017-03-21 13:10 ` [PATCH 2/3] xen/x86: use trampoline e820 buffer for BIOS interface only Juergen Gross
2017-03-22 13:12   ` Jan Beulich
     [not found]   ` <58D2865F02000078001463C2@suse.com>
2017-03-22 15:01     ` Juergen Gross
2017-03-22 15:23       ` Jan Beulich
     [not found]       ` <58D2A4EB0200007800146563@suse.com>
2017-03-22 15:25         ` Juergen Gross
2017-03-21 13:10 ` [PATCH 3/3] xen/x86: support larger memory map from EFI Juergen Gross
2017-03-22 13:19   ` Jan Beulich
     [not found]   ` <58D287DC02000078001463D8@suse.com>
2017-03-22 15:05     ` Juergen Gross
2017-03-21 13:26 ` [PATCH 0/3] xen: support of large memory maps Daniel Kiper
2017-03-22 15:17 ` Alex Thorlton
2017-03-22 15:22   ` Juergen Gross

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=58D26F070200007800146281@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=alex.thorlton@hpe.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=daniel.kiper@oracle.com \
    --cc=jgross@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.