Re: [PATCH v3 00/21] TDX host kernel support

From: Kai Huang
Date: Wed Apr 27 2022 - 21:21:54 EST


On Wed, 2022-04-27 at 18:01 -0700, Dan Williams wrote:
> On Tue, Apr 26, 2022 at 1:10 PM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
> [..]
> > > 3. Memory hotplug
> > >
> > > The first generation of TDX architecturally doesn't support memory
> > > hotplug. And the first generation of TDX-capable platforms don't support
> > > physical memory hotplug. Since it physically cannot happen, this series
> > > doesn't add any check in ACPI memory hotplug code path to disable it.
> > >
> > > A special case of memory hotplug is adding NVDIMM as system RAM using
>
> Saw "NVDIMM" mentioned while browsing this, so stopped to make a comment...
>
> > > kmem driver. However the first generation of TDX-capable platforms
> > > cannot enable TDX and NVDIMM simultaneously, so in practice this cannot
> > > happen either.
> >
> > What prevents this code from today's code being run on tomorrow's
> > platforms and breaking these assumptions?
>
> The assumption is already broken today with NVDIMM-N. The lack of
> DDR-T support on TDX enabled platforms has zero effect on DDR-based
> persistent memory solutions. In other words, please describe the
> actual software and hardware conflicts at play here, and do not make
> the mistake of assuming that "no DDR-T support on TDX platforms" ==
> "no NVDIMM support".

Sorry I got this information from planning team or execution team I guess. I was
told NVDIMM and TDX cannot "co-exist" on the first generation of TDX capable
machine. "co-exist" means they cannot be turned on simultaneously on the same
platform. I am also not aware NVDIMM-N, nor the difference between DDR based
and DDR-T based persistent memory. Could you give some more background here so
I can take a look?

>
> > > Another case is admin can use 'memmap' kernel command line to create
> > > legacy PMEMs and use them as TD guest memory, or theoretically, can use
> > > kmem driver to add them as system RAM. To avoid having to change memory
> > > hotplug code to prevent this from happening, this series always include
> > > legacy PMEMs when constructing TDMRs so they are also TDX memory.
>
> I am not sure what you are trying to say here?

We want to always make sure the memory managed by page allocator is TDX memory.
So if the legacy PMEMs are unconditionally configured as TDX memory, then we
don't need to prevent them from being added as system memory via kmem driver.

>
> > > 4. CPU hotplug
> > >
> > > The first generation of TDX architecturally doesn't support ACPI CPU
> > > hotplug. All logical cpus are enabled by BIOS in MADT table. Also, the
> > > first generation of TDX-capable platforms don't support ACPI CPU hotplug
> > > either. Since this physically cannot happen, this series doesn't add any
> > > check in ACPI CPU hotplug code path to disable it.
>
> What are the actual challenges posed to TDX with respect to CPU hotplug?

During the TDX module initialization, there is a step to call SEAMCALL on all
logical cpus to initialize per-cpu TDX staff. TDX doesn't support initializing
the new hot-added CPUs after the initialization. There are MCHECK/BIOS changes
to enforce this check too I guess but I don't know details about this.

>
> > > Also, only TDX module initialization requires all BIOS-enabled cpus are
>
> Please define "BIOS-enabled" cpus. There is no "BIOS-enabled" line in
> /proc/cpuinfo for example.

It means the CPUs with "enable" bit set in the MADT table.


--
Thanks,
-Kai