selftests/dax: add dax/kmem hotplug sysfs regression testAdd a kselftest for the dax/kmem whole-device "state" sysfs attribute(/sys/bus/dax/devices/daxX.Y/state), which transitions a kmem-backedd
selftests/dax: add dax/kmem hotplug sysfs regression testAdd a kselftest for the dax/kmem whole-device "state" sysfs attribute(/sys/bus/dax/devices/daxX.Y/state), which transitions a kmem-backeddax device between "unplugged", "online" and "online_movable".The kselftest also includes a test to demonstrate the force-unbinddoes not deadlock - but this is destructive (the dax device can neverbe rebound), so it only runs when DAX_KMEM_TEST_UNBIND=1 is set.Provisioning a devdax device and binding it to kmem needs daxctl/ndctlout of scope for an in-tree selftest. As the test mutates a device'smemory, the operator opts in by naming it in DAX_KMEM_TEST_DEV (or"auto" to pick the first kmem-bound device); it SKIPs when unset, whenno device is present, or when the memory cannot be freed to a baseline.When a device is available it validates the interface contract: - online / online_movable actually add memory (MemTotal grows), - online is idempotent, - switching between online types without unplug is rejected, - unplug removes memory and the reported state is "unplugged" - invalid input is rejected, - unplug and unbind tolerate blocks toggled out-of-band through the per-block memoryX/state interface.One specific regression test: online -> unplug -> online_movable -> unplugRe-online must re-reserve per-range resources so subsequent unplugactually offlines and removes instead of silently reporting successwhile the memory stays online.Link: https://lore.kernel.org/20260712154505.3564379-11-gourry@gourry.netSigned-off-by: Gregory Price <gourry@gourry.net>Cc: Alison Schofield <alison.schofield@intel.com>Cc: Danilo Krummrich <dakr@kernel.org>Cc: Dave Jiang <dave.jiang@intel.com>Cc: David Hildenbrand (Arm) <david@kernel.org>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>Cc: Hannes Reinecke <hare@suse.de>Cc: Liam R. Howlett <liam@infradead.org>Cc: Lorenzo Stoakes <ljs@kernel.org>Cc: Michal Hocko <mhocko@suse.com>Cc: Mike Rapoport <rppt@kernel.org>Cc: Oscar Salvador <osalvador@suse.de>Cc: Pankaj Gupta <pankaj.gupta@amd.com>Cc: "Rafael J. Wysocki" <rafael@kernel.org>Cc: Shuah Khan <shuah@kernel.org>Cc: Suren Baghdasaryan <surenb@google.com>Cc: Vishal Verma <vishal.l.verma@intel.com>Cc: Vlastimil Babka <vbabka@kernel.org>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
show more ...