Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4230388pxb; Mon, 8 Feb 2021 10:57:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBNkglxXOH9l38I549D7pGfrJUAuvWf8EBOEgcgCI7Y2EaknzPEvmtlJTcFKn6T73rMLtZ X-Received: by 2002:a05:6402:50ce:: with SMTP id h14mr18412495edb.283.1612810668106; Mon, 08 Feb 2021 10:57:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612810668; cv=none; d=google.com; s=arc-20160816; b=vMZu9UcIXDjjqMNO2/8AH4qXn6N823BXPekIFc1MumSJ1kUXGCj6UzA346Xoa/r3of Co69OJQVR8oa8MF2uBovToVB/rVGKkAWoeoGriZ4Alc5Tp+fbfk09KAWmu9W+KFOWmlT gT8HolrmbrkyjfqC/WE1LxuoQUbnZzwCyOtisvCDLomwCJzJosJzcgEaBaMQ1iHXWbCH SVh8FTEfVZ3ebEj0bMUr9s/N15oFMq0RAVabMwsiauCtUAuCwxOweob6jHxJjTxMcXNQ BF8CcabfyswzOv3SBaEQXvMMRU1/pPVy9g4I28oQa/65mVk0EBVW1rI5+6BvFnPrNu9V Lh0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vmozN1g5LQmAFpPJNsn4DIDXXJw2IeO1GJ7wsREQXLU=; b=aSwi4LsrggGTaLtX3Lf46mNhXx+k8gjxaaZy7xSy3spek4FM7D5Re8f1OhpmK+C1fJ ynfEWuqAHmRUsex5X+DlynbKySrpFOLY+1FS9YPf7JTcbmNlr2rcrXp+bIQDFw5RVA0C iA3WJAXVCJ7FOFZbn0GQtXsryFD3Mp2OKGFkL8DUbJzxRdXPg+3VURhZb6aem2GPdMPN /Bj2NtwneAu8AW3VE1V1b9qrUB1sPpboWPGoYcN4H6qW3mF+KcDgazxAcQSTesM+WkHY w8bapmJzhylHLgk3XZurBmDLo5HnuAtrl889fbeXFl4m9SmDnmOtvWfhQNSoBjOicIuj zfLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=RH6Q4qHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si1714032eja.553.2021.02.08.10.57.22; Mon, 08 Feb 2021 10:57:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=RH6Q4qHb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235856AbhBHSwo (ORCPT + 99 others); Mon, 8 Feb 2021 13:52:44 -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.