[GIT PULL] libnvdimm fixes for 4.8

2016-09-29 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive the following:

- (4) fixes for "flush hint" support.  Flush hints are addresses
advertised by the ACPI 6+ NFIT (NVDIMM Firmware Interface Table) that
when written and fenced guarantee that writes pending in platform write
buffers (outside the cpu) have been flushed to media.  They might also
be used by hypervisors as a trigger condition to flush guest-persistent 
memory ranges to storage.

Fix a potential data corruption issue, a broken definition of the hint
array, a wrong allocation size for the unit test implementation of the
flush hint table, and missing NULL check in an error path.  The unit
test, while it did not prevent these bugs from being merged, at least
triggered occasional crashes in advance of production usages.

- Fix handling of ACPI DSM error status results.  The DSM mechanism
allows communication with platform and memory device firmware.  We
correctly parse known errors, but were silently ignoring others.  Fix
it to consistently fail any command with a non-zero status return that
we otherwise do not interpret / handle.

These changes have a build success notification from the 0day robot and
have appeared in a -next release over the past week.

The following changes since commit 3be7988674ab33565700a37b210f502563d932e6:

  Linux 4.8-rc7 (2016-09-18 17:27:41 -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 595c73071e6641e59b83911fbb4026e767471000:

  libnvdimm, region: fix flush hint table thinko (2016-09-24 11:45:38 -0700)


Dan Williams (4):
  tools/testing/nvdimm: fix allocation range for mock flush hint tables
  libnvdimm: fix devm_nvdimm_memremap() error path
  nfit: fail DSMs that return non-zero status by default
  libnvdimm, region: fix flush hint table thinko

Oliver O'Halloran (1):
  nvdimm: fix PHYS_PFN/PFN_PHYS mixup

 drivers/acpi/nfit/core.c | 48 +++-
 drivers/nvdimm/core.c|  8 ++-
 drivers/nvdimm/nd.h  | 22 --
 drivers/nvdimm/region_devs.c | 22 ++
 tools/testing/nvdimm/test/nfit.c |  3 ++-
 5 files changed, 70 insertions(+), 33 deletions(-)


commit 480b6837aa579991c6acc113bccf838e6a90843c
Author: Oliver O'Halloran 
Date:   Mon Sep 19 20:19:00 2016 +1000

nvdimm: fix PHYS_PFN/PFN_PHYS mixup

nd_activate_region() iomaps any hint addresses required when activating
a region. To prevent duplicate mappings it checks the PFN of the hint to
be mapped against the PFNs of the already mapped hints. Unfortunately it
doesn't convert the PFN back into a physical address before passing it
to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time
which ends about as well as you would imagine.

Signed-off-by: Oliver O'Halloran 
Signed-off-by: Dan Williams 

commit 9d15ce9caaf9ecbec74e3be156a4a57451ed16c2
Author: Dan Williams 
Date:   Mon Sep 19 13:49:48 2016 -0700

tools/testing/nvdimm: fix allocation range for mock flush hint tables

Commit 480b6837aa57 "nvdimm: fix PHYS_PFN/PFN_PHYS mixup" identified
that we were passing an invalid address to devm_nvdimm_ioremap(). With
that fixed it exposed a bug in the memory reservation size for flush
hint tables.  Since we map a full page we need to mock a full page of
memory to back the flush hint table entries.

Cc: Oliver O'Halloran 
Signed-off-by: Dan Williams 

commit ecfb6d8a041cc2ca80bc69ffc20c00067d190df5
Author: Dan Williams 
Date:   Wed Sep 21 09:22:33 2016 -0700

libnvdimm: fix devm_nvdimm_memremap() error path

The internal alloc_nvdimm_map() helper might fail, particularly if the
memory region is already busy.  Report request_mem_region() failures and
check for the failure.

Reported-by: Ryan Chen 
Signed-off-by: Dan Williams 

commit 11294d63ac915230a36b0603c62134ef7b173d0a
Author: Dan Williams 
Date:   Wed Sep 21 09:21:26 2016 -0700

nfit: fail DSMs that return non-zero status by default

For the DSMs where the kernel knows the format of the output buffer and
originates those DSMs from within the kernel, return -EIO for any
non-zero status.  If the BIOS is indicating a status that we do not know
how to handle, fail the DSM.

Cc: 
Signed-off-by: Dan Williams 

commit 595c73071e6641e59b83911fbb4026e767471000
Author: Dan Williams 
Date:   Fri Sep 23 17:53:52 

[GIT PULL] libnvdimm fixes for 4.8

2016-09-29 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive the following:

- (4) fixes for "flush hint" support.  Flush hints are addresses
advertised by the ACPI 6+ NFIT (NVDIMM Firmware Interface Table) that
when written and fenced guarantee that writes pending in platform write
buffers (outside the cpu) have been flushed to media.  They might also
be used by hypervisors as a trigger condition to flush guest-persistent 
memory ranges to storage.

Fix a potential data corruption issue, a broken definition of the hint
array, a wrong allocation size for the unit test implementation of the
flush hint table, and missing NULL check in an error path.  The unit
test, while it did not prevent these bugs from being merged, at least
triggered occasional crashes in advance of production usages.

- Fix handling of ACPI DSM error status results.  The DSM mechanism
allows communication with platform and memory device firmware.  We
correctly parse known errors, but were silently ignoring others.  Fix
it to consistently fail any command with a non-zero status return that
we otherwise do not interpret / handle.

These changes have a build success notification from the 0day robot and
have appeared in a -next release over the past week.

The following changes since commit 3be7988674ab33565700a37b210f502563d932e6:

  Linux 4.8-rc7 (2016-09-18 17:27:41 -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 595c73071e6641e59b83911fbb4026e767471000:

  libnvdimm, region: fix flush hint table thinko (2016-09-24 11:45:38 -0700)


Dan Williams (4):
  tools/testing/nvdimm: fix allocation range for mock flush hint tables
  libnvdimm: fix devm_nvdimm_memremap() error path
  nfit: fail DSMs that return non-zero status by default
  libnvdimm, region: fix flush hint table thinko

Oliver O'Halloran (1):
  nvdimm: fix PHYS_PFN/PFN_PHYS mixup

 drivers/acpi/nfit/core.c | 48 +++-
 drivers/nvdimm/core.c|  8 ++-
 drivers/nvdimm/nd.h  | 22 --
 drivers/nvdimm/region_devs.c | 22 ++
 tools/testing/nvdimm/test/nfit.c |  3 ++-
 5 files changed, 70 insertions(+), 33 deletions(-)


commit 480b6837aa579991c6acc113bccf838e6a90843c
Author: Oliver O'Halloran 
Date:   Mon Sep 19 20:19:00 2016 +1000

nvdimm: fix PHYS_PFN/PFN_PHYS mixup

nd_activate_region() iomaps any hint addresses required when activating
a region. To prevent duplicate mappings it checks the PFN of the hint to
be mapped against the PFNs of the already mapped hints. Unfortunately it
doesn't convert the PFN back into a physical address before passing it
to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time
which ends about as well as you would imagine.

Signed-off-by: Oliver O'Halloran 
Signed-off-by: Dan Williams 

commit 9d15ce9caaf9ecbec74e3be156a4a57451ed16c2
Author: Dan Williams 
Date:   Mon Sep 19 13:49:48 2016 -0700

tools/testing/nvdimm: fix allocation range for mock flush hint tables

Commit 480b6837aa57 "nvdimm: fix PHYS_PFN/PFN_PHYS mixup" identified
that we were passing an invalid address to devm_nvdimm_ioremap(). With
that fixed it exposed a bug in the memory reservation size for flush
hint tables.  Since we map a full page we need to mock a full page of
memory to back the flush hint table entries.

Cc: Oliver O'Halloran 
Signed-off-by: Dan Williams 

commit ecfb6d8a041cc2ca80bc69ffc20c00067d190df5
Author: Dan Williams 
Date:   Wed Sep 21 09:22:33 2016 -0700

libnvdimm: fix devm_nvdimm_memremap() error path

The internal alloc_nvdimm_map() helper might fail, particularly if the
memory region is already busy.  Report request_mem_region() failures and
check for the failure.

Reported-by: Ryan Chen 
Signed-off-by: Dan Williams 

commit 11294d63ac915230a36b0603c62134ef7b173d0a
Author: Dan Williams 
Date:   Wed Sep 21 09:21:26 2016 -0700

nfit: fail DSMs that return non-zero status by default

For the DSMs where the kernel knows the format of the output buffer and
originates those DSMs from within the kernel, return -EIO for any
non-zero status.  If the BIOS is indicating a status that we do not know
how to handle, fail the DSM.

Cc: 
Signed-off-by: Dan Williams 

commit 595c73071e6641e59b83911fbb4026e767471000
Author: Dan Williams 
Date:   Fri Sep 23 17:53:52 2016 -0700

libnvdimm, region: fix flush hint table thinko

The definition of the flush hint table as:

void __iomem *flush_wpq[0][0];

...passed the unit test, but is broken as flush_wpq[0][1] and
flush_wpq[1][0] refer to the same entry.  Fix this to use a helper that

[GIT PULL] libnvdimm fixes for 4.8-rc6

2016-09-10 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive nvdimm fixes for v4.8, two of them are tagged for
-stable:

- Fix devm_memremap_pages() to use track_pfn_insert(). Otherwise, DAX
pmd mappings end up with an uncached pgprot, and unusable performance
for the device-dax interface.  The device-dax interface appeared in 4.7
so this is tagged for -stable.

- Fix a couple VM_BUG_ON() checks in the show_smaps() path to
understand DAX pmd entries.  This fix is tagged for -stable.

- Fix a mis-merge of the nfit machine-check handler to flip the
polarity of an if() to match the final version of the patch that Vishal
sent for 4.8-rc1.  Without this the nfit machine check handler never
detects / inserts new 'badblocks' entries which applications use to
identify lost portions of files.

- For test purposes, fix the nvdimm_clear_poison() path to operate on
legacy / simulated nvdimm memory ranges.  Without this fix a test can
set badblocks, but never clear them on these ranges.

- Fix the range checking done by dax_dev_pmd_fault().  This is not
tagged for -stable since this problem is mitigated by specifying
aligned resources at device-dax setup time.

These patches have appeared in a next release over the past week.  The
recent rebase you can see in the timestamps was to drop an invalid fix
as identified by the updated device-dax unit tests [1].  The -mm
touches have an ack from Andrew.

[1]: "[ndctl PATCH 0/3] device-dax test for recent kernel bugs"
https://lists.01.org/pipermail/linux-nvdimm/2016-September/006855.html

The following changes since commit 3eab887a55424fc2c27553b7bfe32330df83f7b8:

  Linux 4.8-rc4 (2016-08-28 15:04:33 -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 1e8b8d9619f9476e94f32eb20cab000d50d236aa:

  libnvdimm: allow legacy (e820) pmem region to clear bad blocks (2016-09-09 
17:34:46 -0700)


Dan Williams (3):
  dax: fix mapping size check
  mm: fix show_smap() for zone_device-pmd ranges
  mm: fix cache mode of dax pmd mappings

Dave Jiang (1):
  libnvdimm: allow legacy (e820) pmem region to clear bad blocks

Vishal Verma (1):
  nfit, mce: Fix SPA matching logic in MCE handler

 arch/x86/mm/pat.c   | 17 ++---
 drivers/acpi/nfit/mce.c |  2 +-
 drivers/dax/dax.c   |  2 +-
 drivers/nvdimm/bus.c|  6 +-
 fs/proc/task_mmu.c  |  2 ++
 kernel/memremap.c   |  9 +
 mm/huge_memory.c|  4 ++--
 7 files changed, 30 insertions(+), 12 deletions(-)

commit 4c3cb6e9a9d94d1553807854a565cd27ff4c22aa
Author: Dan Williams 
Date:   Sat Sep 3 10:36:00 2016 -0700

dax: fix mapping size check

pgoff_to_phys() validates that both the starting address and the length
of the mapping against the resource list.  We need to check for a
mapping size of PMD_SIZE not PAGE_SIZE in the pmd fault path.

Signed-off-by: Dan Williams 

commit ca120cf688874f4423e579e7cc5ddf7244aeca45
Author: Dan Williams 
Date:   Sat Sep 3 10:38:03 2016 -0700

mm: fix show_smap() for zone_device-pmd ranges

Attempting to dump /proc//smaps for a process with pmd dax mappings
currently results in the following VM_BUG_ONs:

 kernel BUG at mm/huge_memory.c:1105!
 task: 88045f16b140 task.stack: 88045be14000
 RIP: 0010:[]  [] 
follow_trans_huge_pmd+0x2cb/0x340
 [..]
 Call Trace:
  [] smaps_pte_range+0xa0/0x4b0
  [] ? vsnprintf+0x255/0x4c0
  [] __walk_page_range+0x1fe/0x4d0
  [] walk_page_vma+0x62/0x80
  [] show_smap+0xa6/0x2b0

 kernel BUG at fs/proc/task_mmu.c:585!
 RIP: 0010:[]  [] 
smaps_pte_range+0x499/0x4b0
 Call Trace:
  [] ? vsnprintf+0x255/0x4c0
  [] __walk_page_range+0x1fe/0x4d0
  [] walk_page_vma+0x62/0x80
  [] show_smap+0xa6/0x2b0

These locations are sanity checking page flags that must be set for an
anonymous transparent huge page, but are not set for the zone_device
pages associated with dax mappings.

Cc: Ross Zwisler 
Cc: Kirill A. Shutemov 
Acked-by: Andrew Morton 
Signed-off-by: Dan Williams 

commit 9049771f7d5490a302589976984810064c83ab40
Author: Dan Williams 
Date:   Wed Sep 7 08:51:21 2016 -0700

mm: fix cache mode of dax pmd mappings

track_pfn_insert() in vmf_insert_pfn_pmd() is marking dax mappings as
uncacheable rendering them impractical for application usage.  DAX-pte
mappings are cached and the goal of establishing DAX-pmd mappings is to
attain more performance, not dramatically less (3 orders of magnitude).


[GIT PULL] libnvdimm fixes for 4.8-rc6

2016-09-10 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive nvdimm fixes for v4.8, two of them are tagged for
-stable:

- Fix devm_memremap_pages() to use track_pfn_insert(). Otherwise, DAX
pmd mappings end up with an uncached pgprot, and unusable performance
for the device-dax interface.  The device-dax interface appeared in 4.7
so this is tagged for -stable.

- Fix a couple VM_BUG_ON() checks in the show_smaps() path to
understand DAX pmd entries.  This fix is tagged for -stable.

- Fix a mis-merge of the nfit machine-check handler to flip the
polarity of an if() to match the final version of the patch that Vishal
sent for 4.8-rc1.  Without this the nfit machine check handler never
detects / inserts new 'badblocks' entries which applications use to
identify lost portions of files.

- For test purposes, fix the nvdimm_clear_poison() path to operate on
legacy / simulated nvdimm memory ranges.  Without this fix a test can
set badblocks, but never clear them on these ranges.

- Fix the range checking done by dax_dev_pmd_fault().  This is not
tagged for -stable since this problem is mitigated by specifying
aligned resources at device-dax setup time.

These patches have appeared in a next release over the past week.  The
recent rebase you can see in the timestamps was to drop an invalid fix
as identified by the updated device-dax unit tests [1].  The -mm
touches have an ack from Andrew.

[1]: "[ndctl PATCH 0/3] device-dax test for recent kernel bugs"
https://lists.01.org/pipermail/linux-nvdimm/2016-September/006855.html

The following changes since commit 3eab887a55424fc2c27553b7bfe32330df83f7b8:

  Linux 4.8-rc4 (2016-08-28 15:04:33 -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 1e8b8d9619f9476e94f32eb20cab000d50d236aa:

  libnvdimm: allow legacy (e820) pmem region to clear bad blocks (2016-09-09 
17:34:46 -0700)


Dan Williams (3):
  dax: fix mapping size check
  mm: fix show_smap() for zone_device-pmd ranges
  mm: fix cache mode of dax pmd mappings

Dave Jiang (1):
  libnvdimm: allow legacy (e820) pmem region to clear bad blocks

Vishal Verma (1):
  nfit, mce: Fix SPA matching logic in MCE handler

 arch/x86/mm/pat.c   | 17 ++---
 drivers/acpi/nfit/mce.c |  2 +-
 drivers/dax/dax.c   |  2 +-
 drivers/nvdimm/bus.c|  6 +-
 fs/proc/task_mmu.c  |  2 ++
 kernel/memremap.c   |  9 +
 mm/huge_memory.c|  4 ++--
 7 files changed, 30 insertions(+), 12 deletions(-)

commit 4c3cb6e9a9d94d1553807854a565cd27ff4c22aa
Author: Dan Williams 
Date:   Sat Sep 3 10:36:00 2016 -0700

dax: fix mapping size check

pgoff_to_phys() validates that both the starting address and the length
of the mapping against the resource list.  We need to check for a
mapping size of PMD_SIZE not PAGE_SIZE in the pmd fault path.

Signed-off-by: Dan Williams 

commit ca120cf688874f4423e579e7cc5ddf7244aeca45
Author: Dan Williams 
Date:   Sat Sep 3 10:38:03 2016 -0700

mm: fix show_smap() for zone_device-pmd ranges

Attempting to dump /proc//smaps for a process with pmd dax mappings
currently results in the following VM_BUG_ONs:

 kernel BUG at mm/huge_memory.c:1105!
 task: 88045f16b140 task.stack: 88045be14000
 RIP: 0010:[]  [] 
follow_trans_huge_pmd+0x2cb/0x340
 [..]
 Call Trace:
  [] smaps_pte_range+0xa0/0x4b0
  [] ? vsnprintf+0x255/0x4c0
  [] __walk_page_range+0x1fe/0x4d0
  [] walk_page_vma+0x62/0x80
  [] show_smap+0xa6/0x2b0

 kernel BUG at fs/proc/task_mmu.c:585!
 RIP: 0010:[]  [] 
smaps_pte_range+0x499/0x4b0
 Call Trace:
  [] ? vsnprintf+0x255/0x4c0
  [] __walk_page_range+0x1fe/0x4d0
  [] walk_page_vma+0x62/0x80
  [] show_smap+0xa6/0x2b0

These locations are sanity checking page flags that must be set for an
anonymous transparent huge page, but are not set for the zone_device
pages associated with dax mappings.

Cc: Ross Zwisler 
Cc: Kirill A. Shutemov 
Acked-by: Andrew Morton 
Signed-off-by: Dan Williams 

commit 9049771f7d5490a302589976984810064c83ab40
Author: Dan Williams 
Date:   Wed Sep 7 08:51:21 2016 -0700

mm: fix cache mode of dax pmd mappings

track_pfn_insert() in vmf_insert_pfn_pmd() is marking dax mappings as
uncacheable rendering them impractical for application usage.  DAX-pte
mappings are cached and the goal of establishing DAX-pmd mappings is to
attain more performance, not dramatically less (3 orders of magnitude).

track_pfn_insert() relies on a previous call to reserve_memtype() to
establish the expected page_cache_mode for the range.  While memremap()
arranges for reserve_memtype() to be called, devm_memremap_pages() does

[GIT PULL] libnvdimm fixes for 4.8-rc2

2016-08-12 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive:

- Fix for the nd_blk (NVDIMM Block Window Aperture) driver.  A spec
clarification requires the driver to mask off reserved bits in status
register. This is tagged for -stable back to the v4.2 kernel.

- Fix for a kernel crash in the nvdimm unit tests when module loading
is interrupted with SIGTERM. Tagged for -stable since validation
efforts external to Intel use the unit tests for qualifying backports.

- Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
Translation Table) driver to make it symmetric with the other namespace
personality drivers (PFN and DAX) that provide a size attribute for
indicating how much namespace capacity is lost to metadata.

The BTT change arrived at the start of the merge window and has
appeared in a -next release.  It can technically wait for 4.9, but it
is small, fixes asymmetry in the libnvdimm-sysfs interface, and
something I would have squeezed into the v4.8 pull request had it
arrived a few days earlier.

---

The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:

  Linux 4.8-rc1 (2016-08-07 18:18:00 -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 d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2:

  tools/testing/nvdimm: fix SIGTERM vs hotplug crash (2016-08-10 15:59:09 -0700)


Dan Williams (1):
  tools/testing/nvdimm: fix SIGTERM vs hotplug crash

Ross Zwisler (1):
  libnvdimm, nd_blk: mask off reserved status bits

Vishal Verma (1):
  nvdimm, btt: add a size attribute for BTTs

 drivers/acpi/nfit/core.c |  3 ++-
 drivers/nvdimm/btt.c |  1 +
 drivers/nvdimm/btt_devs.c| 20 
 drivers/nvdimm/nd.h  |  1 +
 tools/testing/nvdimm/test/nfit.c |  2 ++
 5 files changed, 26 insertions(+), 1 deletion(-)

commit 68202c9f0ad6e16ee806fbadbc5838d55fe5aa5c
Author: Ross Zwisler 
Date:   Fri Jul 29 14:59:12 2016 -0600

libnvdimm, nd_blk: mask off reserved status bits

The "NVDIMM Block Window Driver Writer's Guide":

http://pmem.io/documents/NVDIMM_DriverWritersGuide-July-2016.pdf

...defines the layout of the block window status register.  For the July
2016 version of the spec linked to above, this happens in Figure 4 on
page 26.

The only bits defined in this spec are bits 31, 5, 4, 2, 1 and 0.  The
rest of the bits in the status register are reserved, and there is a
warning following the diagram that says:

Note: The driver cannot assume the value of the RESERVED bits in the
status register are zero. These reserved bits need to be masked off, and
the driver must avoid checking the state of those bits.

This change ensures that for hardware implementations that set these
reserved bits in the status register, the driver won't incorrectly fail the
block I/Os.

Cc:  #v4.2+
Reviewed-by: Lee, Chun-Yi 
Signed-off-by: Ross Zwisler 
Signed-off-by: Dan Williams 

commit abe8b4e3cef88b8202641d63f5ad58141b970b0f
Author: Vishal Verma 
Date:   Wed Jul 27 16:38:59 2016 -0600

nvdimm, btt: add a size attribute for BTTs

To be consistent with other namespaces, expose a 'size' attribute for
BTT devices also.

Cc: Dan Williams 
Reported-by: Linda Knippers 
Signed-off-by: Vishal Verma 
Signed-off-by: Dan Williams 

commit d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2
Author: Dan Williams 
Date:   Wed Aug 10 15:59:09 2016 -0700

tools/testing/nvdimm: fix SIGTERM vs hotplug crash

The unit tests crash when hotplug races the previous probe. This race
requires that the loading of the nfit_test module be terminated with
SIGTERM, and the module to be unloaded while the ars scan is still
running.

In contrast to the normal nfit driver, the unit test calls
acpi_nfit_init() twice to simulate hotplug, whereas the nominal case
goes through the acpi_nfit_notify() event handler.  The
acpi_nfit_notify() path is careful to flush the previous region
registration before servicing the hotplug event. The unit test was
missing this guarantee.

 BUG: unable to handle kernel NULL pointer dereference at   (null)
 IP: [] pwq_activate_delayed_work+0x47/0x170
 [..]
 Call Trace:
  [] pwq_dec_nr_in_flight+0x66/0xa0
  [] process_one_work+0x2d0/0x680
  [] ? process_one_work+0x171/0x680
  [] worker_thread+0x4e/0x480
  [] ? 

[GIT PULL] libnvdimm fixes for 4.8-rc2

2016-08-12 Thread Williams, Dan J
Hi Linus, please pull from:

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

...to receive:

- Fix for the nd_blk (NVDIMM Block Window Aperture) driver.  A spec
clarification requires the driver to mask off reserved bits in status
register. This is tagged for -stable back to the v4.2 kernel.

- Fix for a kernel crash in the nvdimm unit tests when module loading
is interrupted with SIGTERM. Tagged for -stable since validation
efforts external to Intel use the unit tests for qualifying backports.

- Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
Translation Table) driver to make it symmetric with the other namespace
personality drivers (PFN and DAX) that provide a size attribute for
indicating how much namespace capacity is lost to metadata.

The BTT change arrived at the start of the merge window and has
appeared in a -next release.  It can technically wait for 4.9, but it
is small, fixes asymmetry in the libnvdimm-sysfs interface, and
something I would have squeezed into the v4.8 pull request had it
arrived a few days earlier.

---

The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:

  Linux 4.8-rc1 (2016-08-07 18:18:00 -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 d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2:

  tools/testing/nvdimm: fix SIGTERM vs hotplug crash (2016-08-10 15:59:09 -0700)


Dan Williams (1):
  tools/testing/nvdimm: fix SIGTERM vs hotplug crash

Ross Zwisler (1):
  libnvdimm, nd_blk: mask off reserved status bits

Vishal Verma (1):
  nvdimm, btt: add a size attribute for BTTs

 drivers/acpi/nfit/core.c |  3 ++-
 drivers/nvdimm/btt.c |  1 +
 drivers/nvdimm/btt_devs.c| 20 
 drivers/nvdimm/nd.h  |  1 +
 tools/testing/nvdimm/test/nfit.c |  2 ++
 5 files changed, 26 insertions(+), 1 deletion(-)

commit 68202c9f0ad6e16ee806fbadbc5838d55fe5aa5c
Author: Ross Zwisler 
Date:   Fri Jul 29 14:59:12 2016 -0600

libnvdimm, nd_blk: mask off reserved status bits

The "NVDIMM Block Window Driver Writer's Guide":

http://pmem.io/documents/NVDIMM_DriverWritersGuide-July-2016.pdf

...defines the layout of the block window status register.  For the July
2016 version of the spec linked to above, this happens in Figure 4 on
page 26.

The only bits defined in this spec are bits 31, 5, 4, 2, 1 and 0.  The
rest of the bits in the status register are reserved, and there is a
warning following the diagram that says:

Note: The driver cannot assume the value of the RESERVED bits in the
status register are zero. These reserved bits need to be masked off, and
the driver must avoid checking the state of those bits.

This change ensures that for hardware implementations that set these
reserved bits in the status register, the driver won't incorrectly fail the
block I/Os.

Cc:  #v4.2+
Reviewed-by: Lee, Chun-Yi 
Signed-off-by: Ross Zwisler 
Signed-off-by: Dan Williams 

commit abe8b4e3cef88b8202641d63f5ad58141b970b0f
Author: Vishal Verma 
Date:   Wed Jul 27 16:38:59 2016 -0600

nvdimm, btt: add a size attribute for BTTs

To be consistent with other namespaces, expose a 'size' attribute for
BTT devices also.

Cc: Dan Williams 
Reported-by: Linda Knippers 
Signed-off-by: Vishal Verma 
Signed-off-by: Dan Williams 

commit d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2
Author: Dan Williams 
Date:   Wed Aug 10 15:59:09 2016 -0700

tools/testing/nvdimm: fix SIGTERM vs hotplug crash

The unit tests crash when hotplug races the previous probe. This race
requires that the loading of the nfit_test module be terminated with
SIGTERM, and the module to be unloaded while the ars scan is still
running.

In contrast to the normal nfit driver, the unit test calls
acpi_nfit_init() twice to simulate hotplug, whereas the nominal case
goes through the acpi_nfit_notify() event handler.  The
acpi_nfit_notify() path is careful to flush the previous region
registration before servicing the hotplug event. The unit test was
missing this guarantee.

 BUG: unable to handle kernel NULL pointer dereference at   (null)
 IP: [] pwq_activate_delayed_work+0x47/0x170
 [..]
 Call Trace:
  [] pwq_dec_nr_in_flight+0x66/0xa0
  [] process_one_work+0x2d0/0x680
  [] ? process_one_work+0x171/0x680
  [] worker_thread+0x4e/0x480
  [] ? process_one_work+0x680/0x680
  [] ? process_one_work+0x680/0x680
  [] kthread+0xf3/0x110
  [] ret_from_fork+0x1f/0x40
  [] ? kthread_create_on_node+0x230/0x230

Cc: 
Signed-off-by: Dan Williams