lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <268458e9-0204-4b88-974e-a23fc9c86205@csgroup.eu>
Date: Wed, 22 May 2024 10:22:45 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Oscar Salvador <osalvador@...e.de>
CC: 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 v2 03/20] mm: Provide pmd to pte_leaf_size()



Le 21/05/2024 à 11:39, Oscar Salvador a écrit :
> On Fri, May 17, 2024 at 08:59:57PM +0200, Christophe Leroy wrote:
>> On powerpc 8xx, when a page is 8M size, the information is in the PMD
>> entry. So provide it to pte_leaf_size().
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
> 
> Overall looks good to me.
> 
> Would be nicer if we could left the arch code untouched.
> I wanted to see how this would be if we go down that road and focus only
> on 8xx at the risk of being more esoteric.
> pmd_pte_leaf_size() is a name of hell, but could be replaced
> with __pte_leaf_size for example.
> 
> Worth it? Maybe not, anyway, just wanted to give it a go:

I like the idea, it doesn't look that bad after all, it avoids changes 
to other arches.

> 
> 
>   diff --git a/arch/powerpc/include/asm/nohash/32/pte-8xx.h b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
>   index 137dc3c84e45..9e3fe6e1083f 100644
>   --- a/arch/powerpc/include/asm/nohash/32/pte-8xx.h
>   +++ b/arch/powerpc/include/asm/nohash/32/pte-8xx.h
>   @@ -151,7 +151,7 @@ static inline unsigned long pgd_leaf_size(pgd_t pgd)
>   
>    #define pgd_leaf_size pgd_leaf_size
>   
>   -static inline unsigned long pte_leaf_size(pte_t pte)
>   +static inline unsigned long pmd_pte_leaf_size(pte_t pte)
>    {
>           pte_basic_t val = pte_val(pte);
>   
>   @@ -162,7 +162,7 @@ static inline unsigned long pte_leaf_size(pte_t pte)
>           return SZ_4K;
>    }
>   
>   -#define pte_leaf_size pte_leaf_size
>   +#define pmd_pte_leaf_size pmd_pte_leaf_size
>   
>    /*
>     * On the 8xx, the page tables are a bit special. For 16k pages, we have
>   diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
>   index 18019f037bae..2bc2fe3b2b53 100644
>   --- a/include/linux/pgtable.h
>   +++ b/include/linux/pgtable.h
>   @@ -1891,6 +1891,9 @@ typedef unsigned int pgtbl_mod_mask;
>    #ifndef pte_leaf_size
>    #define pte_leaf_size(x) PAGE_SIZE
>    #endif
>   +#ifndef pmd_pte_leaf_size
>   +#define pmd_pte_leaf_size(x, y) pte_leaf_size(y)
>   +#endif
>   
>    /*
>     * We always define pmd_pfn for all archs as it's used in lots of generic
>   diff --git a/kernel/events/core.c b/kernel/events/core.c
>   index f0128c5ff278..e90a547d2fb2 100644
>   --- a/kernel/events/core.c
>   +++ b/kernel/events/core.c
>   @@ -7596,7 +7596,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)
>   
>           pte = ptep_get_lockless(ptep);
>           if (pte_present(pte))
>   -               size = pte_leaf_size(pte);
>   +               size = pmd_pte_leaf_size(pmd, pte);
>           pte_unmap(ptep);
>    #endif /* CONFIG_HAVE_GUP_FAST */
> 
>   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ