[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YmA1q3PyEEWmDtQy@zn.tnic>
Date: Wed, 20 Apr 2022 18:32:43 +0200
From: Borislav Petkov <bp@...en8.de>
To: Lai Jiangshan <jiangshanlai@...il.com>,
Jürgen Gross <jgross@...e.com>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
Lai Jiangshan <jiangshan.ljs@...group.com>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH V5 5/7] x86/entry: Don't call error_entry() for XENPV
On Tue, Apr 12, 2022 at 08:15:39PM +0800, Lai Jiangshan wrote:
> From: Lai Jiangshan <jiangshan.ljs@...group.com>
>
> 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 there is no reason to call error_entry() in XENPV.
>
> Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.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 7b6a0f15bb20..3aca7815fe79 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -328,8 +328,17 @@ SYM_CODE_END(ret_from_fork)
> PUSH_AND_CLEAR_REGS
> ENCODE_FRAME_POINTER
>
> - 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
>
> --
This one needs Jürgen. CCed.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists