Re: [PATCH v7 10/20] x86/virt/tdx: Use all system memory when initializing TDX module as TDX memory

From: Peter Zijlstra
Date: Wed Nov 23 2022 - 04:31:39 EST


On Tue, Nov 22, 2022 at 04:21:38PM -0800, Dave Hansen wrote:
> > + /*
> > + * All memory regions that can be used by the TDX module must be
> > + * passed to the TDX module during the module initialization.
> > + * Once this is done, all "TDX-usable" memory regions are fixed
> > + * during module's runtime.
> > + *
> > + * The initial support of TDX guests only allocates memory from
> > + * the global page allocator. To keep things simple, for now
> > + * just make sure all pages in the page allocator are TDX memory.
> > + *
> > + * To achieve this, use all system memory in the core-mm at the
> > + * time of initializing the TDX module as TDX memory, and at the
> > + * meantime, reject any new memory in memory hot-add.
> > + *
> > + * This works as in practice, all boot-time present DIMM is TDX
> > + * convertible memory. However if any new memory is hot-added
> > + * before initializing the TDX module, the initialization will
> > + * fail due to that memory is not covered by CMR.
> > + *
> > + * This can be enhanced in the future, i.e. by allowing adding or
> > + * onlining non-TDX memory to a separate node, in which case the
> > + * "TDX-capable" nodes and the "non-TDX-capable" nodes can exist
> > + * together -- the userspace/kernel just needs to make sure pages
> > + * for TDX guests must come from those "TDX-capable" nodes.
> > + *
> > + * Build the list of TDX memory regions as mentioned above so
> > + * they can be passed to the TDX module later.
> > + */
>
> This is msotly Documentation/, not a code comment. Please clean it up.

So personally, I *vastly* prefer code comments over this Documentation/
cesspit. Putting things in Documentation/ is a bit like an
old-folks-home, neatly out of the way to (bit)rot in peace.

And that whole .rst disease is making it unreadable for anybody that
still knows how to use a text editor :-(