Skip to contentSkip to conversation

arm64: fault: Print info about page table structure when dumping pte

PATCH New Will Deacon 2 participants 3 messages May 30, 2017 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: fault: Print info about page table structure when dumping pte

Whilst debugging a remote crash, I noticed that show_pte is unhelpful when it comes to describing the structure of the page table being walked. This is easily fixed by printing out the page table (swapper vs user), page size and virtual address size when displaying the PGD address.

---
 arch/arm64/mm/fault.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/mm/fault.c +3 -1
index 37b95dff0b07..ee6085a922b6 100644
@@ -89,7 +89,9 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
 	if (!mm)
 		mm = &init_mm;
 
-	pr_alert("pgd = %p\n", mm->pgd);
+	pr_alert("%s pgtable: %luk pages, %u-bit VAs, pgd = %p\n",
+		 mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K,
+		 VA_BITS, mm->pgd);
 	pgd = pgd_offset(mm, addr);
 	pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
 
Signature · 1 line
2.1.4
reviewer
#1 lore raw

PATCH 1/1 arm64: fault: Print info about page table structure when dumping pte

Quoted 15 lines · Will Deacon

Whilst debugging a remote crash, I noticed that show_pte is unhelpful when it comes to describing the structure of the page table being walked. This is easily fixed by printing out the page table (swapper vs user), page size and virtual address size when displaying the PGD address.

---
 arch/arm64/mm/fault.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/mm/fault.c +0 -0
index 37b95dff0b07..ee6085a922b6 100644

arch/arm64/mm/fault.c void show_pte(struct mm_struct *mm, unsigned long addr) · line 94

Quoted 7 lines
arch/arm64/mm/fault.c +3 -1
@@ -89,7 +89,9 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
 	if (!mm)
 		mm = &init_mm;
 
-	pr_alert("pgd = %p\n", mm->pgd);
+	pr_alert("%s pgtable: %luk pages, %u-bit VAs, pgd = %p\n",
+		 mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K,
+		 VA_BITS, mm->pgd);

I take it this will go with Kristina's fix [1] to dump the correct page table?

Otherwise, this would be more misleading than presently.

Assuming that is the case, this looks very useful to me. FWIW:

Mark.

Quoted 11 lines
arch/arm64/mm/fault.c +0 -0
 	pgd = pgd_offset(mm, addr);
 	pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
 
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 1/1 arm64: fault: Print info about page table structure when dumping pte

Quoted 19 lines · Mark Rutland
Quoted 18 lines · Will Deacon

Whilst debugging a remote crash, I noticed that show_pte is unhelpful when it comes to describing the structure of the page table being walked. This is easily fixed by printing out the page table (swapper vs user), page size and virtual address size when displaying the PGD address.

---
 arch/arm64/mm/fault.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/mm/fault.c +0 -0
index 37b95dff0b07..ee6085a922b6 100644
@@ -89,7 +89,9 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
 	if (!mm)
 		mm = &init_mm;
 
Quoted 7 lines

arch/arm64/mm/fault.c void show_pte(struct mm_struct *mm, unsigned long addr) · line 94

Quoted 4 lines
arch/arm64/mm/fault.c +3 -1
-	pr_alert("pgd = %p\n", mm->pgd);
+	pr_alert("%s pgtable: %luk pages, %u-bit VAs, pgd = %p\n",
+		 mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K,
+		 VA_BITS, mm->pgd);

I take it this will go with Kristina's fix [1] to dump the correct page table?

Yup, just waiting for her to respin those patches and I'll apply this one on top.

Quoted 5 lines

Otherwise, this would be more misleading than presently.

Assuming that is the case, this looks very useful to me. FWIW:

Thanks,

Will