Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4220893pxb; Mon, 8 Feb 2021 10:42:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjuORpsyTzBnM+dXWDGh9xf+qXrH1/80cwJ/oEEW3r567pfrGbcFu2RBr5WWdEl6HcvGkD X-Received: by 2002:a17:906:128e:: with SMTP id k14mr17748612ejb.427.1612809739111; Mon, 08 Feb 2021 10:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612809739; cv=none; d=google.com; s=arc-20160816; b=VQh+c+yN1RII2Vx3VKYDvvLQwbxCLsSF7tOvEfHEIIb26K+JxoEovkcvkJVayzBA5D hINh20iuzBiM7miKUmgeT9CpvsGbi0A1pZ0C3cBV9PlkpuOCjKKmYsP33QxamqD6jcBZ SLb6HV96LVAcaPExRjenck96yWpYbNGvh+JaDk4gIL2RlTE6OzBIr4Bm/Q37xelNg9Fj 8zPU/hZ7n9CH2IdGa2c6gZJX7aoCsxPDT/l0nPqhdr8c3Devg04A2iu3SFQIUCTJF5+K KZVamIlk9W2LOAzVROvNh8NUgujQecSZAn3qkCg/EA9OltWbvOGMmK/DP/T1/t8PoSuM 7MXw== 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=hGiWVAMkh3J18K54lFBdPSUwqfZTeBYTlisCRNS4agk=; b=PlDbv+7fUcY2mbZrdc5ND+CEyXxemC7gMQlKiSUQ8mhgWP7ubLOa2Yqgu5uK8igSpM Gp0P7+tAL8wv6m4gNsoQVFtNLS1HNdyNwhopcYPR87so0H2lqMKBnEpXFQ9Txkw/pCfK LjD/mbqBs5KH+6RvWeHuTwsRbckgZ3kTmr0U5qr/oH/DYL4dUNNVyz4/4DFvcf2+1fam jdNFru3UaxdRUA+Wo5Pdua4lQzTvXkvgf88y+EGN8p4InHi9Dl/bNikyEfcvEEXj7rSM 2IYiOtxojLjxoNLdgZxIOw42iF42+mHm1OJ3jtkxgRN+cpOxIczFgnOT1wXdqMEP16zj s21A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=rHXX9igi; 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 m19si13632667edd.458.2021.02.08.10.41.54; Mon, 08 Feb 2021 10:42:19 -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=rHXX9igi; 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 S235122AbhBHSjN (ORCPT + 99 others); Mon, 8 Feb 2021 13:39:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhBHQd4 (ORCPT ); Mon, 8 Feb 2021 11:33:56 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E453C06178A for ; Mon, 8 Feb 2021 08:33:16 -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=hGiWVAMkh3J18K54lFBdPSUwqfZTeBYTlisCRNS4agk=; b=rHXX9igingjzDgZbeeQUVzMZB0 aTGuIE7EmHevBvAPn6Ztim0rfZtLYcrAYU0awFeim99wVDKdwjNZ7Ku0PEowwMXhki+BnMa+d7k1J GVp5CSVzMCXrXu/dXIqhPT57/N0PVJqdN0E0WhRa5gpFYCZq2TVid7TezaFD7utwk/cEhcJztIwVX 2RUYXjrFI4n3A7azGVynM4Yd06WVasf6W02BXHNN3UCP/w+38qDVmR+joyVJXcOQz5a77ascYc5J2 Fz5qiXGSAW4y3y6NZLV4wzoYiH3NrMWOwtApd6XlrUs09UVUrkhkWqMx4QJZrBnclJ8HPixRIX2P2 5t6nRA2Q==; 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 1l99TJ-0000RD-1A; Mon, 08 Feb 2021 16:33:09 +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 22F16301324; Mon, 8 Feb 2021 17:33:07 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 072512018B25B; Mon, 8 Feb 2021 17:33:07 +0100 (CET) Date: Mon, 8 Feb 2021 17:33:06 +0100 From: Peter Zijlstra To: Andi Kleen Cc: Kuppuswamy Sathyanarayanan , Andy Lutomirski , Dave Hansen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Dan Williams , Raj Ashok , Sean Christopherson , 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: <20210208162301.GA365765@tassilo.jf.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2021 at 08:23:01AM -0800, Andi Kleen wrote: > > Which is supposedly then set up to avoid #VE during the syscall gap, > > yes? Which then results in #VE not having to be IST. > > Yes that is currently true because all memory is pre-accepted. > > If we ever do lazy accept we would need to make sure the memory accessed in > the syscall gap is already accepted, or move over to an IST. I think we're going to mandate the entry text/data will have to be pre-accepted to avoid IST. ISTs really are crap. > > > +#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. > > 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.