[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d4f5546-afd0-0b8f-664d-700ae346b9ec@csgroup.eu>
Date: Tue, 8 Sep 2020 10:16:49 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Alexander Gordeev <agordeev@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>
Cc: Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Jason Gunthorpe <jgg@...pe.ca>,
John Hubbard <jhubbard@...dia.com>,
Peter Zijlstra <peterz@...radead.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
linux-mm <linux-mm@...ck.org>, Paul Mackerras <paulus@...ba.org>,
linux-sparc <sparclinux@...r.kernel.org>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Will Deacon <will@...nel.org>,
linux-arch <linux-arch@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>,
Vasily Gorbik <gor@...ux.ibm.com>,
Richard Weinberger <richard@....at>,
linux-x86 <x86@...nel.org>, Russell King <linux@...linux.org.uk>,
Christian Borntraeger <borntraeger@...ibm.com>,
Ingo Molnar <mingo@...hat.com>,
Catalin Marinas <catalin.marinas@....com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Arnd Bergmann <arnd@...db.de>, Jeff Dike <jdike@...toit.com>,
linux-um <linux-um@...ts.infradead.org>,
Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm <linux-arm-kernel@...ts.infradead.org>,
linux-power <linuxppc-dev@...ts.ozlabs.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mike Rapoport <rppt@...nel.org>
Subject: Re: [RFC PATCH v2 2/3] mm: make pXd_addr_end() functions page-table
entry aware
Le 08/09/2020 à 09:46, Alexander Gordeev a écrit :
> On Tue, Sep 08, 2020 at 07:14:38AM +0200, Christophe Leroy wrote:
>> You forgot arch/powerpc/mm/book3s64/subpage_prot.c it seems.
>
> Yes, and also two more sources :/
> arch/powerpc/mm/kasan/8xx.c
> arch/powerpc/mm/kasan/kasan_init_32.c
>
> But these two are not quite obvious wrt pgd_addr_end() used
> while traversing pmds. Could you please clarify a bit?
>
>
> diff --git a/arch/powerpc/mm/kasan/8xx.c b/arch/powerpc/mm/kasan/8xx.c
> index 2784224..89c5053 100644
> --- a/arch/powerpc/mm/kasan/8xx.c
> +++ b/arch/powerpc/mm/kasan/8xx.c
> @@ -15,8 +15,8 @@
> for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd += 2, block += SZ_8M) {
> pte_basic_t *new;
>
> - k_next = pgd_addr_end(k_cur, k_end);
> - k_next = pgd_addr_end(k_next, k_end);
> + k_next = pmd_addr_end(k_cur, k_end);
> + k_next = pmd_addr_end(k_next, k_end);
No, I don't think so.
On powerpc32 we have only two levels, so pgd and pmd are more or less
the same.
But pmd_addr_end() as defined in include/asm-generic/pgtable-nopmd.h is
a no-op, so I don't think it will work.
It is likely that this function should iterate on pgd, then you get pmd
= pmd_offset(pud_offset(p4d_offset(pgd)));
> if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte)
> continue;
>
> diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c
> index fb29404..3f7d6dc6 100644
> --- a/arch/powerpc/mm/kasan/kasan_init_32.c
> +++ b/arch/powerpc/mm/kasan/kasan_init_32.c
> @@ -38,7 +38,7 @@ int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_
> for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) {
> pte_t *new;
>
> - k_next = pgd_addr_end(k_cur, k_end);
> + k_next = pmd_addr_end(k_cur, k_end);
Same here I get, iterate on pgd then get pmd =
pmd_offset(pud_offset(p4d_offset(pgd)));
> if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte)
> continue;
>
> @@ -196,7 +196,7 @@ void __init kasan_early_init(void)
> kasan_populate_pte(kasan_early_shadow_pte, PAGE_KERNEL);
>
> do {
> - next = pgd_addr_end(addr, end);
> + next = pmd_addr_end(addr, end);
> pmd_populate_kernel(&init_mm, pmd, kasan_early_shadow_pte);
> } while (pmd++, addr = next, addr != end);
>
>
Christophe
Powered by blists - more mailing lists