pxd_ERROR() has been used in generic mm just to print the page table entry
in pxd_clear_bad() before clearing those out with pxd_clear() later. These
pxd_ERROR() macros have been provided by all platforms which basically did
the same thing.

Make pxd_clear_bad() use recently added ptval_to_str() instead for printing
page table entries thus completely dropping dependency on platform provided
pxd_ERROR() macros which can then be dropped off later on.

Cc: Andrew Morton <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: David Hildenbrand (Arm) <[email protected]>
Acked-by: Mike Rapoport (Microsoft) <[email protected]>
Signed-off-by: Anshuman Khandual <[email protected]>
---
Changes in V1:

- Dropped including mm_type.h

 mm/pgtable-generic.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index b91b1a98029c..224c444cf45d 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -26,14 +26,20 @@
 
 void pgd_clear_bad(pgd_t *pgd)
 {
-       pgd_ERROR(*pgd);
+       char str[PTVAL_STR_MAX];
+
+       ptval_to_str(str, pgd_val(*pgd));
+       pr_err("bad pgd %s.\n", str);
        pgd_clear(pgd);
 }
 
 #ifndef __PAGETABLE_P4D_FOLDED
 void p4d_clear_bad(p4d_t *p4d)
 {
-       p4d_ERROR(*p4d);
+       char str[PTVAL_STR_MAX];
+
+       ptval_to_str(str, p4d_val(*p4d));
+       pr_err("bad p4d %s.\n", str);
        p4d_clear(p4d);
 }
 #endif
@@ -41,7 +47,10 @@ void p4d_clear_bad(p4d_t *p4d)
 #ifndef __PAGETABLE_PUD_FOLDED
 void pud_clear_bad(pud_t *pud)
 {
-       pud_ERROR(*pud);
+       char str[PTVAL_STR_MAX];
+
+       ptval_to_str(str, pud_val(*pud));
+       pr_err("bad pud %s.\n", str);
        pud_clear(pud);
 }
 #endif
@@ -53,7 +62,10 @@ void pud_clear_bad(pud_t *pud)
  */
 void pmd_clear_bad(pmd_t *pmd)
 {
-       pmd_ERROR(*pmd);
+       char str[PTVAL_STR_MAX];
+
+       ptval_to_str(str, pmd_val(*pmd));
+       pr_err("bad pmd %s.\n", str);
        pmd_clear(pmd);
 }
 
-- 
2.43.0


Reply via email to