mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
arm64/mm: standardize printing for pgtable entries
Standardize printing for pgtable entries using recently introduced generic helper ptval_bytes_to_hex_str() in core MM which automatically enables 128 bits entries when added later. Link: https://lore.kernel.org/20260916044933.2689426-3-anshuman.khandual@arm.com Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Lorenzo Stoakes <ljs@kernel.org>
This commit is contained in:
parent
b32f336987
commit
d4113e9983
|
|
@ -131,6 +131,7 @@ static inline unsigned long mm_to_pgd_phys(struct mm_struct *mm)
|
|||
*/
|
||||
static void show_pte(unsigned long addr)
|
||||
{
|
||||
char pxd_str[PTVAL_STR_MAX];
|
||||
struct mm_struct *mm;
|
||||
pgd_t *pgdp;
|
||||
pgd_t pgd;
|
||||
|
|
@ -160,7 +161,8 @@ static void show_pte(unsigned long addr)
|
|||
|
||||
pgdp = pgd_offset(mm, addr);
|
||||
pgd = READ_ONCE(*pgdp);
|
||||
pr_alert("[%016lx] pgd=%016llx", addr, pgd_val(pgd));
|
||||
ptval_to_str(pxd_str, pgd_val(pgd));
|
||||
pr_alert("[%016lx] pgd=%s", addr, pxd_str);
|
||||
|
||||
do {
|
||||
p4d_t *p4dp, p4d;
|
||||
|
|
@ -173,19 +175,22 @@ static void show_pte(unsigned long addr)
|
|||
|
||||
p4dp = p4d_offset_lockless(pgdp, pgd, addr);
|
||||
p4d = READ_ONCE(*p4dp);
|
||||
pr_cont(", p4d=%016llx", p4d_val(p4d));
|
||||
ptval_to_str(pxd_str, p4d_val(p4d));
|
||||
pr_cont(", p4d=%s", pxd_str);
|
||||
if (p4d_none(p4d) || p4d_bad(p4d))
|
||||
break;
|
||||
|
||||
pudp = pud_offset_lockless(p4dp, p4d, addr);
|
||||
pud = READ_ONCE(*pudp);
|
||||
pr_cont(", pud=%016llx", pud_val(pud));
|
||||
ptval_to_str(pxd_str, pud_val(pud));
|
||||
pr_cont(", pud=%s", pxd_str);
|
||||
if (pud_none(pud) || pud_bad(pud))
|
||||
break;
|
||||
|
||||
pmdp = pmd_offset_lockless(pudp, pud, addr);
|
||||
pmd = READ_ONCE(*pmdp);
|
||||
pr_cont(", pmd=%016llx", pmd_val(pmd));
|
||||
ptval_to_str(pxd_str, pmd_val(pmd));
|
||||
pr_cont(", pmd=%s", pxd_str);
|
||||
if (pmd_none(pmd) || pmd_bad(pmd))
|
||||
break;
|
||||
|
||||
|
|
@ -194,7 +199,8 @@ static void show_pte(unsigned long addr)
|
|||
break;
|
||||
|
||||
pte = __ptep_get(ptep);
|
||||
pr_cont(", pte=%016llx", pte_val(pte));
|
||||
ptval_to_str(pxd_str, pte_val(pte));
|
||||
pr_cont(", pte=%s", pxd_str);
|
||||
pte_unmap(ptep);
|
||||
} while(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -2412,6 +2412,8 @@ int arch_set_user_pkey_access(int pkey, unsigned long init_val)
|
|||
#ifdef CONFIG_DEBUG_VM
|
||||
void __check_safe_pte_update(struct mm_struct *mm, pte_t *ptep, pte_t pte)
|
||||
{
|
||||
char pte_str_old[PTVAL_STR_MAX];
|
||||
char pte_str[PTVAL_STR_MAX];
|
||||
pte_t old_pte;
|
||||
|
||||
old_pte = __ptep_get(ptep);
|
||||
|
|
@ -2426,14 +2428,16 @@ void __check_safe_pte_update(struct mm_struct *mm, pte_t *ptep, pte_t pte)
|
|||
* (__ptep_set_access_flags safely changes valid ptes without going
|
||||
* through an invalid entry).
|
||||
*/
|
||||
ptval_to_str(pte_str, pte_val(pte));
|
||||
ptval_to_str(pte_str_old, pte_val(old_pte));
|
||||
VM_WARN_ONCE(!pte_young(pte),
|
||||
"%s: racy access flag clearing: 0x%016llx -> 0x%016llx",
|
||||
__func__, pte_val(old_pte), pte_val(pte));
|
||||
"%s: racy access flag clearing: %s -> %s",
|
||||
__func__, pte_str_old, pte_str);
|
||||
VM_WARN_ONCE(pte_write(old_pte) && !pte_dirty(pte),
|
||||
"%s: racy dirty state clearing: 0x%016llx -> 0x%016llx",
|
||||
__func__, pte_val(old_pte), pte_val(pte));
|
||||
"%s: racy dirty state clearing: %s -> %s",
|
||||
__func__, pte_str_old, pte_str);
|
||||
VM_WARN_ONCE(!pgattr_change_is_safe(pte_val(old_pte), pte_val(pte)),
|
||||
"%s: unsafe attribute change: 0x%016llx -> 0x%016llx",
|
||||
__func__, pte_val(old_pte), pte_val(pte));
|
||||
"%s: unsafe attribute change: %s -> %s",
|
||||
__func__, pte_str_old, pte_str);
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_VM */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user