Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7615305rwb; Wed, 23 Nov 2022 08:35:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6d7dBFZXykkM5exfWn93AOgjlEzchy0G8D6G4JEj1VCSp3uccZ+smghWNi3Nvg39MoLKmb X-Received: by 2002:a50:fa86:0:b0:469:cb4d:a529 with SMTP id w6-20020a50fa86000000b00469cb4da529mr9205135edr.30.1669221355599; Wed, 23 Nov 2022 08:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669221355; cv=none; d=google.com; s=arc-20160816; b=rUNZH09CtTgGhjDZwTGcU01W+vCjhC/ruMhspbfOHZ/n/OsBgkEfUkywDCydqL+7Xu wV49XYgBdkrx2or5LMFIkENPv9Iam7JTiZAupa1bH6bwiET+/56H56tRtg3GJC4IY+CL nqrl5pFoQtdlOgu66cUEVRXDyGr3137dssdaQGIYimA5Dc5fH+N2wsEMAlD3PVclD+ZQ uY0LgE/G4ZGrePU7O7p6Z0eRW0rgEQnp9Ce0Y6qIXUbO4jFSoOHzo57Qhz9Pp9RNmL1O 2NKFsYPoAm9lf1r3fxnzW9BmEPEOW8kUIlkDcM8u0mQugUmrr4ev4wGoGIyV6IrINUO+ WRDA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=biytTCPD12F4npEKT0DfXCiC4jXj2dN/DuTN/IJuM4s=; b=LpBzyB2fql9ZYGDV4DISM5988HdjTylBPvVqy+Nau0WspGkuMT1GzggXArDr/hcTtn mdI0xOIMoP+QRf12whhN67qyukD//P8zPx7BhZGllFeYkv6bUPkXa4WGmwQ1nUROPy39 WwEUtVIc4nt0qU7oayxvpvtrPS+KpSDxbqruFG4PBCe4jkAVrdj6yZGIyjHP1NrBs6C3 FLWGq8j0NfJAXaol3gfYYV2pjHY9cBV0cfhonzc0kYwi/Ajd6SkQwbzNfLlp/hpZktYM pwGxgJ882CJnJfZTRNhMIrt5F3fSy8gyE6p39tcPIRK6GK6GWDwvRBBP2gEr4yEoQmbp b4Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AF3yX36R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a170906134c00b007a0b28c324esi654988ejb.1008.2022.11.23.08.35.30; Wed, 23 Nov 2022 08:35:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AF3yX36R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239043AbiKWQUy (ORCPT + 89 others); Wed, 23 Nov 2022 11:20:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239046AbiKWQUt (ORCPT ); Wed, 23 Nov 2022 11:20:49 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D28F8F3EF for ; Wed, 23 Nov 2022 08:20:48 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id b1-20020a17090a7ac100b00213fde52d49so2268955pjl.3 for ; Wed, 23 Nov 2022 08:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=biytTCPD12F4npEKT0DfXCiC4jXj2dN/DuTN/IJuM4s=; b=AF3yX36RbTt6w4YEqeeyFdeC+mAm6+7DlXNR5rnZVktMI8K6LdlLOZ6r6wn5ZFj+Tf lQjlmkDJPf4hsgvCsYB37Q4wWjng3xSdxWBgiqcJ/edqBZfWuAtpjFU9ImN5HhLWbYnd 2RIhMM1aMliGLXZyB4bqFeL7TjrWxPVyvYhaKSOZbmhLU6m3U9IIzf0QYr0NS0QayBMr yYUvc/iHV1UhN1a/Lvy/RMDKFZz9yt0t+j2i83TNzA/8YogsvLzOJ1jiMNJnk0vElcPP UtIk4CJybUNrKl3EUJPbl3KTk9Wif7xwTAQhkeEn58zqTeq7pesgEdvT0lUf75PCyqe5 +tHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=biytTCPD12F4npEKT0DfXCiC4jXj2dN/DuTN/IJuM4s=; b=s9KJh+Y7kRWZthaqLC3rrbt5zvN0FqhF2vzfwzxFrr6CRAzhfWSptuqkzSIAZhKt35 OJulvvIB19Iy8GdJSmO5p5fhZ6TFLDtb3TCp0PRfX2t8trMvLfm873ORy21UMpRxgutu cbaZXAhjtC9D6NzXklcFzmLzOU1zBy0i6I8fwBt67hLp+lZ8j4ip8SmDkQCj953/4ZWt 4m25LK7rbMAVFMy3wTH9x+YgM9PULrm/JnHMTUbzb2jU75GAwzqxLkAsyraT9yR9Y7N5 R1z8meyyr/xAdyaapjbh/NGoCp3ZQ5AINxbwhug+iUEjaXcc6bEjRT3g+DUrpY/huARn Q8vA== X-Gm-Message-State: ANoB5pkLktMNWAUNZfehEhyidpzLtp1yMSuCL4RcKUjbP1ORUeTlXszt LdDGfHKiX9CH0pYVte97TMtniQ== X-Received: by 2002:a17:902:d711:b0:17f:52af:d035 with SMTP id w17-20020a170902d71100b0017f52afd035mr10178670ply.106.1669220447476; Wed, 23 Nov 2022 08:20:47 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id a22-20020a170902b59600b00177f25f8ab3sm14522037pls.89.2022.11.23.08.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 08:20:46 -0800 (PST) Date: Wed, 23 Nov 2022 16:20:43 +0000 From: Sean Christopherson To: "Huang, Kai" Cc: "peterz@infradead.org" , "Hansen, Dave" , "kvm@vger.kernel.org" , "Luck, Tony" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , "Wysocki, Rafael J" , "linux-kernel@vger.kernel.org" , "Chatre, Reinette" , "pbonzini@redhat.com" , "linux-mm@kvack.org" , "Yamahata, Isaku" , "kirill.shutemov@linux.intel.com" , "Shahar, Sagi" , "imammedo@redhat.com" , "Gao, Chao" , "Brown, Len" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Huang, Ying" , "Williams, Dan J" Subject: Re: [PATCH v7 06/20] x86/virt/tdx: Shut down TDX module in case of error Message-ID: References: <48505089b645019a734d85c2c29f3c8ae2dbd6bd.1668988357.git.kai.huang@intel.com> <52b2be9b-defd-63ce-4cb2-96cd624a95a6@intel.com> <791bf9a2-a079-3cd6-90a3-42dbb332a38c@intel.com> <9f1ea2639839305dd8b82694b3d8c697803f43a1.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9f1ea2639839305dd8b82694b3d8c697803f43a1.camel@intel.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23, 2022, Huang, Kai wrote: > On Tue, 2022-11-22 at 17:04 -0800, Dave Hansen wrote: > > On 11/22/22 16:58, Huang, Kai wrote: > > > On Tue, 2022-11-22 at 11:24 -0800, Dave Hansen wrote: > > > > > I was expecting TDX to not get initialized until the first TDX using KVM > > > > > instance is created. Am I wrong? > > > > I went looking for it in this series to prove you wrong. I failed. ???? > > > > > > > > tdx_enable() is buried in here somewhere: > > > > > > > > > https://lore.kernel.org/lkml/CAAhR5DFrwP+5K8MOxz5YK7jYShhaK4A+2h1Pi31U_9+Z+cz-0A@mail.gmail.com/T/ > > > > I don't have the patience to dig it out today, so I guess we'll have Kai > > > > tell us. > > > It will be done when KVM module is loaded, but not when the first TDX guest is > > > created. > > > > Why is it done that way? > > > > Can it be changed to delay TDX initialization until the first TDX guest > > needs to run? > > > > Sean suggested. > > Hi Sean, could you commenet? Waiting until the first TDX guest is created would result in false advertising, as KVM wouldn't know whether or not TDX is actually supported until that first VM is created. If we can guarantee that TDH.SYS.INIT will fail if and only if there is a kernel bug, then I would be ok deferring the "enabling" until the first VM is created.