[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211110115736.3776-23-jiangshanlai@gmail.com>
Date: Wed, 10 Nov 2021 19:57:08 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Lai Jiangshan <laijs@...ux.alibaba.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH V5 22/50] x86/entry: Don't call error_entry for XENPV
From: Lai Jiangshan <laijs@...ux.alibaba.com>
When in XENPV, it is already in the task stack, and it can't fault
at native_irq_return_iret nor asm_load_gs_index_gs_change since
XENPV uses its own pvops for iret and load_gs_index(). And it
doesn't need to switch CR3. So it can skip invoking error_entry().
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
arch/x86/entry/entry_64.S | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 74c82fb01d36..2f3883d92536 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -325,8 +325,17 @@ SYM_CODE_END(ret_from_fork)
PUSH_AND_CLEAR_REGS
ENCODE_FRAME_POINTER
- call error_entry
- movq %rax, %rsp /* switch stack settled by sync_regs() */
+ /*
+ * Call error_entry and switch stack settled by sync_regs().
+ *
+ * When in XENPV, it is already in the task stack, and it can't fault
+ * at native_irq_return_iret nor asm_load_gs_index_gs_change since
+ * XENPV uses its own pvops for iret and load_gs_index(). And it
+ * doesn't need to switch CR3. So it can skip invoking error_entry().
+ */
+ ALTERNATIVE "call error_entry; movq %rax, %rsp", \
+ "", X86_FEATURE_XENPV
+
ENCODE_FRAME_POINTER
UNWIND_HINT_REGS
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists