OSDN Git Service

x86/xen: Drop USERGS_SYSRET64 paravirt call
authorJuergen Gross <jgross@suse.com>
Wed, 20 Jan 2021 13:55:45 +0000 (14:55 +0100)
committerBorislav Petkov <bp@suse.de>
Wed, 10 Feb 2021 11:32:07 +0000 (12:32 +0100)
commitafd30525a659ac0ae0904f0cb4a2ca75522c3123
treece45cda82fac21a848509aa29661353e634d45d6
parent53c9d9240944088274aadbbbafc6138ca462db4f
x86/xen: Drop USERGS_SYSRET64 paravirt call

USERGS_SYSRET64 is used to return from a syscall via SYSRET, but
a Xen PV guest will nevertheless use the IRET hypercall, as there
is no sysret PV hypercall defined.

So instead of testing all the prerequisites for doing a sysret and
then mangling the stack for Xen PV again for doing an iret just use
the iret exit from the beginning.

This can easily be done via an ALTERNATIVE like it is done for the
sysenter compat case already.

It should be noted that this drops the optimization in Xen for not
restoring a few registers when returning to user mode, but it seems
as if the saved instructions in the kernel more than compensate for
this drop (a kernel build in a Xen PV guest was slightly faster with
this patch applied).

While at it remove the stale sysret32 remnants.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210120135555.32594-6-jgross@suse.com
arch/x86/entry/entry_64.S
arch/x86/include/asm/irqflags.h
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h
arch/x86/kernel/asm-offsets_64.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/paravirt_patch.c
arch/x86/xen/enlighten_pv.c
arch/x86/xen/xen-asm.S
arch/x86/xen/xen-ops.h