From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C2ABC433F5 for ; Wed, 20 Apr 2022 16:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380623AbiDTQfv (ORCPT ); Wed, 20 Apr 2022 12:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380628AbiDTQfq (ORCPT ); Wed, 20 Apr 2022 12:35:46 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D3643EDC for ; Wed, 20 Apr 2022 09:32:54 -0700 (PDT) Received: from zn.tnic (p200300ea971b58ed329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:58ed:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 631221EC0104; Wed, 20 Apr 2022 18:32:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1650472367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9UyBlcyj9qmPmLqcx+Y9IVqbgazV7crvGV9M069W33g=; b=kiEG+mOgRrJDs9kkDSzfs3HRsquiuc6o84iYCAbyH3h3FzrMTnqNZ0q6kk9yoTRfMqMzbK 07895Hkv4GbvryjlB/upmx0ALyblW2kpYs5XqVAGBic4V7EPHZTt75s6QLgHy/DDQbxxD9 fWf7k+nbG2V4scjKjixDxI6Kq+LQ/A8= Date: Wed, 20 Apr 2022 18:32:43 +0200 From: Borislav Petkov To: Lai Jiangshan , =?utf-8?Q?J=C3=BCrgen?= Gross Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , Thomas Gleixner , x86@kernel.org, Lai Jiangshan , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH V5 5/7] x86/entry: Don't call error_entry() for XENPV Message-ID: References: <20220412121541.4595-1-jiangshanlai@gmail.com> <20220412121541.4595-6-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220412121541.4595-6-jiangshanlai@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 12, 2022 at 08:15:39PM +0800, Lai Jiangshan wrote: > From: Lai Jiangshan > > 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 > --- > 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