On Fri, May 09, 2025 at 05:52:16PM +0800, Chao Gao wrote: > >+static int init_pamt_metadata(void) > >+{ > >+ size_t size = max_pfn / PTRS_PER_PTE * sizeof(*pamt_refcounts); > >+ struct vm_struct *area; > >+ > >+ if (!tdx_supports_dynamic_pamt(&tdx_sysinfo)) > >+ return 0; > >+ > >+ /* > >+ * Reserve vmalloc range for PAMT reference counters. It covers all > >+ * physical address space up to max_pfn. It is going to be populated > >+ * from init_tdmr() only for present memory that available for TDX use. > >+ */ > >+ area = get_vm_area(size, VM_IOREMAP); > >+ if (!area) > >+ return -ENOMEM; > >+ > >+ pamt_refcounts = area->addr; > >+ return 0; > >+} > >+ > >+static void free_pamt_metadata(void) > >+{ > >+ size_t size = max_pfn / PTRS_PER_PTE * sizeof(*pamt_refcounts); > >+ > > Shouldn't the free path also be gated by tdx_supports_dynamic_pamt()? True. Missed this. -- Kiryl Shutsemau / Kirill A. Shutemov