1 From 958fcb45b64535b87e3cfaef15a5cb41595e4187 Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Thu, 2 Nov 2017 00:59:01 -0700
4 Subject: [PATCH 089/241] x86/entry/64: Simplify reg restore code in the
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
12 The old code restored all the registers with movq instead of pop.
14 In theory, this was done because some CPUs have higher movq
15 throughput, but any gain there would be tiny and is almost certainly
16 outweighed by the higher text size.
18 This saves 96 bytes of text.
20 Signed-off-by: Andy Lutomirski <luto@kernel.org>
21 Cc: Borislav Petkov <bpetkov@suse.de>
22 Cc: Brian Gerst <brgerst@gmail.com>
23 Cc: Dave Hansen <dave.hansen@intel.com>
24 Cc: Linus Torvalds <torvalds@linux-foundation.org>
25 Cc: Peter Zijlstra <peterz@infradead.org>
26 Cc: Thomas Gleixner <tglx@linutronix.de>
27 Link: http://lkml.kernel.org/r/ad82520a207ccd851b04ba613f4f752b33ac05f7.1509609304.git.luto@kernel.org
28 Signed-off-by: Ingo Molnar <mingo@kernel.org>
29 (cherry picked from commit e872045bfd9c465a8555bab4b8567d56a4d2d3bb)
30 Signed-off-by: Andy Whitcroft <apw@canonical.com>
31 Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
32 (cherry picked from commit f926575cd370de4052e89477582b349af5664a56)
33 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
35 arch/x86/entry/calling.h | 21 +++++++++++++++++++++
36 arch/x86/entry/entry_64.S | 12 ++++++------
37 2 files changed, 27 insertions(+), 6 deletions(-)
39 diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
40 index 640aafebdc00..0b9dd8123701 100644
41 --- a/arch/x86/entry/calling.h
42 +++ b/arch/x86/entry/calling.h
43 @@ -151,6 +151,27 @@ For 32-bit we have the following conventions - kernel is built with
44 UNWIND_HINT_REGS offset=\offset extra=0
47 + .macro POP_EXTRA_REGS
68 .macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1
71 diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
72 index 7c8258e3ad2d..a1a86e782a0e 100644
73 --- a/arch/x86/entry/entry_64.S
74 +++ b/arch/x86/entry/entry_64.S
75 @@ -618,9 +618,9 @@ GLOBAL(swapgs_restore_regs_and_return_to_usermode)
81 - REMOVE_PT_GPREGS_FROM_STACK 8
84 + addq $8, %rsp /* skip regs->orig_ax */
88 @@ -650,9 +650,9 @@ GLOBAL(restore_regs_and_return_to_kernel)
94 - REMOVE_PT_GPREGS_FROM_STACK 8
97 + addq $8, %rsp /* skip regs->orig_ax */