Skip to contentSkip to conversation

libnvdimm fixes for 4.2-rc2

GIT PULL Williams, Dan J 1 participant 1 message Jul 12, 2015

Subsystems (2)
lore
Share & tools
lore

Williams, Dan J

author Acked-by Rafael J. Wysocki Acked-by Rafael J. Wysocki
#0 lore raw

Hi Linus, please pull from:

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

...to receive:

1/ Fixes for a handful of smatch reports (Thanks Dan C.!) and minor
bug fixes (patches 1-6)

2/ Correctness fixes to the BLK-mode nvdimm driver (patches 7-10).
Granted these are slightly large for a -rc update. They have been out for review in one form or another since the end of May and were deferred from the merge window while we settled on the "PMEM API" for the PMEM-mode nvdimm driver (i.e. memremap_pmem, memcpy_to_pmem, and wmb_pmem). Now that those apis are merged we implement them in the BLK driver to guarantee that mmio aperture moves stay ordered with respect to incoming read/write requests, and that writes are flushed through those mmio-windows and platform-buffers to be persistent on media.

These pass the sub-system unit tests with the updates to tools/testing/nvdimm, and have received a successful build-report from the kbuild robot (468 configs). Full git log below with acks from Rafael for the touches to drivers/acpi/.

[PATCH 01/10] sparse: fix misplaced __pmem definition
[PATCH 02/10] libnvdimm: smatch cleanups in __nd_ioctl
[PATCH 03/10] nvdimm: Fix return value of nvdimm_bus_init() if class_create() fails [PATCH 04/10] nfit: fix smatch "use after null check" report
[PATCH 05/10] pmem: add maintainer for include/linux/pmem.h
[PATCH 06/10] tools/testing/nvdimm: mock ioremap_wt
[PATCH 07/10] tools/testing/nvdimm: fix return code for unimplemented commands [PATCH 08/10] tools/testing/nvdimm: add mock acpi_nfit_flush_address entries to nfit_test [PATCH 09/10] nfit: update block I/O path to use PMEM API
[PATCH 10/10] nfit: add support for NVDIMM "latch" flag

The following changes since commit 88793e5c774ec69351ef6b5200bb59f532e41bca:

Merge tag 'libnvdimm-for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm (2015-06-29 10:34:42 -0700)

are available in the git repository at:

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

for you to fetch changes up to f0f2c072cf530d5b8890be5051cc8b36b0c54cce:

nfit: add support for NVDIMM "latch" flag (2015-07-10 14:43:50 -0400)

----------------------------------------------------------------
Axel Lin (1):
nvdimm: Fix return value of nvdimm_bus_init() if class_create() fails

Dan Williams (6):
sparse: fix misplaced __pmem definition
libnvdimm: smatch cleanups in __nd_ioctl
nfit: fix smatch "use after null check" report tools/testing/nvdimm: mock ioremap_wt
tools/testing/nvdimm: fix return code for unimplemented commands tools/testing/nvdimm: add mock acpi_nfit_flush_address entries to nfit_test

Ross Zwisler (3):
pmem: add maintainer for include/linux/pmem.h
nfit: update block I/O path to use PMEM API
nfit: add support for NVDIMM "latch" flag

 MAINTAINERS                       |   1 +
 drivers/acpi/nfit.c               | 134 ++++++++++++++++++++++++++++++++++----
 drivers/acpi/nfit.h               |  20 +++++-
 drivers/nvdimm/bus.c              |  11 +---
 include/linux/compiler.h          |   2 +-
 tools/testing/nvdimm/Kbuild       |   3 +
 tools/testing/nvdimm/test/iomap.c |  27 ++++++++
 tools/testing/nvdimm/test/nfit.c  |  52 ++++++++++++++-
 8 files changed, 223 insertions(+), 27 deletions(-)

commit 31f02455455d405320e2f749696bef4e02903b35

Author: Dan Williams <[email protected]>
Date:   Tue Jun 30 12:07:17 2015 -0400

sparse: fix misplaced __pmem definition

Move the definition of __pmem outside of CONFIG_SPARSE_RCU_POINTER to fix:

drivers/nvdimm/pmem.c:198:17: sparse: too many arguments for function __builtin_expect drivers/nvdimm/pmem.c:36:33: sparse: expected ; at end of declaration drivers/nvdimm/pmem.c:48:21: sparse: void declaration

...due to __pmem failing to be defined in some configurations when CONFIG_SPARSE_RCU_POINTER=y.

commit af834d457d9ed69e14836b63d0da198fdd2ec706

Author: Dan Williams <[email protected]>
Date:   Tue Jun 30 14:10:09 2015 -0400

libnvdimm: smatch cleanups in __nd_ioctl

Drop use of access_ok() since we are already using copy_{to|from}_user() which do their own access_ok().

commit daa1dee405d7d3d3e816b84a692e838a5647a02a

Author: Axel Lin <[email protected]>
Date:   Sun Jun 28 17:00:57 2015 +0800

nvdimm: Fix return value of nvdimm_bus_init() if class_create() fails

Return proper error if class_create() fails.

commit 193ccca43850d2355e7690a93ab9d7d78d38f905

Author: Dan Williams <[email protected]>
Date:   Tue Jun 30 16:09:39 2015 -0400
    nfit: fix smatch "use after null check" report
    
    drivers/acpi/nfit.c:1224 acpi_nfit_blk_region_enable()
             error: we previously assumed 'nfit_mem' could be null (see line 1223)
    
    drivers/acpi/nfit.c
      1222          nfit_mem = nvdimm_provider_data(nvdimm);
      1223          if (!nfit_mem || !nfit_mem->dcr || !nfit_mem->bdw) {
                         ^^^^^^^^
    Check.
    
      1224                  dev_dbg(dev, "%s: missing%s%s%s\n", __func__,
      1225                                  nfit_mem ? "" : " nfit_mem",
      1226                                  nfit_mem->dcr ? "" : " dcr",
                                            ^^^^^^^^^^^^^
    Unchecked dereference.
    
    Reported-by: Dan Carpenter <[email protected]>
    Acked-by: Ross Zwisler <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>

commit b864bc17f1c326783f2388057e15d3e153125ab9

Author: Ross Zwisler <[email protected]>
Date:   Fri Jul 10 11:06:10 2015 -0600

pmem: add maintainer for include/linux/pmem.h

The file include/linux/pmem.h was recently created to hold the PMEM API, and is logically part of the PMEM driver. Add an entry for this file to MAINTAINERS.

commit b1b2e6235a44174151fa3bb22657f74972635618

Author: Dan Williams <[email protected]>
Date:   Fri Jul 10 11:06:11 2015 -0600

tools/testing/nvdimm: mock ioremap_wt

In the 4.2-rc1 merge the default_memremap_pmem() implementation switched from ioremap_nocache() to ioremap_wt(). Add it to the list of mocked routines to restore the ability to run the unit tests.

commit f7ec83684af020c961d7fab801f8e3ef7ce5de33

Author: Dan Williams <[email protected]>
Date:   Fri Jul 10 11:06:12 2015 -0600

tools/testing/nvdimm: fix return code for unimplemented commands

The implementation for the new "DIMM Flags" DSM relies on the -ENOTTY return code to indicate that the flags are unimplimented and to fall back to a safe default. As is the -ENXIO error code erroneoously indicates to fail enabling a BLK region.

commit 9d27a87ec9e1317d368b1e5e3f4808078baa8c4c

Author: Dan Williams <[email protected]>
Date:   Fri Jul 10 14:07:03 2015 -0400

tools/testing/nvdimm: add mock acpi_nfit_flush_address entries to nfit_test

In preparation for fixing the BLK path to properly use "directed pcommit" enable the unit test infrastructure to emit mock "flush" tables. Writes to these flush addresses trigger a memory controller to flush its internal buffers to persistent media, similar to the x86 "pcommit" instruction.

commit c2ad29540cb913bd9e526fae77c35c7fb45f24a3

Author: Ross Zwisler <[email protected]>
Date:   Fri Jul 10 11:06:13 2015 -0600

nfit: update block I/O path to use PMEM API

Update the nfit block I/O path to use the new PMEM API and to adhere to the read/write flows outlined in the "NVDIMM Block Window Driver Writer's Guide":

http://pmem.io/documents/NVDIMM_Driver_Writers_Guide.pdf

This includes adding support for targeted NVDIMM flushes called "flush hints" in the ACPI 6.0 specification:

http://www.uefi.org/sites/default/files/resources/ACPI_6.0.pdf

For performance and media durability the mapping for a BLK aperture is moved to a write-combining mapping which is consistent with memcpy_to_pmem() and wmb_blk().

commit f0f2c072cf530d5b8890be5051cc8b36b0c54cce

Author: Ross Zwisler <[email protected]>
Date:   Fri Jul 10 11:06:14 2015 -0600

nfit: add support for NVDIMM "latch" flag

Add support in the NFIT BLK I/O path for the "latch" flag defined in the "Get Block NVDIMM Flags" _DSM function:

http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf

This flag requires the driver to read back the command register after it is written in the block I/O path. This ensures that the hardware has fully processed the new command and moved the aperture appropriately.