Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477642 > unrolled thread

[PATCH 0/5] device-dax and huge-page dax fixes for 4.8-rc6

Started byDan Williams <dan.j.williams@intel.com>
First post2016-09-06 19:00 +0200
Last post2016-09-06 19:00 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] device-dax and huge-page dax fixes for 4.8-rc6 Dan Williams <dan.j.williams@intel.com> - 2016-09-06 19:00 +0200
    [PATCH 2/5] dax: fix offset to physical address translation Dan Williams <dan.j.williams@intel.com> - 2016-09-06 19:00 +0200
    [PATCH 1/5] dax: fix mapping size check Dan Williams <dan.j.williams@intel.com> - 2016-09-06 19:00 +0200

#1477642 — [PATCH 0/5] device-dax and huge-page dax fixes for 4.8-rc6

FromDan Williams <dan.j.williams@intel.com>
Date2016-09-06 19:00 +0200
Subject[PATCH 0/5] device-dax and huge-page dax fixes for 4.8-rc6
Message-ID<serT3-4wT-7@gated-at.bofh.it>
Kai and Toshi reported poor performance with huge-page dax mappings and
while debugging a few more bugs were discovered in the device-dax driver
and mm.  The following fixes target 4.8-rc6 and are tagged for -stable:

- device-dax incorrectly translates the file offset to a physical
  resource address

- show_smap() crashes on huge-page dax mappings

- huge-page dax mappings are inadvertently being marked as
  _PAGE_CACHE_MODE_UC instead of _PAGE_CACHE_MODE_WB

I would like to take this set through nvdimm.git with acks from mm folks
as there is 4.9 device-dax development that depends on these changes.

---

Dan Williams (5):
      dax: fix mapping size check
      dax: fix offset to physical address translation
      mm: fix show_smap() for zone_device-pmd ranges
      mm: fix cache mode of dax pmd mappings
      mm: cleanup pfn_t usage in track_pfn_insert()


 arch/x86/mm/pat.c             |    4 ++--
 drivers/dax/dax.c             |   12 +++++++-----
 fs/proc/task_mmu.c            |    2 ++
 include/asm-generic/pgtable.h |    4 ++--
 mm/huge_memory.c              |    6 ++----
 mm/memory.c                   |    2 +-
 6 files changed, 16 insertions(+), 14 deletions(-)

[toc] | [next] | [standalone]


#1477643 — [PATCH 2/5] dax: fix offset to physical address translation

FromDan Williams <dan.j.williams@intel.com>
Date2016-09-06 19:00 +0200
Subject[PATCH 2/5] dax: fix offset to physical address translation
Message-ID<serT3-4wT-15@gated-at.bofh.it>
In reply to#1477642
In pgoff_to_phys() 'pgoff' is already relative to base of the dax
device, so we only need to compare if the current offset is within the
current resource extent.  Otherwise, we are double accounting the
resource start offset when translating pgoff to a physical address.

Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dax/dax.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index 29f600f2c447..4653f84cabe7 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -357,16 +357,18 @@ static int check_vma(struct dax_dev *dax_dev, struct vm_area_struct *vma,
 static phys_addr_t pgoff_to_phys(struct dax_dev *dax_dev, pgoff_t pgoff,
 		unsigned long size)
 {
+	phys_addr_t phys, offset;
 	struct resource *res;
-	phys_addr_t phys;
 	int i;
 
+	offset = pgoff * PAGE_SIZE;
 	for (i = 0; i < dax_dev->num_resources; i++) {
 		res = &dax_dev->res[i];
-		phys = pgoff * PAGE_SIZE + res->start;
-		if (phys >= res->start && phys <= res->end)
+		if (offset < resource_size(res)) {
+			phys = offset + res->start;
 			break;
-		pgoff -= PHYS_PFN(resource_size(res));
+		}
+		offset -= resource_size(res);
 	}
 
 	if (i < dax_dev->num_resources) {

[toc] | [prev] | [next] | [standalone]


#1477644 — [PATCH 1/5] dax: fix mapping size check

FromDan Williams <dan.j.williams@intel.com>
Date2016-09-06 19:00 +0200
Subject[PATCH 1/5] dax: fix mapping size check
Message-ID<serT3-4wT-21@gated-at.bofh.it>
In reply to#1477642
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 <dan.j.williams@intel.com>
---
 drivers/dax/dax.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index 803f3953b341..29f600f2c447 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -459,7 +459,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev,
 	}
 
 	pgoff = linear_page_index(vma, pmd_addr);
-	phys = pgoff_to_phys(dax_dev, pgoff, PAGE_SIZE);
+	phys = pgoff_to_phys(dax_dev, pgoff, PMD_SIZE);
 	if (phys == -1) {
 		dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__,
 				pgoff);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web