From mboxrd@z Thu Jan 1 00:00:00 1970 From: Conor Dooley Date: Tue, 31 Jan 2023 18:55:07 +0000 Subject: Re: [PATCH v2 4/4] mm, arch: add generic implementation of pfn_valid() for FLATMEM Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="hiaCFsst32mLBZni" List-Id: References: <20230129124235.209895-1-rppt@kernel.org> <20230129124235.209895-5-rppt@kernel.org> In-Reply-To: To: Mike Rapoport Cc: Andrew Morton , Arnd Bergmann , Brian Cain , "David S. Miller" , Dinh Nguyen , Geert Uytterhoeven , Greg Ungerer , Guo Ren , Helge Deller , Huacai Chen , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Palmer Dabbelt , Rich Felker , Richard Weinberger , Russell King , Stafford Horne , Thomas Bogendoerfer , Vineet Gupta , WANG Xuerui , Yoshinori Sato , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, x86@kernel.org, Huacai Chen --hiaCFsst32mLBZni Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Mike, On Tue, Jan 31, 2023 at 08:41:49PM +0200, Mike Rapoport wrote: > On Tue, Jan 31, 2023 at 05:47:24PM +0000, Conor Dooley wrote: > > On Sun, Jan 29, 2023 at 02:42:35PM +0200, Mike Rapoport wrote: > > > From: "Mike Rapoport (IBM)" > > >=20 > > > Every architecture that supports FLATMEM memory model defines its own > > > version of pfn_valid() that essentially compares a pfn to max_mapnr. > > >=20 > > > Use mips/powerpc version implemented as static inline as a generic > > > implementation of pfn_valid() and drop its per-architecture definitio= ns. > > >=20 > > > Signed-off-by: Mike Rapoport (IBM) > > > Acked-by: Arnd Bergmann > > > Acked-by: Guo Ren # csky > > > Acked-by: Huacai Chen # LoongArch > > > Acked-by: Stafford Horne # OpenRISC > >=20 > > Hmm, so this landed in linux-next today and I bisected a boot failure in > > my CI to it. However, I am not really sure if it is a real issue worth > > worrying about as the platform it triggered on is supposed to be using > > SPARSEMEM, but isn't. > > I had thought that my CI was using a config with SPARSEMEM since that > > became required for riscv defconfig builds to boot in v6.1-rc1, but I > > must have just forgotten to add it to my $platform_defconfig builds too. > > However, those $platform_defconfig builds continued booting without > > SPARSEMEM enabled until today. >=20 > The issue seems to be that the generic pfn_valid() does not take into > account pfn_offset when it compares it with max_mapnr. > Can you please test with the patch below? >=20 > diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/mem= ory_model.h > index 13d2a844d928..6796abe1900e 100644 > --- a/include/asm-generic/memory_model.h > +++ b/include/asm-generic/memory_model.h > @@ -26,7 +26,7 @@ static inline int pfn_valid(unsigned long pfn) > extern unsigned long max_mapnr; > unsigned long pfn_offset =3D ARCH_PFN_OFFSET; > =20 > - return pfn >=3D pfn_offset && pfn < max_mapnr; > + return pfn >=3D pfn_offset && (pfn - pfn_offset) < max_mapnr; > } > #define pfn_valid pfn_valid > #endif Gave that a go, board is booting properly again! Feel free to add a: Tested-by: Conor Dooley Thanks for the prompt fix! --hiaCFsst32mLBZni Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCY9lkCwAKCRB4tDGHoIJi 0pIDAP9nc8RsXGyfp84b29PfLE6bd1djEIZ71+YYWPrhRbOT0QEAs5hvd2Aq0mES TzWIEs2xL7+wjwVIWLwPjr1kP0shHA0= =AQg2 -----END PGP SIGNATURE----- --hiaCFsst32mLBZni--