Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7715105rwb; Wed, 23 Nov 2022 09:47:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jo43POJSZH5NBL9aNSF65hDdMYqf89xQCbU/Qx2H7U1T/EqdvGOL2c7Cs0pv71CyJ6AV7 X-Received: by 2002:a17:906:29cc:b0:78d:a836:1d88 with SMTP id y12-20020a17090629cc00b0078da8361d88mr9422256eje.470.1669225634802; Wed, 23 Nov 2022 09:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669225634; cv=none; d=google.com; s=arc-20160816; b=PAy5VQZkGCHIDbbn/G+u8HbmIPiN4UT0lfNxXJ/qraaTY23BjKdq23ULPqDyg0YXUd ghphcBdq2PxuG6LZHBv+a45H+HpxhKTNOooXrMSIg+cGJEsF5DwJAiyF5RVxGs10t/sf LPAkyrkFSLGjogMqOZIkC/R5T/g3jaKiI9a4N3BkO7/O8x/mUoAHqcjBK270kBX1FQrd vNjKnLELtJzGsZbBcCz4XogfOoOHMPr5QGY691SLSToHd0Qzrl+pMr/JrQj1feAeXgi1 uiMu7RDXrksgWl2tRXmSl2eHzvhGwQd5cD1C+0itIZk2DtHQwhG2NqGQl0gtIXv1/Pel JPJg== 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=BTJPrqrqSEwhgHq/Fq7SqerFqPYBOzBQre48SjGb0AQ=; b=C2C5ZtNoflNR6s8Zhz+4ANsuAZ9gXPi1Q3vS3exj8TtPT8GVftzMoJdyCVN9r0Ga51 wYf3fSVtWY5QlBhGpJuo9OCg6PvhyaAlbssepCNOUZxEPkD+EEwrz5t2YRcMqejrNDUf Ie4R3ofYP1i0UTziNoQmSchmwg4aBexvVmneyhigbLNw66vO4QyOOFRUj0T013RLv47Q XNhkeTBgdb0QXfXfRN3IjQb5lkSMY1/9J2GnHoeFksCBBn7lydEmriGhB2eDwGVZJmbF Ku5kfoKSIspWWFp8KomXiyxpcqJELWD111porGiyHoNsl4CxoDsNUL9PbWwXs0abrXd5 2Ohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AXeIwTvP; 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 sa31-20020a1709076d1f00b0078dfe6dc4d2si12952731ejc.33.2022.11.23.09.46.50; Wed, 23 Nov 2022 09:47:14 -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=AXeIwTvP; 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 S237774AbiKWRhn (ORCPT + 88 others); Wed, 23 Nov 2022 12:37:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237578AbiKWRhk (ORCPT ); Wed, 23 Nov 2022 12:37:40 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD4913CFF for ; Wed, 23 Nov 2022 09:37:38 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id mv18so8791260pjb.0 for ; Wed, 23 Nov 2022 09:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BTJPrqrqSEwhgHq/Fq7SqerFqPYBOzBQre48SjGb0AQ=; b=AXeIwTvPHhsokCd+EErazsQ8K+lGrncHyEuqRtdoyXhSyIF6UVoIlnqPmu2VPCED60 mHOMk9yvQi+Gkq2gElaHXoFKHK98cKz3dh0r+qnBWB8mkJErZXQtp2n65JXr0nQZLPTv l+uls76z3THb1hzYMsRVgcWtdRMNwMFmxSUgM7S+eDqYs+GCbQPXKxO2yJVTGAP/ciN3 k52M91Nm7cY14fq1v5NDox/uaxslvzh9LZZ0HZ4tYPTwqi75XfG+zmcNIOM4Ob0iU4rM HFJzp8uu18XWOkqNscJmULjVMC+GNteFWjyVJ1aG8Kq6QsGiFl+6ZGWuHQ1zer8WnHrS z7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to: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=BTJPrqrqSEwhgHq/Fq7SqerFqPYBOzBQre48SjGb0AQ=; b=x3uUe/G1yuGCtPfxEk1RE4GCGxiTMOD1pI3EjGxgdICRcfRccBGqo7lAn1xoVCWwNY QrO0uho2swyYJC5arOxCAOZHCdOJHzUK11/Sf2odDQQ7gcQ7ATQKBbzj1Bdgtmbex58D /WyZOZeYRmCEblq7oDBiVYZqhWktZXFYOMI6OoYdORaWkitG/ryyEtO87AN6wKRys6Fm 1DWAf1V2/3mRwGfSkJjzIUseueQvGRN1v6rjK5fJe5u/35g5QF0QB1N1f7pGgt5Zf7UJ hvWNpjOFMmpE3d/Efc+RQ0Dii77oPtBGP+O59P4YQ0flFTqu1KZPnLLzohiSNUz+QvZ0 uu7w== X-Gm-Message-State: ANoB5pljMR+LV2Hp6gJ7n5sbOhqGodIi/f4m2O1LLMUmeP/aa3OfmMtW U8uj79cpeONcHyAXzLPewZHYHA== X-Received: by 2002:a17:903:1250:b0:188:6ccd:f2c5 with SMTP id u16-20020a170903125000b001886ccdf2c5mr10331527plh.6.1669225058240; Wed, 23 Nov 2022 09:37:38 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id j11-20020a170902da8b00b00188f7ad561asm1163747plx.249.2022.11.23.09.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 09:37:37 -0800 (PST) Date: Wed, 23 Nov 2022 17:37:33 +0000 From: Sean Christopherson To: Dave Hansen Cc: "Huang, Kai" , "peterz@infradead.org" , "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> <168ca2b3-ffac-31c4-0b83-2d0ee75f34a5@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <168ca2b3-ffac-31c4-0b83-2d0ee75f34a5@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=ham 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, Dave Hansen wrote: > On 11/23/22 08:20, Sean Christopherson wrote: > >>> 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. > > There's no way we can guarantee _that_. For one, the PAMT* allocations > can always fail. I guess we could ask sysadmins to fire up a guest to > "prime" things, but that seems a little silly. Maybe that would work as > the initial implementation that we merge, but I suspect our users will > demand more determinism, maybe a boot or module parameter. Oh, you mean all of TDX initialization? I thought "initialization" here mean just doing tdx_enable(). Yeah, that's not going to be a viable option. Aside from lacking determinisim, it would be all too easy to end up on a system with fragmented memory that can't allocate the PAMTs post-boot.