Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4223748pxb; Mon, 8 Feb 2021 10:46:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyggJCe5AbswIYwUOdYOSKlklCE8BSF51A73AmB+pMElh1olqPaoXiLWJFPrRYRgb0RbJle X-Received: by 2002:a17:906:564f:: with SMTP id v15mr18220915ejr.274.1612809979851; Mon, 08 Feb 2021 10:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612809979; cv=none; d=google.com; s=arc-20160816; b=aF4ZANjQ/pZNQ7iGXrivz0oNl27mrG5MTmweDKMDeEic60R13sJM8fkqQuNkhOPhIO 74uS2tbbNeVyshTumvQ2/TMIU84wZadLfVZNJ7fvgnaPkGCgxX1HTK9KfcSuxO4e/Azx sb6bRUxo1kb9HvXEeS+ayC0gwuinoyd4A1PwNZ4criOBwnIEOogBR5kuJDjG/j/ifKKG zUvyXIzlYRRcUofAos/a1/HJmuE1ovVebNkgCAB0HngBRw4stI/EIiUubUqKsT2U/lOZ aufl/3K09VxryMNj9vlX4Mqakw81XF06TRoSsUe4ogCbyGUvD/Oj8f+K1C39TsdYm8pU k57A== 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=bNIRDaAi2ttUX2BwT0eUxftB7rMbwd0s7iNYvsQxqIM=; b=KWaymnjtmqADbfr89vx6Pd/CKJpjyYmkzqVHRPXBUWXI0Nsi6TWOTmy5HORdR+vhmD gbDCXCTa8yMRQdILIuQaYK8zOCvJBJJ7UPPKAjRCvtrzm6BgzlXuHOngiGlSUI+74aG3 WzNPynbBUQqir6qZXjeGQzLfMEwI/J6Z1tbWVdYUo9dDd5tGqmr98XyM2QqjfMCVT/Do 9FSy5a9QrdPK+rRfr5my/HRVZBC5+K06YkkYqUuBSbgLEEzPUpoSuQtIA14v8JUGF7Qf flsOxslWE8WU7UImTjb0jma5YxcMHlhMiEmkeQQQbDihCVYs9ivamgKa2AwogwgjxwfL Ev8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DvWmqTiX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si11517241ejg.48.2021.02.08.10.45.56; Mon, 08 Feb 2021 10:46: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=@google.com header.s=20161025 header.b=DvWmqTiX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234858AbhBHSoO (ORCPT + 99 others); Mon, 8 Feb 2021 13:44:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234560AbhBHQrL (ORCPT ); Mon, 8 Feb 2021 11:47:11 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F71C06178B for ; Mon, 8 Feb 2021 08:46:30 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id b145so10070775pfb.4 for ; Mon, 08 Feb 2021 08:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bNIRDaAi2ttUX2BwT0eUxftB7rMbwd0s7iNYvsQxqIM=; b=DvWmqTiXK/tfwiqP0CRyLh8rTLUNIVDh34KaTK+LeNoPkBpMUYRJ4wlrOoDkkRvBDE +OzGQ9zai4tYDojdE7z0j65kmDwUE4M3rF9kWiWSS2TH7yD9OP3swFufn+S/exgDnzXh Y8wl6FLvplxW7M/urXzNkR8S7lJ8vWJlg/Y9WNj9JOV7GjFQhw+TbdZ0mhl6WVPfltcn vDPG+g7oulJ+1LjRbmHvnLpwRB/Jw5D5UDkphH6bMSeL7VQFwwxr3yRRb+lh4xCDQsD5 XGl99eh/V1HepufofyxXKpoLUS2hap6H+xhu7kZdmUVBtFcd6HEkPjpoIsF9wvWqlDVt X5ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bNIRDaAi2ttUX2BwT0eUxftB7rMbwd0s7iNYvsQxqIM=; b=G2EAjb2OEOAFQWr5Bi0CleH5Yalf9Ek5/z0b3SfUa/aWKwIQILVr5yq0uiwvabUkyS JCcJrOy4Z6KW43DcrcHDSxLYpKQim8UE9K/z/SoE7KLOrBSfGovGt2Mnr8n29/D3CIce 3okT3XNdztFannEAmtRgnOPbibTcCS7v0AhxDnAkYLQKjk3R/xeTxsBJrbEvlxvK/Ol8 /kZe8Ir6c1gfjfFq+iNxoKU8lxooLalMDR6ryPkjtjwEk6mLhVYTmjdyvVeB0i8gSAcn Mgscx3EmmSKDBnl4LeQ+hJtFeEsehRHDwtcxcvd6S9AaJXTqIaVy7ZW+dHeUl4uEctRX fI5w== X-Gm-Message-State: AOAM531BXqpeVcyf90CZK3eH9XSuqDhhLrdlPw4aXfpH18pxc16YeY6m nGqmZCXcOXCJQxGk63EACZCHvg== X-Received: by 2002:a63:1524:: with SMTP id v36mr17841967pgl.383.1612802790364; Mon, 08 Feb 2021 08:46:30 -0800 (PST) Received: from google.com ([2620:15c:f:10:e4db:abc1:a5c0:9dbc]) by smtp.gmail.com with ESMTPSA id 16sm15991358pjc.28.2021.02.08.08.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 08:46:29 -0800 (PST) Date: Mon, 8 Feb 2021 08:46:23 -0800 From: Sean Christopherson To: Peter Zijlstra 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, 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. > > 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).