* [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page()
@ 2022-06-23 8:56 Christophe Leroy
2022-06-23 17:13 ` Mike Rapoport
2022-06-29 7:01 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-06-23 8:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: stable, Mike Rapoport, linuxppc-dev, linux-kernel
Commit 2fb4706057bc ("powerpc: add support for folded p4d page tables")
erroneously changed PUD setup to a mix of PMD and PUD. Fix it.
While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables
in order to avoid any confusion.
Fixes: 2fb4706057bc ("powerpc: add support for folded p4d page tables")
Cc: stable@vger.kernel.org
Cc: Mike Rapoport <rppt@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/mm/nohash/book3e_pgtable.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/nohash/book3e_pgtable.c b/arch/powerpc/mm/nohash/book3e_pgtable.c
index 7d4368d055a6..b80fc4a91a53 100644
--- a/arch/powerpc/mm/nohash/book3e_pgtable.c
+++ b/arch/powerpc/mm/nohash/book3e_pgtable.c
@@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
pgdp = pgd_offset_k(ea);
p4dp = p4d_offset(pgdp, ea);
if (p4d_none(*p4dp)) {
- pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
- p4d_populate(&init_mm, p4dp, pmdp);
+ pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
+ p4d_populate(&init_mm, p4dp, pudp);
}
pudp = pud_offset(p4dp, ea);
if (pud_none(*pudp)) {
@@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
}
pmdp = pmd_offset(pudp, ea);
if (!pmd_present(*pmdp)) {
- ptep = early_alloc_pgtable(PAGE_SIZE);
+ ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
pmd_populate_kernel(&init_mm, pmdp, ptep);
}
ptep = pte_offset_kernel(pmdp, ea);
--
2.36.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page()
2022-06-23 8:56 [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page() Christophe Leroy
@ 2022-06-23 17:13 ` Mike Rapoport
2022-06-29 7:01 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Mike Rapoport @ 2022-06-23 17:13 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linux-kernel, stable, Paul Mackerras, linuxppc-dev
On Thu, Jun 23, 2022 at 10:56:17AM +0200, Christophe Leroy wrote:
> Commit 2fb4706057bc ("powerpc: add support for folded p4d page tables")
> erroneously changed PUD setup to a mix of PMD and PUD. Fix it.
>
> While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables
> in order to avoid any confusion.
>
> Fixes: 2fb4706057bc ("powerpc: add support for folded p4d page tables")
> Cc: stable@vger.kernel.org
> Cc: Mike Rapoport <rppt@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> arch/powerpc/mm/nohash/book3e_pgtable.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/mm/nohash/book3e_pgtable.c b/arch/powerpc/mm/nohash/book3e_pgtable.c
> index 7d4368d055a6..b80fc4a91a53 100644
> --- a/arch/powerpc/mm/nohash/book3e_pgtable.c
> +++ b/arch/powerpc/mm/nohash/book3e_pgtable.c
> @@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
> pgdp = pgd_offset_k(ea);
> p4dp = p4d_offset(pgdp, ea);
> if (p4d_none(*p4dp)) {
> - pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
> - p4d_populate(&init_mm, p4dp, pmdp);
> + pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
> + p4d_populate(&init_mm, p4dp, pudp);
> }
> pudp = pud_offset(p4dp, ea);
> if (pud_none(*pudp)) {
> @@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
> }
> pmdp = pmd_offset(pudp, ea);
> if (!pmd_present(*pmdp)) {
> - ptep = early_alloc_pgtable(PAGE_SIZE);
> + ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
> pmd_populate_kernel(&init_mm, pmdp, ptep);
> }
> ptep = pte_offset_kernel(pmdp, ea);
> --
> 2.36.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page()
2022-06-23 8:56 [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page() Christophe Leroy
2022-06-23 17:13 ` Mike Rapoport
@ 2022-06-29 7:01 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-06-29 7:01 UTC (permalink / raw)
To: Michael Ellerman, Christophe Leroy, Benjamin Herrenschmidt,
Paul Mackerras
Cc: linuxppc-dev, stable, Mike Rapoport, linux-kernel
On Thu, 23 Jun 2022 10:56:17 +0200, Christophe Leroy wrote:
> Commit 2fb4706057bc ("powerpc: add support for folded p4d page tables")
> erroneously changed PUD setup to a mix of PMD and PUD. Fix it.
>
> While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables
> in order to avoid any confusion.
>
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/book3e: Fix PUD allocation size in map_kernel_page()
https://git.kernel.org/powerpc/c/986481618023e18e187646b0fff05a3c337531cb
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-29 7:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 8:56 [PATCH] powerpc/book3e: Fix PUD allocation size in map_kernel_page() Christophe Leroy
2022-06-23 17:13 ` Mike Rapoport
2022-06-29 7:01 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).