mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: Drop redundant BUG_ON(!pgtable_alloc)
@ 2022-11-18  5:31 Anshuman Khandual
  2022-11-18 11:10 ` Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Anshuman Khandual @ 2022-11-18  5:31 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Mark Rutland,
	Andrew Morton, linux-kernel

__create_pgd_mapping_locked() expects a page allocator used while mapping a
virtual range. This page allocator function propagates down the call chain,
while building intermediate levels in the page table. Passed page allocator
is a necessary ingredient required to build the page table but its presence
can be asserted just once in the very beginning rather than in all the down
stream functions. This consolidates BUG_ON(!pgtable_alloc) checks just in a
single place i.e __create_pgd_mapping_locked().

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.1-rc5

 arch/arm64/mm/mmu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 5a19950e7289..97ca82001089 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -207,7 +207,6 @@ static void alloc_init_cont_pte(pmd_t *pmdp, unsigned long addr,
 
 		if (flags & NO_EXEC_MAPPINGS)
 			pmdval |= PMD_TABLE_PXN;
-		BUG_ON(!pgtable_alloc);
 		pte_phys = pgtable_alloc(PAGE_SHIFT);
 		__pmd_populate(pmdp, pte_phys, pmdval);
 		pmd = READ_ONCE(*pmdp);
@@ -285,7 +284,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
 
 		if (flags & NO_EXEC_MAPPINGS)
 			pudval |= PUD_TABLE_PXN;
-		BUG_ON(!pgtable_alloc);
 		pmd_phys = pgtable_alloc(PMD_SHIFT);
 		__pud_populate(pudp, pmd_phys, pudval);
 		pud = READ_ONCE(*pudp);
@@ -324,7 +322,6 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
 
 		if (flags & NO_EXEC_MAPPINGS)
 			p4dval |= P4D_TABLE_PXN;
-		BUG_ON(!pgtable_alloc);
 		pud_phys = pgtable_alloc(PUD_SHIFT);
 		__p4d_populate(p4dp, pud_phys, p4dval);
 		p4d = READ_ONCE(*p4dp);
@@ -383,6 +380,7 @@ static void __create_pgd_mapping_locked(pgd_t *pgdir, phys_addr_t phys,
 	phys &= PAGE_MASK;
 	addr = virt & PAGE_MASK;
 	end = PAGE_ALIGN(virt + size);
+	BUG_ON(!pgtable_alloc);
 
 	do {
 		next = pgd_addr_end(addr, end);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH] arm64/mm: Drop redundant BUG_ON(!pgtable_alloc)
@ 2022-11-21 15:47 Naresh Kamboju
  2022-11-21 18:03 ` Will Deacon
  0 siblings, 1 reply; 13+ messages in thread
From: Naresh Kamboju @ 2022-11-21 15:47 UTC (permalink / raw)
  To: open list, lkft-triage, regressions
  Cc: Catalin Marinas, Will Deacon, Mark Rutland, Andrew Morton,
	Linux ARM, Anshuman Khandual, Nathan Chancellor, Mark Brown,
	Anders Roxell

LKFT detected arm64 boot regression on today's Linux next-20221121 tag.
The Kernel boot log did not show anything on the serial console.

Anders bisected this problem and found the subject commit is the
first bad commit.

# first bad commit: [9ed2b4616d4e846ece2a04cb5007ce1d1bd9e3f3]
        arm64/mm: Drop redundant BUG_ON(!pgtable_alloc)

Later it was found this lore link which was already reported [1].

ref:
[1] https://lore.kernel.org/all/Y3pS5fdZ3MdLZ00t@dev-arch.thelio-3990X/


--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-22 19:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18  5:31 [PATCH] arm64/mm: Drop redundant BUG_ON(!pgtable_alloc) Anshuman Khandual
2022-11-18 11:10 ` Mark Rutland
2022-11-18 19:40 ` Will Deacon
2022-11-20 16:16 ` Nathan Chancellor
2022-11-21  5:30   ` Anshuman Khandual
2022-11-21 12:27     ` Mark Rutland
2022-11-21 12:51       ` Will Deacon
2022-11-21 13:56       ` Robin Murphy
2022-11-22  3:13         ` Anshuman Khandual
2022-11-22 14:12           ` Biju Das
2022-11-22 19:08           ` Robin Murphy
2022-11-21 15:47 Naresh Kamboju
2022-11-21 18:03 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®