As noted in the kernel patches for this issue:
Lately Linux has encountered platforms that collide Persistent
Memory regions between each other, specifically cases where
->start_pad needed to be non-zero. This lead to commit ae86cbfef381
"libnvdimm, pfn: Pad pfn namespaces relative to other regions". That
commit allowed namespaces to be mapped with devm_memremap_pages().
However dax operations on those configurations currently fail if
attempted within the ->start_pad range because
pmem_device->data_offset was still relative to raw resource base not
relative to the section aligned resource range mapped by
devm_memremap_pages().
Luckily __bdev_dax_supported() caught these failures and simply
disabled dax. However, to fix this situation a non-backwards
compatible change needs to be made to the interpretation of the
nd_pfn info-block. ->start_pad needs to be accounted in
->map.map_offset (formerly ->data_offset), and ->map.map_base
(formerly ->phys_addr) needs to be adjusted to the section aligned
resource base used to establish ->map.map formerly (formerly
->virt_addr).
Towards preventing similar bugs in this area introduce a regression
test "test/collide.sh" to validate support for pre- and post-fixed
kernels. In the course of developing this test a few missing
capabilities and fixes also surfaced.
---
Dan Williams (8):
ndctl/dimm: Add 'flags' field to read-labels output
ndctl/dimm: Add --human support to read-labels
ndctl/build: Drop -Wpointer-arith
ndctl/namespace: Add read-info-block command
ndctl/test: Update dax-dev to handle multiple e820 ranges
ndctl/test: Make dax.sh more robust vs small namespaces
ndctl/namespace: Always zero info-blocks
ndctl/test: Test inter-region collision handling
configure.ac | 1
ndctl/action.h | 1
ndctl/builtin.h | 1
ndctl/check.c | 20 --
ndctl/dimm.c | 21 ++-
ndctl/namespace.c | 416 +++++++++++++++++++++++++++++++++++++++++++++++++-
ndctl/namespace.h | 51 ++++++
ndctl/ndctl.c | 1
test/Makefile.am | 1
test/collide.sh | 226 +++++++++++++++++++++++++++
test/dax-dev.c | 17 ++
test/dax.sh | 4
test/fsdax-info0.xxd | 11 +
test/fsdax-info1.xxd | 11 +
test/fsdax-info2.xxd | 11 +
test/fsdax-info3.xxd | 11 +
util/fletcher.h | 1
util/size.h | 1
18 files changed, 763 insertions(+), 43 deletions(-)
create mode 100755 test/collide.sh
create mode 100644 test/fsdax-info0.xxd
create mode 100644 test/fsdax-info1.xxd
create mode 100644 test/fsdax-info2.xxd
create mode 100644 test/fsdax-info3.xxd
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm