* [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region
@ 2019-05-14 2:55 Aneesh Kumar K.V
2019-05-14 4:29 ` Dan Williams
0 siblings, 1 reply; 4+ messages in thread
From: Aneesh Kumar K.V @ 2019-05-14 2:55 UTC (permalink / raw)
To: dan.j.williams; +Cc: linux-mm, linuxppc-dev, Aneesh Kumar K.V, linux-nvdimm
We already add the start_pad to the resource->start but fails to section
align the start. This make sure with altmap we compute the right first
pfn when start_pad is zero and we are doing an align down of start address.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
kernel/memremap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index a856cb5ff192..23d77b60e728 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -59,9 +59,9 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
{
const struct resource *res = &pgmap->res;
struct vmem_altmap *altmap = &pgmap->altmap;
- unsigned long pfn;
+ unsigned long pfn = PHYS_PFN(res->start);
- pfn = res->start >> PAGE_SHIFT;
+ pfn = SECTION_ALIGN_DOWN(pfn);
if (pgmap->altmap_valid)
pfn += vmem_altmap_offset(altmap);
return pfn;
--
2.21.0
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region
2019-05-14 2:55 [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region Aneesh Kumar K.V
@ 2019-05-14 4:29 ` Dan Williams
2019-05-14 4:41 ` Aneesh Kumar K.V
0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2019-05-14 4:29 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: Linux MM, linuxppc-dev, linux-nvdimm
On Mon, May 13, 2019 at 7:55 PM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> We already add the start_pad to the resource->start but fails to section
> align the start. This make sure with altmap we compute the right first
> pfn when start_pad is zero and we are doing an align down of start address.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> kernel/memremap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index a856cb5ff192..23d77b60e728 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -59,9 +59,9 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
> {
> const struct resource *res = &pgmap->res;
> struct vmem_altmap *altmap = &pgmap->altmap;
> - unsigned long pfn;
> + unsigned long pfn = PHYS_PFN(res->start);
>
> - pfn = res->start >> PAGE_SHIFT;
> + pfn = SECTION_ALIGN_DOWN(pfn);
This does not seem right to me it breaks the assumptions of where the
first expected valid pfn occurs in the passed in range.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region
2019-05-14 4:29 ` Dan Williams
@ 2019-05-14 4:41 ` Aneesh Kumar K.V
2019-05-27 9:35 ` Aneesh Kumar K.V
0 siblings, 1 reply; 4+ messages in thread
From: Aneesh Kumar K.V @ 2019-05-14 4:41 UTC (permalink / raw)
To: Dan Williams; +Cc: Linux MM, linuxppc-dev, linux-nvdimm
On 5/14/19 9:59 AM, Dan Williams wrote:
> On Mon, May 13, 2019 at 7:55 PM Aneesh Kumar K.V
> <aneesh.kumar@linux.ibm.com> wrote:
>>
>> We already add the start_pad to the resource->start but fails to section
>> align the start. This make sure with altmap we compute the right first
>> pfn when start_pad is zero and we are doing an align down of start address.
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> kernel/memremap.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/memremap.c b/kernel/memremap.c
>> index a856cb5ff192..23d77b60e728 100644
>> --- a/kernel/memremap.c
>> +++ b/kernel/memremap.c
>> @@ -59,9 +59,9 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
>> {
>> const struct resource *res = &pgmap->res;
>> struct vmem_altmap *altmap = &pgmap->altmap;
>> - unsigned long pfn;
>> + unsigned long pfn = PHYS_PFN(res->start);
>>
>> - pfn = res->start >> PAGE_SHIFT;
>> + pfn = SECTION_ALIGN_DOWN(pfn);
>
> This does not seem right to me it breaks the assumptions of where the
> first expected valid pfn occurs in the passed in range.
>
How do we define the first valid pfn? Isn't that at pfn_sb->dataoff ?
-aneesh
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region
2019-05-14 4:41 ` Aneesh Kumar K.V
@ 2019-05-27 9:35 ` Aneesh Kumar K.V
0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2019-05-27 9:35 UTC (permalink / raw)
To: Dan Williams; +Cc: Linux MM, linuxppc-dev, linux-nvdimm
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
> On 5/14/19 9:59 AM, Dan Williams wrote:
>> On Mon, May 13, 2019 at 7:55 PM Aneesh Kumar K.V
>> <aneesh.kumar@linux.ibm.com> wrote:
>>>
>>> We already add the start_pad to the resource->start but fails to section
>>> align the start. This make sure with altmap we compute the right first
>>> pfn when start_pad is zero and we are doing an align down of start address.
>>>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>> ---
>>> kernel/memremap.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/memremap.c b/kernel/memremap.c
>>> index a856cb5ff192..23d77b60e728 100644
>>> --- a/kernel/memremap.c
>>> +++ b/kernel/memremap.c
>>> @@ -59,9 +59,9 @@ static unsigned long pfn_first(struct dev_pagemap *pgmap)
>>> {
>>> const struct resource *res = &pgmap->res;
>>> struct vmem_altmap *altmap = &pgmap->altmap;
>>> - unsigned long pfn;
>>> + unsigned long pfn = PHYS_PFN(res->start);
>>>
>>> - pfn = res->start >> PAGE_SHIFT;
>>> + pfn = SECTION_ALIGN_DOWN(pfn);
>>
>> This does not seem right to me it breaks the assumptions of where the
>> first expected valid pfn occurs in the passed in range.
>>
>
> How do we define the first valid pfn? Isn't that at pfn_sb->dataoff ?
for altmap the pfn_first should be
pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap);
?
-aneesh
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-27 9:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 2:55 [PATCH] mm/nvdimm: Use correct alignment when looking at first pfn from a region Aneesh Kumar K.V
2019-05-14 4:29 ` Dan Williams
2019-05-14 4:41 ` Aneesh Kumar K.V
2019-05-27 9:35 ` Aneesh Kumar K.V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).