[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2511251404510.36486@angie.orcam.me.uk>
Date: Tue, 25 Nov 2025 14:25:26 +0000 (GMT)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
cc: Gregory CLEMENT <gregory.clement@...tlin.com>,
Linus Torvalds <torvalds@...ux-foundation.org>, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] MIPS fixes for v6.18
On Tue, 25 Nov 2025, Thomas Bogendoerfer wrote:
> > > diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
> > > index 3facf7cc6c7d..577055b50c41 100644
> > > --- a/arch/mips/mm/tlb-r4k.c
> > > +++ b/arch/mips/mm/tlb-r4k.c
> > > @@ -524,15 +524,19 @@ static int r4k_vpn_cmp(const void *a, const void *b)
> > > */
> > > static void r4k_tlb_uniquify(void)
> > > {
> > > - unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
> > > int tlbsize = current_cpu_data.tlbsize;
> > > int start = num_wired_entries();
> > > + unsigned long *tlb_vpns;
> > > unsigned long vpn_mask;
> > > int cnt, ent, idx, i;
> > >
> > > vpn_mask = GENMASK(cpu_vmbits - 1, 13);
> > > vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
> > >
> > > + tlb_vpns = kmalloc_array(tlbsize, sizeof(unsigned long), GFP_KERNEL);
> > > + if (!tlb_vpns)
> > > + return; /* pray local_flush_tlb_all() is good enough */
> >
> > I can't say I'm particularly happy with this bail-out hack, but then I
> > have nothing better in my mind right now, so OK, but can you please make
> > the comment a proper sentence (starting with a capital letter and ending
> > with a full stop)?
>
> I'll add a WARN_ON() to inform users about the issue, but as this is
> pretty early during boot, I don't think anybody will see it.
Umm, `kmalloc' by default warns about allocation failures anyway and if
it does cause a hang or crash as seen with these reports, it should be
hard to miss.
Then it seems unlikely enough an allocation will fail of say 4KiB for a
very large TLB to add any special handling for it given that the vast
majority of systems seems not to need this TLB preinitialisation in most
cases. It just feels odd to me.
Maciej
Powered by blists - more mailing lists