Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1621228

Re: [tip:x86/mm] x86/boot/64: Rewrite startup_64() in C

From "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [tip:x86/mm] x86/boot/64: Rewrite startup_64() in C
Date 2017-04-11 14:40 +0200
Message-ID <tv3ft-70f-51@gated-at.bofh.it> (permalink)
References <ttggN-16l-1@gated-at.bofh.it> <tuZbP-4s3-5@gated-at.bofh.it> <tuZOy-4F4-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Apr 11, 2017 at 10:54:41AM +0200, Ingo Molnar wrote:
> 
> * tip-bot for Kirill A. Shutemov <tipbot@zytor.com> wrote:
> 
> > Commit-ID:  10ee822ec8c53f3987d969ce98b2686323a7fc2a
> > Gitweb:     http://git.kernel.org/tip/10ee822ec8c53f3987d969ce98b2686323a7fc2a
> > Author:     Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > AuthorDate: Thu, 6 Apr 2017 17:00:59 +0300
> > Committer:  Ingo Molnar <mingo@kernel.org>
> > CommitDate: Tue, 11 Apr 2017 08:57:37 +0200
> > 
> > x86/boot/64: Rewrite startup_64() in C
> > 
> > The patch converts most of the startup_64 logic from assembly to C.
> > 
> > This is preparation for 5-level paging enabling.
> > 
> > No change in functionality.
> > 
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Andy Lutomirski <luto@amacapital.net>
> > Cc: Dave Hansen <dave.hansen@intel.com>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-mm@kvack.org
> > Link: http://lkml.kernel.org/r/20170406140106.78087-2-kirill.shutemov@linux.intel.com
> > [ Small typo fixes. ]
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> >  arch/x86/kernel/head64.c  | 81 ++++++++++++++++++++++++++++++++++++++++-
> >  arch/x86/kernel/head_64.S | 93 +----------------------------------------------
> >  2 files changed, 81 insertions(+), 93 deletions(-)
> 
> Hm, so I had to zap this commit as it broke booting on a 64-bit Intel and an AMD 
> system as well, with defconfig-ish kernels.

The fixup is below. Maybe there's better more idiomatic way, but I'm not
really into assembly.

Basically, we need to preserve %rsi across call __startup_64.

I will post whole thing again once we sort out what to do with the reset
of assembly code I've touched. Or you can apply the fixup, if you feel to.

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 9656c5951b98..1432d530fa35 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -73,7 +73,9 @@ startup_64:
 	call verify_cpu
 
 	leaq	_text(%rip), %rdi
+	pushq	%rsi
 	call	__startup_64
+	popq	%rsi
 
 	movq	$(early_level4_pgt - __START_KERNEL_map), %rax
 	jmp 1f
-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[tip:x86/mm] x86/boot/64: Rewrite startup_64() in C "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-04-11 10:20 +0200
  Re: [tip:x86/mm] x86/boot/64: Rewrite startup_64() in C "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-04-11 14:40 +0200

csiph-web