[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <40ff6065-2f2b-4a07-b247-02e11fd46eb8@app.fastmail.com>
Date: Sat, 07 Jun 2025 11:36:52 +0100
From: "Jiaxun Yang" <jiaxun.yang@...goat.com>
To: "Maciej W. Rozycki" <macro@...am.me.uk>
Cc: "Thomas Bogendoerfer" <tsbogend@...ha.franken.de>,
"linux-mips@...r.kernel.org" <linux-mips@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MIPS: mm: tlb-r4k: Uniquify TLB entries on init
在2025年6月7日周六 上午3:48,Maciej W. Rozycki写道:
> On Thu, 5 Jun 2025, Jiaxun Yang wrote:
>
>> +static unsigned long r4k_safe_entryhi(void)
>> +{
>> + int entry = current_cpu_data.tlbsize;
>> + int old_index;
>> +
>> + old_index = read_c0_index();
>> + while (entry >= 0) {
> [...]
>> + entry++;
>> + }
>
> Hmm, how is it supposed to work: you start from say 48 and then iterate
> until 0x80000000 before giving up? Also a signed overflow condition is UB
> pre-C23, so the compiler may well optimise the loop control away.
Ah sorry I didn't realise it's a UB. However, this loop is likely to be
terminated very early as it should be fairly easily to find a free EntryHi
value with TLBP.
>
> How did you verify this code?
Boot tested on Boston as well as M5150 simulation. I tried to manually setup a
TLB entry collision situation with Boot-MIPS.
>
> Maciej
Thanks
--
- Jiaxun
Powered by blists - more mailing lists