[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b56356e-ac10-4f40-a4c3-7672d6e4a4e5@csgroup.eu>
Date: Wed, 3 Apr 2024 13:17:06 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Peter Xu <peterx@...hat.com>, Nathan Chancellor <nathan@...nel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Yang Shi <shy828301@...il.com>, "Kirill A .
Shutemov" <kirill@...temov.name>, Mike Kravetz <mike.kravetz@...cle.com>,
John Hubbard <jhubbard@...dia.com>, Michael Ellerman <mpe@...erman.id.au>,
Andrew Jones <andrew.jones@...ux.dev>, Muchun Song <muchun.song@...ux.dev>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>, Andrew
Morton <akpm@...ux-foundation.org>, Christoph Hellwig <hch@...radead.org>,
Lorenzo Stoakes <lstoakes@...il.com>, Matthew Wilcox <willy@...radead.org>,
Rik van Riel <riel@...riel.com>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, Andrea Arcangeli
<aarcange@...hat.com>, David Hildenbrand <david@...hat.com>, "Aneesh Kumar K
. V" <aneesh.kumar@...nel.org>, Vlastimil Babka <vbabka@...e.cz>, James
Houghton <jthoughton@...gle.com>, Mike Rapoport <rppt@...nel.org>, Axel
Rasmussen <axelrasmussen@...gle.com>, Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>, "loongarch@...ts.linux.dev"
<loongarch@...ts.linux.dev>
Subject: Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback
Le 03/04/2024 à 15:07, Jason Gunthorpe a écrit :
> On Wed, Apr 03, 2024 at 12:26:43PM +0000, Christophe Leroy wrote:
>>
>>
>> Le 03/04/2024 à 14:08, Jason Gunthorpe a écrit :
>>> On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote:
>>>> On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote:
>>>>> On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote:
>>>>>
>>>>>> I actually tested this without hitting the issue (even though I didn't
>>>>>> mention it in the cover letter..). I re-kicked the build test, it turns
>>>>>> out my "make alldefconfig" on loongarch will generate a config with both
>>>>>> HUGETLB=n && THP=n, while arch/loongarch/configs/loongson3_defconfig has
>>>>>> THP=y (which I assume was the one above build used). I didn't further
>>>>>> check how "make alldefconfig" generated the config; a bit surprising that
>>>>>> it didn't fetch from there.
>>>>>
>>>>> I suspect it is weird compiler variations.. Maybe something is not
>>>>> being inlined.
>>>>>
>>>>>> (and it also surprises me that this BUILD_BUG can trigger.. I used to try
>>>>>> triggering it elsewhere but failed..)
>>>>>
>>>>> As the pud_leaf() == FALSE should result in the BUILD_BUG never being
>>>>> called and the optimizer removing it.
>>>>
>>>> Good point, for some reason loongarch defined pud_leaf() without defining
>>>> pud_pfn(), which does look strange.
>>>>
>>>> #define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0)
>>>>
>>>> But I noticed at least MIPS also does it.. Logically I think one arch
>>>> should define either none of both.
>>>
>>> Wow, this is definately an arch issue. You can't define pud_leaf() and
>>> not have a pud_pfn(). It makes no sense at all..
>>>
>>> I'd say the BUILD_BUG has done it's job and found an issue, fix it by
>>> not defining pud_leaf? I don't see any calls to pud_leaf in loongarch
>>> at least
>>
>> As far as I can see it was added by commit 303be4b33562 ("LoongArch: mm:
>> Add p?d_leaf() definitions").
>
> That commit makes it sounds like the arch supports huge PUD's through
> the hugepte mechanism - it says a LTP test failed so something
> populated a huge PUD at least??
Not sure, I more see it just like a copy/paste of commit 501b81046701
("mips: mm: add p?d_leaf() definitions").
The commit message says that the test failed because pmd_leaf() is
missing, it says nothing about PUD.
When looking where _PAGE_HUGE is used in loongarch, I have the
impression that it is exclusively used at PMD level.
>
> So maybe this?
>
> #define pud_pfn pte_pfn
>
>> Not sure it was added for a good reason, and I'm not sure what was added
>> is correct because arch/loongarch/include/asm/pgtable-bits.h has:
>>
>> #define _PAGE_HUGE_SHIFT 6 /* HUGE is a PMD bit */
>>
>> So I'm not sure it is correct to use that bit for PUD, is it ?
>
> Could be, lots of arches repeat the bit layouts in each radix
> level.. It is essentially why the hugepte trick of pretending every
> level is a pte works.
>
> Jason
Powered by blists - more mailing lists