[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9lkCz73v7/iyyLj@spud>
Date: Tue, 31 Jan 2023 18:55:07 +0000
From: Conor Dooley <conor@...nel.org>
To: Mike Rapoport <rppt@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Arnd Bergmann <arnd@...db.de>, Brian Cain <bcain@...cinc.com>,
"David S. Miller" <davem@...emloft.net>,
Dinh Nguyen <dinguyen@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greg Ungerer <gerg@...ux-m68k.org>,
Guo Ren <guoren@...nel.org>, Helge Deller <deller@....de>,
Huacai Chen <chenhuacai@...nel.org>,
Matt Turner <mattst88@...il.com>,
Max Filippov <jcmvbkbc@...il.com>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Simek <monstr@...str.eu>,
Palmer Dabbelt <palmer@...belt.com>,
Rich Felker <dalias@...c.org>,
Richard Weinberger <richard@....at>,
Russell King <linux@...linux.org.uk>,
Stafford Horne <shorne@...il.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Vineet Gupta <vgupta@...nel.org>,
WANG Xuerui <kernel@...0n.name>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
linux-alpha@...r.kernel.org, linux-arch@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-csky@...r.kernel.org,
linux-hexagon@...r.kernel.org, linux-ia64@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, linux-mm@...ck.org,
linux-parisc@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-sh@...r.kernel.org, linux-snps-arc@...ts.infradead.org,
linux-um@...ts.infradead.org, linux-xtensa@...ux-xtensa.org,
linuxppc-dev@...ts.ozlabs.org, loongarch@...ts.linux.dev,
openrisc@...ts.librecores.org, sparclinux@...r.kernel.org,
x86@...nel.org, Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH v2 4/4] mm, arch: add generic implementation of
pfn_valid() for FLATMEM
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)" <rppt@...nel.org>
> > >
> > > Every architecture that supports FLATMEM memory model defines its own
> > > version of pfn_valid() that essentially compares a pfn to max_mapnr.
> > >
> > > Use mips/powerpc version implemented as static inline as a generic
> > > implementation of pfn_valid() and drop its per-architecture definitions.
> > >
> > > Signed-off-by: Mike Rapoport (IBM) <rppt@...nel.org>
> > > Acked-by: Arnd Bergmann <arnd@...db.de>
> > > Acked-by: Guo Ren <guoren@...nel.org> # csky
> > > Acked-by: Huacai Chen <chenhuacai@...ngson.cn> # LoongArch
> > > Acked-by: Stafford Horne <shorne@...il.com> # OpenRISC
> >
> > 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.
>
> 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?
>
> diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_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 = ARCH_PFN_OFFSET;
>
> - return pfn >= pfn_offset && pfn < max_mapnr;
> + return pfn >= 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 <conor.dooley@...rochip.com>
Thanks for the prompt fix!
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists