From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753026AbbCaMhp (ORCPT ); Tue, 31 Mar 2015 08:37:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57271 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbbCaMhm (ORCPT ); Tue, 31 Mar 2015 08:37:42 -0400 Date: Tue, 31 Mar 2015 05:37:00 -0700 From: tip-bot for Denys Vlasenko Message-ID: Cc: fweisbec@gmail.com, tglx@linutronix.de, wad@chromium.org, rostedt@goodmis.org, ast@plumgrid.com, oleg@redhat.com, luto@amacapital.net, hpa@zytor.com, bp@alien8.de, dvlasenk@redhat.com, torvalds@linux-foundation.org, mingo@kernel.org, keescook@chromium.org, linux-kernel@vger.kernel.org Reply-To: rostedt@goodmis.org, ast@plumgrid.com, wad@chromium.org, tglx@linutronix.de, fweisbec@gmail.com, bp@alien8.de, luto@amacapital.net, hpa@zytor.com, oleg@redhat.com, mingo@kernel.org, torvalds@linux-foundation.org, dvlasenk@redhat.com, linux-kernel@vger.kernel.org, keescook@chromium.org In-Reply-To: <1427738975-7391-2-git-send-email-dvlasenk@redhat.com> References: <1427738975-7391-2-git-send-email-dvlasenk@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/asm/entry/64: Move retint_kernel code block closer to its user Git-Commit-ID: 627276cb55f33e2dc56eab5b973937c128b7704c 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: 627276cb55f33e2dc56eab5b973937c128b7704c Gitweb: http://git.kernel.org/tip/627276cb55f33e2dc56eab5b973937c128b7704c Author: Denys Vlasenko AuthorDate: Mon, 30 Mar 2015 20:09:31 +0200 Committer: Ingo Molnar CommitDate: Tue, 31 Mar 2015 09:31:11 +0200 x86/asm/entry/64: Move retint_kernel code block closer to its user The "retint_kernel" code block is misplaced. Since its logical continuation is "retint_restore_args", it is more natural to place it above that label. This also makes two jumps "short". This change only moves code block around, without changing logic. This enables the next simplification: making "retint_restore_args" label a local numeric one. Signed-off-by: Denys Vlasenko 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: Steven Rostedt Cc: Will Drewry Link: http://lkml.kernel.org/r/1427738975-7391-2-git-send-email-dvlasenk@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/entry_64.S | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index dbfc8875..34d60c3 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -740,7 +740,19 @@ opportunistic_sysret_failed: SWAPGS jmp restore_args -retint_restore_args: /* return to kernel space */ +/* Returning to kernel space */ +#ifdef CONFIG_PREEMPT + /* Interrupts are off */ + /* Check if we need preemption */ +ENTRY(retint_kernel) + cmpl $0,PER_CPU_VAR(__preempt_count) + jnz retint_restore_args + bt $9,EFLAGS(%rsp) /* interrupts were off? */ + jnc retint_restore_args + call preempt_schedule_irq + jmp exit_intr +#endif +retint_restore_args: DISABLE_INTERRUPTS(CLBR_ANY) /* * The iretq could re-enable interrupts: @@ -830,17 +842,6 @@ retint_signal: GET_THREAD_INFO(%rcx) jmp retint_with_reschedule -#ifdef CONFIG_PREEMPT - /* Returning to kernel space. Check if we need preemption */ - /* rcx: threadinfo. interrupts off. */ -ENTRY(retint_kernel) - cmpl $0,PER_CPU_VAR(__preempt_count) - jnz retint_restore_args - bt $9,EFLAGS(%rsp) /* interrupts off? */ - jnc retint_restore_args - call preempt_schedule_irq - jmp exit_intr -#endif CFI_ENDPROC END(common_interrupt)