OSDN Git Service

libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment
authorDan Williams <dan.j.williams@intel.com>
Mon, 4 Dec 2017 22:07:43 +0000 (14:07 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Dec 2017 16:53:49 +0000 (17:53 +0100)
commit6d80b15a226e59ebbc3ca8c14b65885bc8ffb2b9
treeae931010f8483e343bf2c05f579be41ccf3cc35e
parente7681f90a45a8f0eb6da8c0dc68a8334e3ed2251
libnvdimm, dax: fix 1GB-aligned namespaces vs physical misalignment

commit 41fce90f26333c4fa82e8e43b9ace86c4e8a0120 upstream.

The following namespace configuration attempt:

    # ndctl create-namespace -e namespace0.0 -m devdax -a 1G -f
    libndctl: ndctl_dax_enable: dax0.1: failed to enable
      Error: namespace0.0: failed to enable

    failed to reconfigure namespace: No such device or address

...fails when the backing memory range is not physically aligned to 1G:

    # cat /proc/iomem | grep Persistent
    210000000-30fffffff : Persistent Memory (legacy)

In the above example the 4G persistent memory range starts and ends on a
256MB boundary.

We handle this case correctly when needing to handle cases that violate
section alignment (128MB) collisions against "System RAM", and we simply
need to extend that padding/truncation for the 1GB alignment use case.

Fixes: 315c562536c4 ("libnvdimm, pfn: add 'align' attribute...")
Reported-and-tested-by: Jane Chu <jane.chu@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvdimm/pfn_devs.c