Skip to contentSkip to conversation

libnvdimm fixes for 4.6-rc7

GIT PULL Williams, Dan J 1 participant 1 message May 5, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Linus, please pull from:

 git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

...to receive:

1/ A fix for the persistent memory 'struct page' driver.  The implementation overlooked the fact that pages are allocated in 2MB units leading to -ENOMEM when establishing some configurations.  It's tagged for -stable as the problem was introduced with the initial implementation in 4.5.

2/ The new "error status translation" routine, introduced with the 4.6 updates to the nfit driver, missed a necessary path in acpi_nfit_ctl(). End result is that we are falsely assuming commands complete successfully when the embedded status says otherwise.

Full changelog and diff below, these have received a positive build notification from the kbuild robot over 107 configs.
---

The following changes since commit 02da2d72174c61988eb4456b53f405e3ebdebce4:

 Linux 4.6-rc5 (2016-04-24 16:17:05 -0700)

are available in the git repository at:

 git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

for you to fetch changes up to 2eea65829dc6c20dccbe79726fd0f3fe7f8aa43b:

 nfit: fix translation of command status results (2016-05-02 09:11:53 -0700)

----------------------------------------------------------------
Dan Williams (2):
      libnvdimm, pfn: fix memmap reservation sizing
      nfit: fix translation of command status results

 drivers/acpi/nfit.c     5 +-+-+-+-- drivers/nvdimm/pmem.c | 13 +-+-+-+-+-+-+-+-+-+----

 2 files changed, 14 insertions(+-), 4 deletions(-)

commit 658922e57b847bb7112aa67f6441b6bbc6554412
Author: Dan Williams <[email protected]>
Date:   Sat Apr 30 13:07:06 2016 -0700

    libnvdimm, pfn: fix memmap reservation sizing
        When configuring a pfn-device instance to allocate the memmap array it needs to account for the fact that vmemmap_populate_hugepages() allocates struct page blocks in HPAGE_SIZE chunks.  We need to align the reserved area size to 2MB otherwise arch_add_memory() runs out of memory while establishing the memmap:

         WARNING: CPU: 0 PID: 496 at arch/x86/mm/init_64.c:704 arch_add_memory+-0xe7/0xf0
     ..]
     Call Trace:

      <ffffffff8148bdb3>] dump_stack+-0x85/0xc2
      <ffffffff810a749b>] __warn+-0xcb/0xf0
      <ffffffff810a75cd>] warn_slowpath_null+-0x1d/0x20 <ffffffff8106a497>] arch_add_memory+-0xe7/0xf0 <ffffffff811d2097>] devm_memremap_pages+-0x287/0x450 <ffffffff811d1ffa>] ? devm_memremap_pages+-0x1ea/0x450 <ffffffffa0000298>] __wrap_devm_memremap_pages+-0x58/0x70 [nfit_test_iomap] <ffffffffa0047a58>] pmem_attach_disk+-0x318/0x420 [nd_pmem] <ffffffffa0047bcf>] nd_pmem_probe+-0x6f/0x90 [nd_pmem] <ffffffffa0009469>] nvdimm_bus_probe+-0x69/0x110 [libnvdimm] ..]
      ndbus0: nd_pmem.probe(pfn3.0) = -12
     nd_pmem: probe of pfn3.0 failed with error -12
    libndctl: ndctl_pfn_enable: pfn3.0: failed to enable

drivers/nvdimm/pmem.c +0 -0
index f798899338ed..5101f3ab4f29 100644

--- a/drivers/nvdimm/pmem.c
+-+-+- b/drivers/nvdimm/pmem.c
@@ -397,10 +-397,17 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) /
 start +-= start_pad;
 npfns = (pmem->size - start_pad - end_trunc - SZ_8K) / SZ_4K;
- if (nd_pfn->mode == PFN_MODE_PMEM)
- offset = ALIGN(start +- SZ_8K +- 64 * npfns, nd_pfn->align)

+-	if (nd_pfn->mode == PFN_MODE_PMEM) {
+-		unsigned long memmap_size;
+-
+-		/*
+-		  vmemmap_populate_hugepages() allocates the memmap array in
+-		  HPAGE_SIZE chunks.
+-		 /
+-		memmap_size = ALIGN(64 * npfns, HPAGE_SIZE);
+-		offset = ALIGN(start +- SZ_8K +- memmap_size, nd_pfn->align)

  - start;
- else if (nd_pfn->mode == PFN_MODE_RAM)
+- } else if (nd_pfn->mode == PFN_MODE_RAM)
  offset = ALIGN(start +- SZ_8K, nd_pfn->align) - start; else
  goto err;

commit 2eea65829dc6c20dccbe79726fd0f3fe7f8aa43b
Author: Dan Williams <[email protected]>
Date:   Mon May 2 09:11:53 2016 -0700

    nfit: fix translation of command status results
        When transportation of the command completes successfully, it indicates that the 'status' result is valid.  Fix the missed checking and translation of the status field at the end of acpi_nfit_ctl(). Otherwise, we fail to handle reported errors and assume commands complete successfully.

drivers/acpi/nfit.c +0 -0
index d0f35e63640b..63cc9dbe4f3b 100644

--- a/drivers/acpi/nfit.c
+-+-+- b/drivers/acpi/nfit.c
@@ -287,8 +-287,11 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, offset);
  rc = -ENXIO;
  }
- } else
+- } else {
  rc = 0;

+-		if (cmd_rc)
+-			*cmd_rc = xlat_status(buf, cmd);
+-	}

  out:
 ACPI_FREE(out_obj);
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm