From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 4/4] x86/boot: copy/clear sections more efficiently
Date: Tue, 21 Jun 2016 17:59:05 +0100 [thread overview]
Message-ID: <1466528345-22235-4-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1466528345-22235-1-git-send-email-andrew.cooper3@citrix.com>
Both the trampoline copy and BSS initialise can be performed more
efficiently by using 4-byte variants of the string operations.
On Intel systems with ERMSB (efficient rep movsb), this is no practical
difference. On all other systems, this is 4 times more efficient.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
v2:
* Alter spacing after rep prefix
---
xen/arch/x86/boot/head.S | 9 +++++----
xen/arch/x86/xen.lds.S | 5 +++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 0999997..85770e8 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -128,7 +128,8 @@ __start:
mov $sym_phys(__bss_end),%ecx
sub %edi,%ecx
xor %eax,%eax
- rep stosb
+ shr $2,%ecx
+ rep stosl
/* Interrogate CPU extended features via CPUID. */
mov $0x80000000,%eax
@@ -192,8 +193,8 @@ __start:
/* Copy bootstrap trampoline to low memory, below 1MB. */
mov $sym_phys(trampoline_start),%esi
- mov $trampoline_end - trampoline_start,%ecx
- rep movsb
+ mov $((trampoline_end - trampoline_start) / 4),%ecx
+ rep movsl
/* Jump into the relocated trampoline. */
lret
@@ -205,6 +206,6 @@ reloc:
ENTRY(trampoline_start)
#include "trampoline.S"
-GLOBAL(trampoline_end)
+ENTRY(trampoline_end)
#include "x86_64.S"
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index a1678d8..d620e7a 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -314,3 +314,8 @@ ASSERT(IS_ALIGNED(cpu0_stack, STACK_SIZE), "cpu0_stack misaligned")
ASSERT(IS_ALIGNED(__init_begin, PAGE_SIZE), "__init_begin misaligned")
ASSERT(IS_ALIGNED(__init_end, PAGE_SIZE), "__init_end misaligned")
+
+ASSERT(IS_ALIGNED(trampoline_start, 4), "trampoline_start misaligned")
+ASSERT(IS_ALIGNED(trampoline_end, 4), "trampoline_end misaligned")
+ASSERT(IS_ALIGNED(__bss_start, 4), "__bss_start misaligned")
+ASSERT(IS_ALIGNED(__bss_end, 4), "__bss_end misaligned")
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-21 16:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 16:59 [PATCH v2 1/4] xen/init: Annotate all command line parameter infrastructure as const Andrew Cooper
2016-06-21 16:59 ` [PATCH v2 2/4] arm/init: Move .init.proc.info into .init.data Andrew Cooper
2016-06-21 17:18 ` Konrad Rzeszutek Wilk
2016-06-23 11:44 ` Julien Grall
2016-06-21 16:59 ` [PATCH v2 3/4] xen/init: Move initcall infrastructure " Andrew Cooper
2016-06-21 17:19 ` Konrad Rzeszutek Wilk
2016-06-21 17:25 ` Andrew Cooper
2016-06-22 7:00 ` Jan Beulich
2016-06-23 10:12 ` [PATCH v3 " Andrew Cooper
2016-06-23 11:46 ` Julien Grall
2016-06-21 16:59 ` Andrew Cooper [this message]
2016-06-22 6:57 ` [PATCH v2 1/4] xen/init: Annotate all command line parameter infrastructure as const Jan Beulich
2016-06-23 11:42 ` Julien Grall
2016-06-23 16:00 ` Jan Beulich
2016-06-23 16:08 ` Andrew Cooper
2016-06-24 9:29 ` [PATCH] init: fix build with older gcc Jan Beulich
2016-06-24 9:32 ` Andrew Cooper
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=1466528345-22235-4-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).