From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754440AbbCPMJk (ORCPT ); Mon, 16 Mar 2015 08:09:40 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36023 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754386AbbCPMJi (ORCPT ); Mon, 16 Mar 2015 08:09:38 -0400 Date: Mon, 16 Mar 2015 05:09:12 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: torvalds@linux-foundation.org, luto@amacapital.net, hpa@zytor.com, mingo@kernel.org, oleg@redhat.com, dvlasenk@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de Reply-To: mingo@kernel.org, dvlasenk@redhat.com, oleg@redhat.com, bp@alien8.de, linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, luto@amacapital.net, hpa@zytor.com In-Reply-To: <1b810c1d2e797e27bb4a7708c426101161edd1f6.1426009661.git.luto@amacapital.net> References: <1b810c1d2e797e27bb4a7708c426101161edd1f6.1426009661.git.luto@amacapital.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/asm/entry: Unify and fix initial thread_struct: :sp0 values Git-Commit-ID: 6ecb31635fd0d342b04b9a8e58f2e11382b99bee X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6ecb31635fd0d342b04b9a8e58f2e11382b99bee Gitweb: http://git.kernel.org/tip/6ecb31635fd0d342b04b9a8e58f2e11382b99bee Author: Andy Lutomirski AuthorDate: Tue, 10 Mar 2015 11:05:59 -0700 Committer: Ingo Molnar CommitDate: Mon, 16 Mar 2015 11:05:36 +0100 x86/asm/entry: Unify and fix initial thread_struct::sp0 values x86_32 and x86_64 need slightly different thread_struct::sp0 values, and x86_32's was incorrect for init. This never mattered -- the init thread never runs user code, so we never used thread_struct::sp0 for anything. Fix it and mostly unify them. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1b810c1d2e797e27bb4a7708c426101161edd1f6.1426009661.git.luto@amacapital.net Signed-off-by: Ingo Molnar --- arch/x86/include/asm/processor.h | 7 +++++-- arch/x86/kernel/process.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 554da61..aed6d4f 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -810,6 +810,9 @@ static inline void spin_lock_prefetch(const void *x) prefetchw(x); } +#define TOP_OF_INIT_STACK ((unsigned long)&init_stack + sizeof(init_stack) - \ + TOP_OF_KERNEL_STACK_PADDING) + #ifdef CONFIG_X86_32 /* * User space process size: 3GB (default). @@ -820,7 +823,7 @@ static inline void spin_lock_prefetch(const void *x) #define STACK_TOP_MAX STACK_TOP #define INIT_THREAD { \ - .sp0 = sizeof(init_stack) + (long)&init_stack, \ + .sp0 = TOP_OF_INIT_STACK, \ .vm86_info = NULL, \ .sysenter_cs = __KERNEL_CS, \ .io_bitmap_ptr = NULL, \ @@ -882,7 +885,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); #define STACK_TOP_MAX TASK_SIZE_MAX #define INIT_THREAD { \ - .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ + .sp0 = TOP_OF_INIT_STACK \ } /* diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index f4c0af7..12b1cf6 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -39,7 +39,7 @@ */ __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = { .x86_tss = { - .sp0 = (unsigned long)&init_stack + sizeof(init_stack), + .sp0 = TOP_OF_INIT_STACK, #ifdef CONFIG_X86_32 .ss0 = __KERNEL_DS, .ss1 = __KERNEL_CS,