From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754549AbbCPMKW (ORCPT ); Mon, 16 Mar 2015 08:10:22 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36070 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754512AbbCPMKT (ORCPT ); Mon, 16 Mar 2015 08:10:19 -0400 Date: Mon, 16 Mar 2015 05:09:49 -0700 From: tip-bot for Denys Vlasenko Message-ID: Cc: hpa@zytor.com, rostedt@goodmis.org, oleg@redhat.com, tglx@linutronix.de, keescook@chromium.org, dvlasenk@redhat.com, wad@chromium.org, torvalds@linux-foundation.org, bp@alien8.de, ast@plumgrid.com, mingo@kernel.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, luto@amacapital.net Reply-To: tglx@linutronix.de, keescook@chromium.org, torvalds@linux-foundation.org, wad@chromium.org, dvlasenk@redhat.com, bp@alien8.de, hpa@zytor.com, oleg@redhat.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, luto@amacapital.net, ast@plumgrid.com, mingo@kernel.org In-Reply-To: <1426255743-5394-1-git-send-email-dvlasenk@redhat.com> References: <1426255743-5394-1-git-send-email-dvlasenk@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/asm/entry: Simplify task_pt_regs() macro definition Git-Commit-ID: 42503341cde213c5928a19f7c6e1eb8c85f2df3d 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: 42503341cde213c5928a19f7c6e1eb8c85f2df3d Gitweb: http://git.kernel.org/tip/42503341cde213c5928a19f7c6e1eb8c85f2df3d Author: Denys Vlasenko AuthorDate: Fri, 13 Mar 2015 15:09:03 +0100 Committer: Ingo Molnar CommitDate: Mon, 16 Mar 2015 11:05:36 +0100 x86/asm/entry: Simplify task_pt_regs() macro definition Before this change, task_pt_regs() was using KSTK_TOP(), and it was the only use of that macro. In turn, KSTK_TOP used THREAD_SIZE_LONGS, and it was the only use of that macro too. Fold these macros into task_pt_regs(). Tweak comment about "- 8" - we now use a symbolic constant, not literal 8. Signed-off-by: Denys Vlasenko Reviewed-by: Steven Rostedt Cc: Alexei Starovoitov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Frederic Weisbecker Cc: H. Peter Anvin Cc: Kees Cook Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Thomas Gleixner Cc: Will Drewry Link: http://lkml.kernel.org/r/1426255743-5394-1-git-send-email-dvlasenk@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/processor.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index c3a037b..d157f94 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -846,15 +846,8 @@ static inline void spin_lock_prefetch(const void *x) extern unsigned long thread_saved_pc(struct task_struct *tsk); -#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long)) -#define KSTK_TOP(info) \ -({ \ - unsigned long *__ptr = (unsigned long *)(info); \ - (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \ -}) - /* - * The below -8 is to reserve 8 bytes on top of the ring0 stack. + * TOP_OF_KERNEL_STACK_PADDING reserves 8 bytes on top of the ring0 stack. * This is necessary to guarantee that the entire "struct pt_regs" * is accessible even if the CPU haven't stored the SS/ESP registers * on the stack (interrupt gate does not save these registers @@ -863,12 +856,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); * "struct pt_regs" is possible, but they may contain the * completely wrong values. */ -#define task_pt_regs(task) \ -({ \ - struct pt_regs *__regs__; \ - __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task)) - \ - TOP_OF_KERNEL_STACK_PADDING); \ - __regs__ - 1; \ +#define task_pt_regs(task) \ +({ \ + unsigned long __ptr = (unsigned long)task_stack_page(task); \ + __ptr += THREAD_SIZE - TOP_OF_KERNEL_STACK_PADDING; \ + ((struct pt_regs *)__ptr) - 1; \ }) #define KSTK_ESP(task) (task_pt_regs(task)->sp)