From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
x86@kernel.org, Steven Rostedt <rostedt@goodmis.org>,
Brian Gerst <brgerst@gmail.com>, Juergen Gross <jgross@suse.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [patch 00/15] x86/entry: Consolidation - Part V
Date: Wed, 26 Feb 2020 10:53:19 +0100 [thread overview]
Message-ID: <20200226095319.GT18400@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200225224719.950376311@linutronix.de>
On Tue, Feb 25, 2020 at 11:47:19PM +0100, Thomas Gleixner wrote:
> git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v1-part5
How about the completely untested something below on top to avoid that
silly indirect call on 32bit idtentry.
---
arch/x86/entry/entry_32.S | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index cf94e724743d..c92cd8412ab2 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -723,19 +723,19 @@
.endm
#ifdef CONFIG_X86_INVD_BUG
-.macro idtentry_push_func vector cfunc
+.macro idtentry_call_func vector cfunc
.if \vector == X86_TRAP_XF
/* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */
- ALTERNATIVE "pushl $exc_general_protection", \
- "pushl $exc_simd_coprocessor_error", \
+ ALTERNATIVE "call exc_general_protection", \
+ "call exc_simd_coprocessor_error", \
X86_FEATURE_XMM
.else
- pushl $\cfunc
+ call \cfunc
.endif
.endm
#else
-.macro idtentry_push_func vector cfunc
- pushl $\cfunc
+.macro idtentry_call_func vector cfunc
+ call \cfunc
.endm
#endif
@@ -755,10 +755,9 @@ SYM_CODE_START(\asmsym)
pushl $0 /* Clear the error code */
.endif
- /* Push the C-function address into the GS slot */
- idtentry_push_func \vector \cfunc
- /* Invoke the common exception entry */
- jmp common_exception
+ call common_idtentry
+ idtentry_call_func \vector \cfunc
+ jmp ret_from_exception
SYM_CODE_END(\asmsym)
.endm
@@ -1125,7 +1124,6 @@ SYM_FUNC_START(entry_INT80_32)
.section .fixup, "ax"
SYM_CODE_START(asm_exc_iret_error)
pushl $0 # no error code
- pushl $exc_iret_error
#ifdef CONFIG_DEBUG_ENTRY
/*
@@ -1139,7 +1137,9 @@ SYM_CODE_START(asm_exc_iret_error)
popl %eax
#endif
- jmp common_exception
+ call common_idtentry
+ call exc_iret_error
+ jmp ret_from_exception
SYM_CODE_END(asm_exc_iret_error)
.previous
_ASM_EXTABLE(.Lirq_return, asm_exc_iret_error)
@@ -1332,15 +1332,15 @@ SYM_FUNC_START(xen_failsafe_callback)
SYM_FUNC_END(xen_failsafe_callback)
#endif /* CONFIG_XEN_PV */
-SYM_CODE_START_LOCAL_NOALIGN(common_exception)
- /* the function address is in %gs's slot on the stack */
+SYM_CODE_START_LOCAL_NOALIGN(common_idtentry)
+ /* the return address is in the %gs stack slot */
SAVE_ALL switch_stacks=1 skip_gs=1 unwind_espfix=1
ENCODE_FRAME_POINTER
/* fixup %gs */
GS_TO_REG %ecx
- movl PT_GS(%esp), %edi # get the function address
- REG_TO_PTGS %ecx
+ pushl PT_GS(%esp) # push return address
+ REG_TO_OTGS %ecx
SET_KERNEL_GS %ecx
/* fixup orig %eax */
@@ -1348,9 +1348,8 @@ SYM_CODE_START_LOCAL_NOALIGN(common_exception)
movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
movl %esp, %eax # pt_regs pointer
- CALL_NOSPEC %edi
- jmp ret_from_exception
-SYM_CODE_END(common_exception)
+ ret
+SYM_CODE_END(common_idtentry)
#ifdef CONFIG_DOUBLEFAULT
SYM_CODE_START(asm_exc_double_fault)
next prev parent reply other threads:[~2020-02-26 9:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 22:47 [patch 00/15] x86/entry: Consolidation - Part V Thomas Gleixner
2020-02-25 22:47 ` [patch 01/15] x86/irq: Convey vector as argument and not in ptregs Thomas Gleixner
2020-02-26 5:13 ` Andy Lutomirski
2020-02-26 5:45 ` Brian Gerst
2020-02-26 20:13 ` Thomas Gleixner
2020-02-26 21:35 ` Andy Lutomirski
2020-02-26 23:50 ` Thomas Gleixner
2020-02-26 21:54 ` Brian Gerst
2020-02-26 23:43 ` Thomas Gleixner
2020-02-27 0:04 ` Brian Gerst
2020-02-25 22:47 ` [patch 02/15] x86/entry/64: Add ability to switch to IRQ stacks in idtentry Thomas Gleixner
2020-02-25 22:47 ` [patch 03/15] x86/entry: Add IRQENTRY_IRQ macro Thomas Gleixner
2020-02-26 15:05 ` Miroslav Benes
2020-02-25 22:47 ` [patch 04/15] x86/entry: Use idtentry for interrupts Thomas Gleixner
2020-02-25 22:47 ` [patch 05/15] x86/entry: Provide IDTEnTRY_SYSVEC Thomas Gleixner
2020-02-26 6:10 ` Andy Lutomirski
2020-02-26 20:15 ` Thomas Gleixner
2020-02-25 22:47 ` [patch 06/15] x86/entry: Convert APIC interrupts to IDTENTRY_SYSVEC Thomas Gleixner
2020-02-25 22:47 ` [patch 07/15] x86/entry: Convert SMP system vectors " Thomas Gleixner
2020-02-25 22:47 ` [patch 08/15] x86/entry: Convert various system vectors Thomas Gleixner
2020-02-25 22:47 ` [patch 09/15] x86/entry: Convert KVM vectors to IDTENTRY_SYSVEC Thomas Gleixner
2020-02-26 10:54 ` Paolo Bonzini
2020-02-25 22:47 ` [patch 10/15] x86/entry: Convert various hypervisor " Thomas Gleixner
2020-02-25 22:47 ` [patch 11/15] x86/entry: Convert XEN hypercall vector " Thomas Gleixner
2020-02-25 22:47 ` [patch 12/15] x86/entry: Remove the apic/BUILD interrupt leftovers Thomas Gleixner
2020-02-25 22:47 ` [patch 13/15] x86/entry/32: Remove redundant irq disable code Thomas Gleixner
2020-02-25 22:47 ` [patch 14/15] x86/entry: Provide return_from exception() Thomas Gleixner
2020-02-25 22:47 ` [patch 15/15] x86/entry: Use return_from_exception() Thomas Gleixner
2020-02-26 9:53 ` Peter Zijlstra [this message]
2020-02-26 10:02 ` [patch 00/15] x86/entry: Consolidation - Part V Peter Zijlstra
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=20200226095319.GT18400@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=arnd@arndb.de \
--cc=brgerst@gmail.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.