On 24.10.19 14:09, David Hildenbrand wrote:
This is the result of a recent discussion with Michal ([1], [2]). Right now we set all pages PG_reserved when initializing hotplugged memmaps. This includes ZONE_DEVICE memory. In case of system memory, PG_reserved is cleared again when onlining the memory, in case of ZONE_DEVICE memory never. In ancient times, we needed PG_reserved, because there was no way to tell whether the memmap was already properly initialized. We now have SECTION_IS_ONLINE for that in the case of !ZONE_DEVICE memory. ZONE_DEVICE memory is already initialized deferred, and there shouldn't be a visible change in that regard. One of the biggest fears were side effects. I went ahead and audited all users of PageReserved(). The details can be found in "mm/memory_hotplug: Don't mark pages PG_reserved when initializing the memmap". This patch set adapts all relevant users of PageReserved() to keep the existing behavior in respect to ZONE_DEVICE pages. The biggest part part that needs changes is KVM, to keep the existing behavior (that's all I care about in this series). Note that this series is able to rely completely on pfn_to_online_page(). No new is_zone_device_page() calles are introduced (as requested by Dan). We are currently discussing a way to mark also ZONE_DEVICE memmaps as active/initialized - pfn_active() - and lightweight locking to make sure memmaps remain active (e.g., using RCU). We might later be able to convert some suers of pfn_to_online_page() to pfn_active(). Details can be found in [3], however, this represents yet another cleanup/fix we'll perform on top of this cleanup. I only gave it a quick test with DIMMs on x86-64, but didn't test the ZONE_DEVICE part at all (any tips for a nice QEMU setup?). Also, I didn't test the KVM parts (especially with ZONE_DEVICE pages or no memmap at all). Compile-tested on x86-64 and PPC.
Jeff Moyer ran some NVDIMM test cases for me (thanks!!!), including xfstests, pmdk, and ndctl. No regressions found.
I will run some KVM tests, especially NDIMM passthrough, but will have to setup a test environment first.
I would appreciate some review in the meantime. :) -- Thanks, David / dhildenb _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel