Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635AbdDKM3p (ORCPT ); Tue, 11 Apr 2017 08:29:45 -0400 Received: from mga07.intel.com ([134.134.136.100]:23157 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbdDKM3l (ORCPT ); Tue, 11 Apr 2017 08:29:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,185,1488873600"; d="scan'208";a="1133939363" Date: Tue, 11 Apr 2017 15:29:36 +0300 From: "Kirill A. Shutemov" To: Ingo Molnar Cc: dave.hansen@intel.com, luto@amacapital.net, tglx@linutronix.de, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/mm] x86/boot/64: Rewrite startup_64() in C Message-ID: <20170411122936.dso2p4o3lqalw6eo@black.fi.intel.com> References: <20170406140106.78087-2-kirill.shutemov@linux.intel.com> <20170411085441.GA29946@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170411085441.GA29946@gmail.com> User-Agent: NeoMutt/20161126 (1.7.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2338 Lines: 63 On Tue, Apr 11, 2017 at 10:54:41AM +0200, Ingo Molnar wrote: > > * tip-bot for Kirill A. Shutemov wrote: > > > Commit-ID: 10ee822ec8c53f3987d969ce98b2686323a7fc2a > > Gitweb: http://git.kernel.org/tip/10ee822ec8c53f3987d969ce98b2686323a7fc2a > > Author: Kirill A. Shutemov > > AuthorDate: Thu, 6 Apr 2017 17:00:59 +0300 > > Committer: Ingo Molnar > > 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 > > Cc: Andrew Morton > > Cc: Andy Lutomirski > > Cc: Dave Hansen > > Cc: Linus Torvalds > > Cc: Peter Zijlstra > > Cc: Thomas Gleixner > > 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 > > --- > > 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