Re: [PATCH v15 08/23] x86/virt/tdx: Use all system memory when initializing TDX module as TDX memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 05, 2024 at 11:06:17AM +0200, Nikolay Borisov wrote:
> 
> 
> On 5.12.24 г. 9:57 ч., Mike Rapoport wrote:
> > Hi,
> > 
> > I've been auditing for_each_mem_pfn_range() users and it's usage in TDX is
> > dubious for me.
> > 
> > On Fri, Nov 10, 2023 at 12:55:45AM +1300, Kai Huang wrote:
> > > 
> > > As TDX-usable memory is a fixed configuration, take a snapshot of the
> > > memory configuration from memblocks at the time of module initialization
> > > (memblocks are modified on memory hotplug).  This snapshot is used to
> > 
> > AFAUI this could happen long after free_initmem() which discards all
> > memblock data on x86.
> > >> enable TDX support for *this* memory configuration only.  Use a memory
> > > hotplug notifier to ensure that no other RAM can be added outside of
> > > this configuration.
> > ...
> > 
> > > +/*
> > > + * Ensure that all memblock memory regions are convertible to TDX
> > > + * memory.  Once this has been established, stash the memblock
> > > + * ranges off in a secondary structure because memblock is modified
> > > + * in memory hotplug while TDX memory regions are fixed.
> > > + */
> > > +static int build_tdx_memlist(struct list_head *tmb_list)
> > > +{
> > > +	unsigned long start_pfn, end_pfn;
> > > +	int i, ret;
> > > +
> > > +	for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) {
> > 
> > Unles ARCH_KEEP_MEMBLOCK is defined this won't work after free_initmem()
> 
> TDX_HOST actually selects ARCH_KEEP_MEMBLOCK:

Oh, I've missed that, thanks!
 
>   6 config INTEL_TDX_HOST
>    5         bool "Intel Trust Domain Extensions (TDX) host support"
>    4         depends on CPU_SUP_INTEL
>    3         depends on X86_64
>    2         depends on KVM_INTEL
>    1         depends on X86_X2APIC
> 1980         select ARCH_KEEP_MEMBLOCK
>    1         depends on CONTIG_ALLOC
>    2         depends on !KEXEC_CORE
>    3         depends on X86_MCE
> 
> 
> <snip>
> 

-- 
Sincerely yours,
Mike.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux