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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70009C4332B for ; Mon, 8 Feb 2021 18:53:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CBC564E5A for ; Mon, 8 Feb 2021 18:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235867AbhBHSwq (ORCPT ); Mon, 8 Feb 2021 13:52:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbhBHRAl (ORCPT ); Mon, 8 Feb 2021 12:00:41 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7C9AC06178A for ; Mon, 8 Feb 2021 09:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vmozN1g5LQmAFpPJNsn4DIDXXJw2IeO1GJ7wsREQXLU=; b=RH6Q4qHbanMcy6idw/w/seE7Ux hHHYX8g5cdR6doD79r2sxwaw/pcsH+5PaOTyIYiT0SdIqM3lUapfBYi/Unxe0H+/wukrjx7lH63Mk iwX9DcfT4GzYmq19g7Z4LPjfG6mlSwf21FT7jmKFGvV4MsHiNcbbgaiPs9WHw6tbfFRMLox2Plggo 3CGp5lLp8rS/jIO93k1HGDwQIGWRyf26PbkRm0ku2bvWo5MkElB1DbQcYP72Q/5+T23K1PM9/oTeW 3XYATudwfHSO5/EB6NIXFcALvoWz9nKuhhH5kXdUwyYMa8oHYjEcgEegYeMxwRwObPvzGsethqRSl jWD1tZvA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l99tA-0006Lq-Sp; Mon, 08 Feb 2021 16:59:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 88B7F306099; Mon, 8 Feb 2021 17:59:50 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 74C0B2846AE56; Mon, 8 Feb 2021 17:59:50 +0100 (CET) Date: Mon, 8 Feb 2021 17:59:50 +0100 From: Peter Zijlstra To: Sean Christopherson Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , Andy Lutomirski , Dave Hansen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , linux-kernel@vger.kernel.org, Sean Christopherson Subject: Re: [RFC v1 05/26] x86/traps: Add #VE support for TDX guest Message-ID: References: <48a702f536ccf953eee5778023ed6d1a452f6dcf.1612563142.git.sathyanarayanan.kuppuswamy@linux.intel.com> <20210208162301.GA365765@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2021 at 08:46:23AM -0800, Sean Christopherson wrote: > On Mon, Feb 08, 2021, Peter Zijlstra wrote: > > On Mon, Feb 08, 2021 at 08:23:01AM -0800, Andi Kleen wrote: > > > > > +#ifdef CONFIG_INTEL_TDX_GUEST > > > > > +DEFINE_IDTENTRY(exc_virtualization_exception) > > > > > +{ > > > > > + struct ve_info ve; > > > > > + int ret; > > > > > + > > > > > + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); > > > > > + > > > > > + /* Consume #VE info before re-enabling interrupts */ > > > > > > > > So what happens if NMI happens here, and triggers a nested #VE ? > > > > > > Yes that's a gap. We should probably bail out and reexecute the original > > > instruction. The VE handler would need to set a flag for that. > > No, NMI cannot happen here. The TDX-Module "blocks" NMIs until the #VE info is > consumed by the guest. 'cute', might be useful to have that mentioned somewhere. > > > Or alternatively the NMI always gets the VE information and puts > > > it on some internal stack, but that would seem clunkier. > > > > The same is possible with MCE and #DB I imagine. > > The MCE "architecture" for a TDX guest is rather stupid. The guest is required > to keep CR4.MCE=1, but at least for TDX 1.0 the VMM is not allowed to inject #MC. > So, for better or worse, #MC is a non-issue. > > #VE->#DB->#VE would be an issue, presumably this needs to be noinstr (or whatever > it is that prevents #DBs on functions). Ah, it is that already ofcourse, so yeah #DB can't happen here.