[PATCH] arm64: Use correct method to calculate nomap region boundaries
Guo Ren
guoren at kernel.org
Sun Oct 31 18:53:30 PDT 2021
The real reserved memory have been initialized before in
for_each_reserved_mem_region loop. If memblock_is_nomap still uses
memblock_region_reserved, than it would cause overlap with
reserved_mem_region.
nomap_region: PFN_DOWN <-> PFN_UP
reserved_region: PFN_DOWN <-> PFN_UP
We would get overlapped reserved_mem_region.
On Wed, Oct 27, 2021 at 4:35 PM Huacai Chen <chenhuacai at gmail.com> wrote:
>
> Ping?
>
> On Fri, Oct 22, 2021 at 3:07 PM Huacai Chen <chenhuacai at loongson.cn> wrote:
> >
> > Nomap regions are treated as "reserved". When region boundaries are not
> > page aligned, we usually increase the "reserved" regions rather than
> > decrease them. So, we should use memblock_region_reserved_base_pfn()/
> > memblock_region_reserved_end_pfn() instead of memblock_region_memory_
> > base_pfn()/memblock_region_memory_base_pfn() to calculate boundaries.
> >
> > Signed-off-by: Huacai Chen <chenhuacai at loongson.cn>
> > ---
> > arch/arm64/kernel/setup.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> > index be5f85b0a24d..1e86d4c5ef8c 100644
> > --- a/arch/arm64/kernel/setup.c
> > +++ b/arch/arm64/kernel/setup.c
> > @@ -232,12 +232,14 @@ static void __init request_standard_resources(void)
> > if (memblock_is_nomap(region)) {
> > res->name = "reserved";
> > res->flags = IORESOURCE_MEM;
> > + res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region));
> > + res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1;
> > } else {
> > res->name = "System RAM";
> > res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
> > + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
> > }
> > - res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
> > - res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
> >
> > request_resource(&iomem_resource, res);
> >
> > --
> > 2.27.0
> >
--
Best Regards
Guo Ren
ML: https://lore.kernel.org/linux-csky/
More information about the linux-arm-kernel
mailing list