public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Denys Vlasenko <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:x86/asm] x86/asm/entry/64: Move retint_kernel code block closer to its user
Date: Tue, 31 Mar 2015 05:37:00 -0700	[thread overview]
Message-ID: <tip-627276cb55f33e2dc56eab5b973937c128b7704c@git.kernel.org> (raw)
In-Reply-To: <1427738975-7391-2-git-send-email-dvlasenk@redhat.com>

Commit-ID:  627276cb55f33e2dc56eab5b973937c128b7704c
Gitweb:     http://git.kernel.org/tip/627276cb55f33e2dc56eab5b973937c128b7704c
Author:     Denys Vlasenko <dvlasenk@redhat.com>
AuthorDate: Mon, 30 Mar 2015 20:09:31 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
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 <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1427738975-7391-2-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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)
 

  reply	other threads:[~2015-03-31 12:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 18:09 [PATCH 0/5] x86/asm/entry/64: simplifications Denys Vlasenko
2015-03-30 18:09 ` [PATCH 1/5] x86/asm/entry/64: move retint_kernel code block closer to its user Denys Vlasenko
2015-03-31 12:37   ` tip-bot for Denys Vlasenko [this message]
2015-03-30 18:09 ` [PATCH 2/5] x86/asm/entry/64: simplify retint_kernel label usage, make retint_restore_args label local Denys Vlasenko
2015-03-30 18:18   ` Linus Torvalds
2015-03-30 18:09 ` [PATCH 3/5] x86/asm/entry/64: remove redundant DISABLE_INTERRUPTS Denys Vlasenko
2015-03-30 18:09 ` [PATCH 4/5] x86/asm/entry/64: do not GET_THREAD_INFO() too early Denys Vlasenko
2015-03-31 12:37   ` [tip:x86/asm] x86/asm/entry/64: Do " tip-bot for Denys Vlasenko
2015-03-30 18:09 ` [PATCH 5/5] x86/asm/entry/64: drop exit_intr label Denys Vlasenko
2015-03-30 18:22   ` Linus Torvalds
2015-03-31 10:33   ` [PATCH 5/5 v2] x86/asm/entry/64: simplify looping around preempt_schedule_irq Denys Vlasenko
2015-03-31 15:47 ` [PATCH 0/5] x86/asm/entry/64: simplifications Ingo Molnar
2015-03-31 16:18   ` Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-627276cb55f33e2dc56eab5b973937c128b7704c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=ast@plumgrid.com \
    --cc=bp@alien8.de \
    --cc=dvlasenk@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wad@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox