From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0094C4332F for ; Wed, 23 Nov 2022 17:37:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED9BA6B0071; Wed, 23 Nov 2022 12:37:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E89156B0073; Wed, 23 Nov 2022 12:37:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D788C6B0074; Wed, 23 Nov 2022 12:37:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C87756B0071 for ; Wed, 23 Nov 2022 12:37:39 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A44411C5978 for ; Wed, 23 Nov 2022 17:37:39 +0000 (UTC) X-FDA: 80165414238.13.51C0205 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf25.hostedemail.com (Postfix) with ESMTP id 5052FA0013 for ; Wed, 23 Nov 2022 17:37:39 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id t17so15760544pjo.3 for ; Wed, 23 Nov 2022 09:37:39 -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=XJ7E6y+ulenFIttwAEYsDft+Jnog+FMGTJKJg+NAawvluoWS+lBbqrfDBjNuoHEXmu uHSjmal2imhlJOTBmUcYjNP5vu1LRgw851iTI7BPqMy2eIQdt1tUUNmkHjJ9nFHU6uQB eubXc+PCRDFHG6FGdE1GYGEcGDJdEIxx37KhZLEVKB23IJMQ7EROURsT+yrVpS5BHLqP fowwAqcLnqbdkoOr0Knp5yVX148k9hoZWli68bTjk6YZlmaI4vmxQg9XGjiJBGwL35gu K+VVazHufX2k64GZwNxnKX/FrvLFrmfZMN1CJZp3kKPKe+ow/yWmEiLUMEsreLAl6kBW qOwA== X-Gm-Message-State: ANoB5pnf88hHtMHxIYbB/MLFpChn1gBLFlMZOgV0hd2Qx9/z+AINdM6s UgFjRQP6nC5if+qm4jCajceKSg== X-Google-Smtp-Source: AA0mqf7xphM5oz2jsApOp1Egc3rjQzspTFKB7OyQetps+UBwK7ZlkxAJ3k6ifjL4pknC+ROvb0Qnuw== 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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669225059; a=rsa-sha256; cv=none; b=yIUx0Cbf+F/Zj357fman1zMqwaADHpGwKtik6gKeWAMgIYB9fKmbTGUu/TtBP4e6KW+44i PCBlqp2qxw7GCowJUQ6iR38MvLpzwm5iO3QJJwa8ZIO4UgaHifpgyhuSCD7necqnniiyHa AFRupB67PrOyzhqwa4VMdXh+Eu+UhBk= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=AXeIwTvP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of seanjc@google.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=seanjc@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669225059; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BTJPrqrqSEwhgHq/Fq7SqerFqPYBOzBQre48SjGb0AQ=; b=kFdLo4SJtwoCma6LEIB+kZ96v8pnWE5Nrroug+DuydNW6SYW8DBRhz6LqyjRLckFZv0xtV 7ld8107UhdNN1nup5R0qdUaOTnKrFS1uu9XaV+ek2RmXYd88l9TzpGLIY11cAWdtLvuZXa GOUJC2Lvw9uffipmuPmY0f80nBaeiQ0= Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=AXeIwTvP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of seanjc@google.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=seanjc@google.com X-Stat-Signature: 9z973qw9suag9eagr67zmrar5qremq8c X-Rspamd-Queue-Id: 5052FA0013 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1669225059-108614 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000143, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.