From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
<konrad.wilk@oracle.com>, <david.vrabel@citrix.com>
Cc: <xen-devel@lists.xenproject.org>, <mcgrof@kernel.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH v2] xen/x86: Zero out .bss for PV guests
Date: Wed, 24 Feb 2016 17:26:49 +0000 [thread overview]
Message-ID: <56CDE7D9.6000209@citrix.com> (raw)
In-Reply-To: <1456327186-27354-1-git-send-email-boris.ostrovsky@oracle.com>
On 24/02/16 15:19, Boris Ostrovsky wrote:
> Baremetal kernels clear .bss early in the boot but Xen PV guests don't
> execute that code. They have been able to run without problems because
> Xen domain builder happens to give out zeroed pages. However, since this
> is not really guaranteed, .bss should be explicitly cleared.
>
> (Since we introduce macros for specifying 32- and 64-bit registers we
> can get rid of ifdefs in startup_xen())
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: stable@vger.kernel.org
> ---
> arch/x86/xen/xen-head.S | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
> index b65f59a..2af87d1 100644
> --- a/arch/x86/xen/xen-head.S
> +++ b/arch/x86/xen/xen-head.S
> @@ -35,16 +35,31 @@
> #define PVH_FEATURES (0)
> #endif
>
> - __INIT
> -ENTRY(startup_xen)
> - cld
> #ifdef CONFIG_X86_32
> - mov %esi,xen_start_info
> - mov $init_thread_union+THREAD_SIZE,%esp
> +#define REG(register) %e##register
> +#define WSIZE_SHIFT 2
> +#define STOS stosl
> #else
> - mov %rsi,xen_start_info
> - mov $init_thread_union+THREAD_SIZE,%rsp
> +#define REG(register) %r##register
> +#define WSIZE_SHIFT 3
> +#define STOS stosq
> #endif
> +
> + __INIT
> +ENTRY(startup_xen)
> + cld
> +
> + /* Clear .bss */
> + xor REG(ax),REG(ax)
If we are nitpicking,
This should be xor %eax, %eax even in 64bit. Functionally identical,
and shorter to encode.
~Andrew
next prev parent reply other threads:[~2016-02-24 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 15:19 [PATCH v2] xen/x86: Zero out .bss for PV guests Boris Ostrovsky
2016-02-24 16:05 ` Brian Gerst
2016-02-24 16:33 ` Boris Ostrovsky
2016-02-24 17:26 ` Andrew Cooper [this message]
2016-02-24 17:48 ` [Xen-devel] " Boris Ostrovsky
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=56CDE7D9.6000209@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox