[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165160446318.4207.9852653161107393222.tip-bot2@tip-bot2>
Date: Tue, 03 May 2022 19:01:03 -0000
From: "tip-bot2 for Lai Jiangshan" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Lai Jiangshan <jiangshan.ljs@...group.com>,
Borislav Petkov <bp@...e.de>, Juergen Gross <jgross@...e.com>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/asm] x86/entry: Don't call error_entry() for XENPV
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 64cbd0acb58203fb769ed2f4eab526d43e243847
Gitweb: https://git.kernel.org/tip/64cbd0acb58203fb769ed2f4eab526d43e243847
Author: Lai Jiangshan <jiangshan.ljs@...group.com>
AuthorDate: Tue, 03 May 2022 11:21:06 +08:00
Committer: Borislav Petkov <bp@...e.de>
CommitterDate: Tue, 03 May 2022 12:21:35 +02:00
x86/entry: Don't call error_entry() for XENPV
XENPV guests enter already on the task stack and they can't fault for
native_iret() nor native_load_gs_index() since they use their own pvop
for IRET and load_gs_index(). A CR3 switch is not needed either.
So there is no reason to call error_entry() in XENPV.
[ bp: Massage commit message. ]
Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Reviewed-by: Juergen Gross <jgross@...e.com>
Link: https://lore.kernel.org/r/20220503032107.680190-6-jiangshanlai@gmail.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 ab6ab6d..062aa9d 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -336,8 +336,17 @@ SYM_CODE_END(push_and_clear_regs)
call push_and_clear_regs
UNWIND_HINT_REGS
- call error_entry
- movq %rax, %rsp /* switch to the task stack if from userspace */
+ /*
+ * Call error_entry() and switch to the task stack if from userspace.
+ *
+ * When in XENPV, it is already in the task stack, and it can't fault
+ * for native_iret() nor native_load_gs_index() since XENPV uses its
+ * own pvops for IRET and load_gs_index(). And it doesn't need to
+ * switch the CR3. So it can skip invoking error_entry().
+ */
+ ALTERNATIVE "call error_entry; movq %rax, %rsp", \
+ "", X86_FEATURE_XENPV
+
ENCODE_FRAME_POINTER
UNWIND_HINT_REGS
Powered by blists - more mailing lists