[GIT PULL] libnvdimm fixes for 4.8-rc6

From: Williams, Dan J
Date: Sat Sep 10 2016 - 11:45:14 EST


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+AF8-memremap+AF8-pages() to use track+AF8-pfn+AF8-insert(). Otherwise, DAX
pmd mappings end up with an uncached pgprot, and unusable performance
for the device-dax interface. +AKA-The device-dax interface appeared in 4.7
so this is tagged for -stable.

- Fix a couple VM+AF8-BUG+AF8-ON() checks in the show+AF8-smaps() path to
understand DAX pmd entries. +AKA-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. +AKA-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+AF8-clear+AF8-poison() path to operate on
legacy / simulated nvdimm memory ranges. +AKA-Without this fix a test can
set badblocks, but never clear them on these ranges.

- Fix the range checking done by dax+AF8-dev+AF8-pmd+AF8-fault(). +AKA-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. +AKA-The
recent rebase you can see in the timestamps was to drop an invalid fix
as identified by the updated device-dax unit tests +AFs-1+AF0-. +AKA-The -mm
touches have an ack from Andrew.

+AFs-1+AF0-: +ACIAWw-ndctl PATCH 0/3+AF0- device-dax test for recent kernel bugs+ACI-
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+AF8-smap() for zone+AF8-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 +AHw- 17 +-+-+-+-+-+-+-+-+-+--------
drivers/acpi/nfit/mce.c +AHw- 2 +--
drivers/dax/dax.c +AHw- 2 +--
drivers/nvdimm/bus.c +AHw- 6 +-+-+-+-+--
fs/proc/task+AF8-mmu.c +AHw- 2 +-+-
kernel/memremap.c +AHw- 9 +-+-+-+-+-+-+-+-+-
mm/huge+AF8-memory.c +AHw- 4 +-+---
7 files changed, 30 insertions(+-), 12 deletions(-)

commit 4c3cb6e9a9d94d1553807854a565cd27ff4c22aa
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Sat Sep 3 10:36:00 2016 -0700

dax: fix mapping size check

pgoff+AF8-to+AF8-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+AF8-SIZE not PAGE+AF8-SIZE in the pmd fault path.

Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit ca120cf688874f4423e579e7cc5ddf7244aeca45
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Sat Sep 3 10:38:03 2016 -0700

mm: fix show+AF8-smap() for zone+AF8-device-pmd ranges

Attempting to dump /proc/+ADw-pid+AD4-/smaps for a process with pmd dax mappings
currently results in the following VM+AF8-BUG+AF8-ONs:

kernel BUG at mm/huge+AF8-memory.c:1105+ACE-
task: ffff88045f16b140 task.stack: ffff88045be14000
RIP: 0010:+AFsAPA-ffffffff81268f9b+AD4AXQ- +AFsAPA-ffffffff81268f9b+AD4AXQ- follow+AF8-trans+AF8-huge+AF8-pmd+-0x2cb/0x340
+AFs-..+AF0-
Call Trace:
+AFsAPA-ffffffff81306030+AD4AXQ- smaps+AF8-pte+AF8-range+-0xa0/0x4b0
+AFsAPA-ffffffff814c2755+AD4AXQ- ? vsnprintf+-0x255/0x4c0
+AFsAPA-ffffffff8123c46e+AD4AXQ- +AF8AXw-walk+AF8-page+AF8-range+-0x1fe/0x4d0
+AFsAPA-ffffffff8123c8a2+AD4AXQ- walk+AF8-page+AF8-vma+-0x62/0x80
+AFsAPA-ffffffff81307656+AD4AXQ- show+AF8-smap+-0xa6/0x2b0

kernel BUG at fs/proc/task+AF8-mmu.c:585+ACE-
RIP: 0010:+AFsAPA-ffffffff81306469+AD4AXQ- +AFsAPA-ffffffff81306469+AD4AXQ- smaps+AF8-pte+AF8-range+-0x499/0x4b0
Call Trace:
+AFsAPA-ffffffff814c2795+AD4AXQ- ? vsnprintf+-0x255/0x4c0
+AFsAPA-ffffffff8123c46e+AD4AXQ- +AF8AXw-walk+AF8-page+AF8-range+-0x1fe/0x4d0
+AFsAPA-ffffffff8123c8a2+AD4AXQ- walk+AF8-page+AF8-vma+-0x62/0x80
+AFsAPA-ffffffff81307696+AD4AXQ- show+AF8-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+AF8-device
pages associated with dax mappings.

Cc: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Cc: Kirill A. Shutemov +ADw-kirill.shutemov+AEA-linux.intel.com+AD4-
Acked-by: Andrew Morton +ADw-akpm+AEA-linux-foundation.org+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 9049771f7d5490a302589976984810064c83ab40
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Wed Sep 7 08:51:21 2016 -0700

mm: fix cache mode of dax pmd mappings

track+AF8-pfn+AF8-insert() in vmf+AF8-insert+AF8-pfn+AF8-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+AF8-pfn+AF8-insert() relies on a previous call to reserve+AF8-memtype() to
establish the expected page+AF8-cache+AF8-mode for the range. While memremap()
arranges for reserve+AF8-memtype() to be called, devm+AF8-memremap+AF8-pages() does
not. So, teach track+AF8-pfn+AF8-insert() and untrack+AF8-pfn() how to handle
tracking without a vma, and arrange for devm+AF8-memremap+AF8-pages() to
establish the write-back-cache reservation in the memtype tree.

Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Cc: Matthew Wilcox +ADw-mawilcox+AEA-microsoft.com+AD4-
Cc: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Cc: Nilesh Choudhury +ADw-nilesh.choudhury+AEA-oracle.com+AD4-
Cc: Kirill A. Shutemov +ADw-kirill.shutemov+AEA-linux.intel.com+AD4-
Reported-by: Toshi Kani +ADw-toshi.kani+AEA-hpe.com+AD4-
Reported-by: Kai Zhang +ADw-kai.ka.zhang+AEA-oracle.com+AD4-
Acked-by: Andrew Morton +ADw-akpm+AEA-linux-foundation.org+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 2e21807d4b131dfd4a8e5c82116a85b62f28aeec
Author: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Date: Fri Sep 2 17:27:30 2016 -0600

nfit, mce: Fix SPA matching logic in MCE handler

The check for a 'pmem' type SPA in the MCE handler was inverted due to a
merge/rebase error.

Fixes: 6839a6d nfit: do an ARS scrub on hitting a latent media error
Cc: linux-acpi+AEA-vger.kernel.org
Cc: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Signed-off-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 1e8b8d9619f9476e94f32eb20cab000d50d236aa
Author: Dave Jiang +ADw-dave.jiang+AEA-intel.com+AD4-
Date: Fri Sep 9 09:10:08 2016 -0700

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

Bad blocks can be injected via /sys/block/pmemN/badblocks. In a situation
where legacy pmem is being used or a pmem region created by using memmap
kernel parameter, the injected bad blocks are not cleared due to
nvdimm+AF8-clear+AF8-poison() failing from lack of ndctl function pointer. In
this case we need to just return as handled and allow the bad blocks to
be cleared rather than fail.

Reviewed-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dave Jiang +ADw-dave.jiang+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-