[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230704165836.GB462772@hirez.programming.kicks-ass.net>
Date: Tue, 4 Jul 2023 18:58:36 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Isaku Yamahata <isaku.yamahata@...il.com>,
Kai Huang <kai.huang@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
Ashok Raj <ashok.raj@...el.com>,
Tony Luck <tony.luck@...el.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
Dave Hansen <dave.hansen@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
Rafael J Wysocki <rafael.j.wysocki@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
Reinette Chatre <reinette.chatre@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Isaku Yamahata <isaku.yamahata@...el.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"hpa@...or.com" <hpa@...or.com>, Sagi Shahar <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, Chao Gao <chao.gao@...el.com>,
Len Brown <len.brown@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Ying Huang <ying.huang@...el.com>,
Dan J Williams <dan.j.williams@...el.com>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on
demand
On Fri, Jun 30, 2023 at 02:24:56PM -0700, Sean Christopherson wrote:
> Waiting until userspace attempts to create the first TDX guest adds complexity
> and limits what KVM can do to harden itself. Currently, all feature support in
> KVM is effectively frozen at module load. E.g. most of the setup code is
> contained in __init functions, many module-scoped variables are effectively
> RO after init (though they can't be marked as such until we smush kvm-intel.ko
> and kvm-amd.ko into kvm.ko, which is tentatively the long-term plan). All of
> those patterns would get tossed aside if KVM waits until userspace attempts to
> create the first guest.
....
People got poked and the following was suggested:
On boot do:
TDH.SYS.INIT
TDH.SYS.LP.INIT
TDH.SYS.CONFIG
TDH.SYS.KEY.CONFIG
This should get TDX mostly sorted, but doesn't consume much resources.
Then later, when starting the first TDX guest, do the whole
TDH.TDMR.INIT
dance to set up the PAMT array -- which is what gobbles up memory. From
what I understand the TDH.TDMR.INIT thing is not one of those
excessively long calls.
If we have concerns about allocating the PAMT array, can't we use CMA
for this? Allocate the whole thing at boot as CMA such that when not
used for TDX it can be used for regular things like userspace and
filecache pages?
Those TDH.SYS calls should be enough to ensure TDX is actually working,
no?
Powered by blists - more mailing lists