xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 2/3] x86/boot: Move some __high_start code and data into init sections
Date: Mon, 28 Apr 2014 14:06:43 +0100	[thread overview]
Message-ID: <1398690404-9559-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1398690404-9559-1-git-send-email-andrew.cooper3@citrix.com>

Half of __high_start is strictly for the BSP and will only be run once on
boot.  To complement 'start_secondary', create 'start_bsp' and move it into
the init.text section.

The interrupt handler 'ingore_int' is patched into the BSPs IDT, but fully
replaced with real handlers early during boot.  The BSPs IDT is used by APs
until midway through start_secondary, but after the real handlers have been
installed.  Therefore, 'ignore_int' can move to init.text.  Furthermore, its
strings can move to init.rodata.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>

---
v2: Move data to .init.rodata.  Add missing @progbits.

I know start_bsp doesn't need to be a GLOBAL(), but it prevents objdump
looking like:

  ffff82d08010005b:  85 db              test   %ebx,%ebx
  ffff82d08010005d:  0f 85 ae 46 08 00  jne    ffff82d080184711 <start_secondary>
  ffff82d080100063:  e9 08 0f 19 00     jmpq   ffff82d080290f70 <trampoline_end>

which is confusing to say the least.  An alternative would be to insert some
explicit alignment such that trampoline_end and start_bsp were no longer at
the same virtual address, but this feels worse than using GLOBAL().
---
 xen/arch/x86/boot/x86_64.S |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 8f92402..7ecfad3 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -29,7 +29,11 @@
 
         test    %ebx,%ebx
         jnz     start_secondary
+        jmp     start_bsp
 
+        .section .init.text, "ax", @progbits
+
+GLOBAL(start_bsp)
         /* Initialise IDT with simple error defaults. */
         leaq    ignore_int(%rip),%rcx
         movl    %ecx,%eax
@@ -55,10 +59,6 @@
         ud2     /* Force a panic (invalid opcode). */
 
 /* This is the default interrupt handler. */
-int_msg:
-        .asciz "Unknown interrupt (cr2=%016lx)\n"
-hex_msg:
-        .asciz "    %016lx"
 ignore_int:
         SAVE_ALL
         movq    %cr2,%rsi
@@ -75,6 +75,12 @@ ignore_int:
         jnz     0b
 1:      jmp     1b
 
+        .section .init.rodata, "a", @progbits
+
+int_msg:
+        .asciz "Unknown interrupt (cr2=%016lx)\n"
+hex_msg:
+        .asciz "    %016lx"
 
 /*** DESCRIPTOR TABLES ***/
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-04-28 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 13:06 [PATCH v2 0/3] Improvements to x86 boot code Andrew Cooper
2014-04-28 13:06 ` [PATCH v2 1/3] x86/boot: Early data should live in init.rodata Andrew Cooper
2014-04-28 13:06 ` Andrew Cooper [this message]
2014-04-28 14:04   ` [PATCH v2 2/3] x86/boot: Move some __high_start code and data into init sections Jan Beulich
2014-04-28 14:09     ` Andrew Cooper
2014-04-28 14:45       ` Jan Beulich
2014-04-28 14:49         ` Andrew Cooper
2014-04-28 14:55           ` [PATCH v3 " Andrew Cooper
2014-04-28 13:06 ` [PATCH v2 3/3] x86/boot: Use 'hlt' inside terminal loops 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=1398690404-9559-3-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --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).