From: Arnd Bergmann <[email protected]>

HIGHPTE support is gone now, so it's easy enough to print the
PTE here along with the upper level entries.

Acked-by: "David Hildenbrand (Arm)" <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
---
 mm/memory.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index ec3d9d99ccee..6404bb447d9c 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -528,9 +528,11 @@ static void __print_bad_page_map_pgtable(struct mm_struct 
*mm, unsigned long add
        char p4d_str[PTVAL_STR_MAX];
        char pud_str[PTVAL_STR_MAX];
        char pmd_str[PTVAL_STR_MAX];
+       char pte_str[PTVAL_STR_MAX];
        p4d_t p4d, *p4dp;
        pud_t pud, *pudp;
        pmd_t pmd, *pmdp;
+       pte_t pte, *ptep;
        pgd_t *pgdp;
 
        /*
@@ -567,13 +569,18 @@ static void __print_bad_page_map_pgtable(struct mm_struct 
*mm, unsigned long add
        pmd = pmdp_get(pmdp);
        ptval_to_str(pmd_str, pmd_val(pmd));
 
-       /*
-        * Dumping the PTE would be nice, but it's tricky with CONFIG_HIGHPTE,
-        * because the table should already be mapped by the caller and
-        * doing another map would be bad. print_bad_page_map() should
-        * already take care of printing the PTE.
-        */
-       pr_alert("pgd:%s p4d:%s pud:%s pmd:%s\n", pgd_str, p4d_str, pud_str, 
pmd_str);
+       if (!pmd_present(pmd) || pmd_leaf(pmd)) {
+               pr_alert("pgd:%s p4d:%s pud:%s pmd: %s\n",
+                        pgd_str, p4d_str, pud_str, pmd_str);
+               return;
+       }
+
+       ptep = pte_offset_kernel(pmdp, addr);
+       pte = ptep_get(ptep);
+       ptval_to_str(pte_str, pte_val(pte));
+
+       pr_alert("pgd:%s p4d:%s pud:%s pmd:%s pte:%s\n",
+                pgd_str, p4d_str, pud_str, pmd_str, pte_str);
 }
 
 /*
-- 
2.53.0


Reply via email to