mm/nvdimm: Use correct alignment when looking at first pfn from a region
Subsystems (2)
PATCH 1/1 mm/nvdimm: Use correct alignment when looking at first pfn from a region
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.
--- kernel/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/memremap.c +2 -2
@@ -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;
Signature · 6 lines
2.21.0 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 15 lines · Aneesh Kumar K.V
We already add the
start_padto theresource->startbut fails to section align the start. This make sure with altmap we compute the right first pfn whenstart_padis zero and we are doing an align down of start address.Signed-off-by Aneesh Kumar K.V <[email protected]>--- kernel/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/memremap.c +0
-0
kernel/memremap.c static unsigned long pfn_first(struct dev_pagemap *pgmap) · line 64
Quoted 8 lines
kernel/memremap.c +2
-2@@ -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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 23 lines · Dan Williams
Quoted 21 lines · Aneesh Kumar K.V
We already add the
start_padto theresource->startbut fails to section align the start. This make sure with altmap we compute the right first pfn whenstart_padis zero and we are doing an align down of start address.Signed-off-by Aneesh Kumar K.V <[email protected]>--- kernel/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/memremap.c +1
-1@@ -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);
Quoted 6 lines
kernel/memremap.c static unsigned long pfn_first(struct dev_pagemap *pgmap) · line 64
Quoted 2 lines
kernel/memremap.c +1
-1- 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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 24 lines · Aneesh Kumar K.V
Quoted 23 lines · Dan Williams
Quoted 21 lines · Aneesh Kumar K.V
We already add the
start_padto theresource->startbut fails to section align the start. This make sure with altmap we compute the right first pfn whenstart_padis zero and we are doing an align down of start address.Signed-off-by Aneesh Kumar K.V <[email protected]>--- kernel/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/memremap.c +1
-1@@ -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);
Quoted 8 lines
Quoted 6 lines
kernel/memremap.c static unsigned long pfn_first(struct dev_pagemap *pgmap) · line 64
Quoted 2 lines
kernel/memremap.c +1
-1- 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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm