Re: [PATCH v3 4/4] arm: extend pfn_valid to take into account freed memory map alignment
From: Mike Rapoport
Date: Mon Jul 05 2021 - 03:24:01 EST
Hi Guenter,
On Sun, Jul 04, 2021 at 09:22:36PM -0700, Guenter Roeck wrote:
> On Wed, Jun 30, 2021 at 10:12:11AM +0300, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@xxxxxxxxxxxxx>
> >
> > When unused memory map is freed the preserved part of the memory map is
> > extended to match pageblock boundaries because lots of core mm
> > functionality relies on homogeneity of the memory map within pageblock
> > boundaries.
> >
> > Since pfn_valid() is used to check whether there is a valid memory map
> > entry for a PFN, make it return true also for PFNs that have memory map
> > entries even if there is no actual memory populated there.
> >
> > Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
> > Tested-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
>
> With this patch in place, the romulus-bmc emulation in qemu gets the
> following traceback:
>
> [ 2.863406] WARNING: CPU: 0 PID: 1 at arch/arm/mm/ioremap.c:287 __arm_ioremap_pfn_caller+0xf0/0x1dc
...
> [ 2.876683] ---[ end trace b2f74b8536829970 ]---
> [ 2.876911] fsi-master-acf gpio-fsi: ioremap failed for resource [mem 0x9ef00000-0x9effffff]
> [ 2.877492] fsi-master-acf gpio-fsi: Error -12 mapping coldfire memory
> [ 2.877689] fsi-master-acf: probe of gpio-fsi failed with error -12
>
> Reverting it fixes the problem. Also, the ioremap failure is no longer seen
> after reverting this patch.
I believe this should fix it: