[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zlb94UyBx0s-Vavj@localhost.localdomain>
Date: Wed, 29 May 2024 12:05:21 +0200
From: Oscar Salvador <osalvador@...e.com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Oscar Salvador <osalvador@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jason Gunthorpe <jgg@...dia.com>, Peter Xu <peterx@...hat.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [RFC PATCH v4 13/16] powerpc/e500: Use contiguous PMD instead of
hugepd
On Wed, May 29, 2024 at 09:58:35AM +0000, Christophe Leroy wrote:
> Yes I now have :
>
> +#define _PAGE_HSIZE_MSK (_PAGE_U0 | _PAGE_U1 | _PAGE_U2 | _PAGE_U3)
> +#define _PAGE_HSIZE_SHIFT 14
> +#define _PAGE_HSIZE_SHIFT_OFFSET 20
>
> and have added a helper to avoid doing the calculation at several places:
>
> +static inline unsigned long pte_huge_size(pte_t pte)
> +{
> + pte_basic_t val = pte_val(pte);
> +
> + return 1UL << (((val & _PAGE_HSIZE_MSK) >> _PAGE_HSIZE_SHIFT) +
> _PAGE_HSIZE_SHIFT_OFFSET);
> +}
Great, this looks much better.
> That's what I did before but it didn't work. The problem is that
> pte_advance_pfn() takes a long not a long long:
>
> static inline pte_t pte_advance_pfn(pte_t pte, unsigned long nr)
> {
> return __pte(pte_val(pte) + (nr << PFN_PTE_SHIFT));
> }
>
> And when I called it with nr = PMD_SIZE / PAGE_SIZE = 2M / 4k = 512, as
> we have PFN_PTE_SHIFT = 24, I got 512 << 24 = 0
Ah, I missed that trickery with the types.
Thanks!
--
Oscar Salvador
SUSE Labs
Powered by blists - more mailing lists