From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
linux-nvdimm@lists.01.org
Subject: [PATCH v4 5/6] mm/nvdimm: Use correct alignment when looking at first pfn from a region
Date: Thu, 20 Jun 2019 14:46:25 +0530 [thread overview]
Message-ID: <20190620091626.31824-6-aneesh.kumar@linux.ibm.com> (raw)
In-Reply-To: <20190620091626.31824-1-aneesh.kumar@linux.ibm.com>
vmem_altmap_offset() adjust the section aligned base_pfn offset.
So we need to make sure we account for the same when computing base_pfn.
ie, for altmap_valid case, our pfn_first should be:
pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap);
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
kernel/memremap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index a0e5f6b91b04..63800128844b 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -58,9 +58,11 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
struct vmem_altmap *altmap = &pgmap->altmap;
unsigned long pfn;
- pfn = PHYS_PFN(res->start);
- if (pgmap->altmap_valid)
- pfn += vmem_altmap_offset(altmap);
+ if (pgmap->altmap_valid) {
+ pfn = altmap->base_pfn + vmem_altmap_offset(altmap);
+ } else
+ pfn = PHYS_PFN(res->start);
+
return pfn;
}
--
2.21.0
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
linux-nvdimm@lists.01.org
Subject: [PATCH v4 5/6] mm/nvdimm: Use correct alignment when looking at first pfn from a region
Date: Thu, 20 Jun 2019 14:46:25 +0530 [thread overview]
Message-ID: <20190620091626.31824-6-aneesh.kumar@linux.ibm.com> (raw)
In-Reply-To: <20190620091626.31824-1-aneesh.kumar@linux.ibm.com>
vmem_altmap_offset() adjust the section aligned base_pfn offset.
So we need to make sure we account for the same when computing base_pfn.
ie, for altmap_valid case, our pfn_first should be:
pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap);
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
kernel/memremap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index a0e5f6b91b04..63800128844b 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -58,9 +58,11 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
struct vmem_altmap *altmap = &pgmap->altmap;
unsigned long pfn;
- pfn = PHYS_PFN(res->start);
- if (pgmap->altmap_valid)
- pfn += vmem_altmap_offset(altmap);
+ if (pgmap->altmap_valid) {
+ pfn = altmap->base_pfn + vmem_altmap_offset(altmap);
+ } else
+ pfn = PHYS_PFN(res->start);
+
return pfn;
}
--
2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org, linux-mm@kvack.org,
linuxppc-dev@lists.ozlabs.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: [PATCH v4 5/6] mm/nvdimm: Use correct alignment when looking at first pfn from a region
Date: Thu, 20 Jun 2019 14:46:25 +0530 [thread overview]
Message-ID: <20190620091626.31824-6-aneesh.kumar@linux.ibm.com> (raw)
In-Reply-To: <20190620091626.31824-1-aneesh.kumar@linux.ibm.com>
vmem_altmap_offset() adjust the section aligned base_pfn offset.
So we need to make sure we account for the same when computing base_pfn.
ie, for altmap_valid case, our pfn_first should be:
pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap);
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
kernel/memremap.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index a0e5f6b91b04..63800128844b 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -58,9 +58,11 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
struct vmem_altmap *altmap = &pgmap->altmap;
unsigned long pfn;
- pfn = PHYS_PFN(res->start);
- if (pgmap->altmap_valid)
- pfn += vmem_altmap_offset(altmap);
+ if (pgmap->altmap_valid) {
+ pfn = altmap->base_pfn + vmem_altmap_offset(altmap);
+ } else
+ pfn = PHYS_PFN(res->start);
+
return pfn;
}
--
2.21.0
next prev parent reply other threads:[~2019-06-20 9:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 9:16 [PATCH v4 0/6] Fixes related namespace alignment/page size/big endian Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` [PATCH v4 1/6] nvdimm: Consider probe return -EOPNOTSUPP as success Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` [PATCH v4 2/6] mm/nvdimm: Add page size and struct page size to pfn superblock Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` [PATCH v4 3/6] mm/nvdimm: Use correct #defines instead of open coding Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` [PATCH v4 4/6] mm/nvdimm: Pick the right alignment default when creating dax devices Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V [this message]
2019-06-20 9:16 ` [PATCH v4 5/6] mm/nvdimm: Use correct alignment when looking at first pfn from a region Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` [PATCH v4 6/6] mm/nvdimm: Fix endian conversion issues Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-06-20 9:16 ` Aneesh Kumar K.V
2019-07-10 4:50 ` [PATCH v4 0/6] Fixes related namespace alignment/page size/big endian Aneesh Kumar K.V
2019-07-10 4:50 ` Aneesh Kumar K.V
2019-07-10 4:50 ` Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190620091626.31824-6-aneesh.kumar@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.