> > > > Hi Mike, > > > > Thanks for feedback. > > > > Perhaps I haven't put a lot details of the new TDX data structures, so let me > > point out that the new two data structures 'struct tdx_memblock' and 'struct > > tdx_memory' that I am proposing are mostly supposed to be used by TDX code only, > > which is pretty standalone. They are not supposed to be some basic > > infrastructure that can be widely used by other random kernel components. > > We already have "pretty standalone" numa_meminfo that originally was used > to setup NUMA memory topology, but now it's used by other code as well. > And e820 tables also contain similar data and they are supposedly should be > used only at boot time, but in reality there are too much callbacks into > e820 way after the system is booted. > > So any additional memory representation will only add to the overall > complexity and well have even more "eventually consistent" collections of > { .start, .end, .flags } structures. > > > In fact, currently the only operation we need is to allow memblock to register > > all memory regions as TDX memory blocks when the memblock is still alive. > > Therefore, in fact, the new data structures can even be completely invisible to > > other kernel components. For instance, TDX code can provide below API w/o > > exposing any data structures to other kernel components: > > > > int tdx_add_memory_block(phys_addr_t start, phys_addr_t end, int nid); > > > > And we call above API for each memory region in memblock when it is alive. > > > > TDX code internally manages those memory regions via the new data structures > > that I mentioned above, so we don't need to keep memblock after boot. The > > advantage of this approach is it is more flexible to support other potential TDX > > memory resources (such as CLX memory) in the future. > > Please let keep things simple. If other TDX memory resources will need > different handling it can be implemented then. For now, just enable > ARCH_KEEP_MEMBLOCK and use memblock to track TDX memory. > Looks good to me. Thanks for the feedback. -- Thanks, -Kai