Skip to content

Commit 75ef821

Browse files
bostrovsingomolnar
authored andcommitted
x86/entry, x86/paravirt: Remove the unused usergs_sysret32 PV op
As result of commit "x86/xen: Avoid fast syscall path for Xen PV guests", usergs_sysret32 pv op is not called by Xen PV guests anymore and since they were the only ones who used it we can safely remove it. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Andy Lutomirski <luto@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: david.vrabel@citrix.com Cc: konrad.wilk@oracle.com Cc: virtualization@lists.linux-foundation.org Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/1447970147-1733-4-git-send-email-boris.ostrovsky@oracle.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 88c15ec commit 75ef821

7 files changed

Lines changed: 2 additions & 48 deletions

File tree

‎arch/x86/entry/entry_64_compat.S‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818

1919
.section .entry.text, "ax"
2020

21-
#ifdef CONFIG_PARAVIRT
22-
ENTRY(native_usergs_sysret32)
23-
swapgs
24-
sysretl
25-
ENDPROC(native_usergs_sysret32)
26-
#endif
27-
2821
/*
2922
* 32-bit SYSENTER instruction entry.
3023
*
@@ -238,7 +231,8 @@ sysret32_from_system_call:
238231
xorq %r9, %r9
239232
xorq %r10, %r10
240233
movq RSP-ORIG_RAX(%rsp), %rsp
241-
USERGS_SYSRET32
234+
swapgs
235+
sysretl
242236
END(entry_SYSCALL_compat)
243237

244238
/*

‎arch/x86/include/asm/paravirt.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,6 @@ extern void default_banner(void);
922922
call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \
923923
PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
924924

925-
#define USERGS_SYSRET32 \
926-
PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret32), \
927-
CLBR_NONE, \
928-
jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret32))
929-
930925
#ifdef CONFIG_X86_32
931926
#define GET_CR0_INTO_EAX \
932927
push %ecx; push %edx; \

‎arch/x86/include/asm/paravirt_types.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,6 @@ struct pv_cpu_ops {
165165
*/
166166
void (*usergs_sysret64)(void);
167167

168-
/*
169-
* Switch to usermode gs and return to 32-bit usermode using
170-
* sysret. Used to return to 32-on-64 compat processes.
171-
* Other usermode register state, including %esp, must already
172-
* be restored.
173-
*/
174-
void (*usergs_sysret32)(void);
175-
176168
/* Normal iret. Jump to this with the standard iret stack
177169
frame set up. */
178170
void (*iret)(void);

‎arch/x86/kernel/asm-offsets_64.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ int main(void)
2323
{
2424
#ifdef CONFIG_PARAVIRT
2525
OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
26-
OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
2726
OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
2827
OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
2928
BLANK();

‎arch/x86/kernel/paravirt.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
162162
ret = paravirt_patch_ident_64(insnbuf, len);
163163

164164
else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
165-
type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret32) ||
166165
type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret64))
167166
/* If operation requires a jmp, then jmp */
168167
ret = paravirt_patch_jmp(insnbuf, opfunc, addr, len);
@@ -217,7 +216,6 @@ static u64 native_steal_clock(int cpu)
217216

218217
/* These are in entry.S */
219218
extern void native_iret(void);
220-
extern void native_usergs_sysret32(void);
221219
extern void native_usergs_sysret64(void);
222220

223221
static struct resource reserve_ioports = {
@@ -376,9 +374,6 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
376374
.load_sp0 = native_load_sp0,
377375

378376
#ifdef CONFIG_X86_64
379-
#ifdef CONFIG_IA32_EMULATION
380-
.usergs_sysret32 = native_usergs_sysret32,
381-
#endif
382377
.usergs_sysret64 = native_usergs_sysret64,
383378
#endif
384379
.iret = native_iret,

‎arch/x86/kernel/paravirt_patch_64.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ DEF_NATIVE(pv_cpu_ops, clts, "clts");
1414
DEF_NATIVE(pv_cpu_ops, wbinvd, "wbinvd");
1515

1616
DEF_NATIVE(pv_cpu_ops, usergs_sysret64, "swapgs; sysretq");
17-
DEF_NATIVE(pv_cpu_ops, usergs_sysret32, "swapgs; sysretl");
1817
DEF_NATIVE(pv_cpu_ops, swapgs, "swapgs");
1918

2019
DEF_NATIVE(, mov32, "mov %edi, %eax");
@@ -54,7 +53,6 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
5453
PATCH_SITE(pv_irq_ops, save_fl);
5554
PATCH_SITE(pv_irq_ops, irq_enable);
5655
PATCH_SITE(pv_irq_ops, irq_disable);
57-
PATCH_SITE(pv_cpu_ops, usergs_sysret32);
5856
PATCH_SITE(pv_cpu_ops, usergs_sysret64);
5957
PATCH_SITE(pv_cpu_ops, swapgs);
6058
PATCH_SITE(pv_mmu_ops, read_cr2);

‎arch/x86/xen/xen-asm_64.S‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,6 @@ ENTRY(xen_sysret64)
6868
ENDPATCH(xen_sysret64)
6969
RELOC(xen_sysret64, 1b+1)
7070

71-
ENTRY(xen_sysret32)
72-
/*
73-
* We're already on the usermode stack at this point, but
74-
* still with the kernel gs, so we can easily switch back
75-
*/
76-
movq %rsp, PER_CPU_VAR(rsp_scratch)
77-
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
78-
79-
pushq $__USER32_DS
80-
pushq PER_CPU_VAR(rsp_scratch)
81-
pushq %r11
82-
pushq $__USER32_CS
83-
pushq %rcx
84-
85-
pushq $0
86-
1: jmp hypercall_iret
87-
ENDPATCH(xen_sysret32)
88-
RELOC(xen_sysret32, 1b+1)
89-
9071
/*
9172
* Xen handles syscall callbacks much like ordinary exceptions, which
9273
* means we have:

0 commit comments

Comments
 (0)