On Mon, Aug 5, 2024 at 7:06 PM Dan Williams <dan.j.williams@xxxxxxxxx> wrote: > > Pasha Tatashin wrote: > [..] > > Thank you for the heads up. Can you please attach a full config file, > > also was anyone able to reproduce this problem in qemu with emulated > > nvdimm? > > Yes, I can reproduce the crash just by trying to reconfigure the mode of > a pmem namespace: > > # ndctl create-namespace -m raw -f -e namespace0.0 > > ...where namespace0.0 results from: > > memmap=4G!4G > > ...passed on the kernel command line. > > Kernel config here: > > https://gist.github.com/djbw/143705077103d43a735c179395d4f69a Excellent, I was able to reproduce this problem. The problem appear to be caused by this code: Calling page_pgdat() in depopulate_section_memmap(): static void depopulate_section_memmap(unsigned long pfn, unsigned long nr_pages, struct vmem_altmap *altmap) { unsigned long start = (unsigned long) pfn_to_page(pfn); unsigned long end = start + nr_pages * sizeof(struct page); mod_node_page_state(page_pgdat(pfn_to_page(pfn)), NR_MEMMAP, <<<< We cannot do it. -1L * (DIV_ROUND_UP(end - start, PAGE_SIZE))); vmemmap_free(start, end, altmap); } The page_pgdat() returns NULL starting from: pageunmap_range() remove_pfn_range_from_zone() <- page is removed from the zone. Pasha