[PATCH 0/7] libnvdimm/pfn: Fix section-alignment padding

From: Dan Williams
Date: Tue Feb 12 2019 - 16:37:24 EST

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).

See patch 7 "libnvdimm/pfn: Fix 'start_pad' implementation" for more
details, and the ndctl patch series "Improve support + testing for
labels + info-blocks" for the corresponding regression test.


Dan Williams (7):
libnvdimm/pfn: Account for PAGE_SIZE > info-block-size in nd_pfn_init()
libnvdimm/pmem: Honor force_raw for legacy pmem regions
dax: Check the end of the block-device capacity with dax_direct_access()
libnvdimm/pfn: Introduce super-block minimum version requirements
libnvdimm/pfn: Remove dax_label_reserve
libnvdimm/pfn: Introduce 'struct pfn_map_info'
libnvdimm/pfn: Fix 'start_pad' implementation

drivers/dax/pmem.c | 9 +-
drivers/dax/super.c | 39 ++++++--
drivers/nvdimm/namespace_devs.c | 4 +
drivers/nvdimm/nd.h | 15 +++
drivers/nvdimm/pfn.h | 4 +
drivers/nvdimm/pfn_devs.c | 181 ++++++++++++++++++++++++++++-----------
drivers/nvdimm/pmem.c | 111 +++++++++++-------------
drivers/nvdimm/pmem.h | 12 ---
tools/testing/nvdimm/pmem-dax.c | 15 ++-
9 files changed, 244 insertions(+), 146 deletions(-)