Commit 82d34008 authored by Catalin Marinas's avatar Catalin Marinas

arm64: Improve error reporting on set_pte_at() checks

Currently the BUG_ON() checks do not give enough information about the
PTEs being set. This patch changes BUG_ON to WARN_ONCE and dumps the
values of the old and new PTEs. In addition, the checks are only made if
the new PTE entry is valid.
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Reported-by: default avatarMing Lei <tom.leiming@gmail.com>
Cc: Will Deacon <will.deacon@arm.com>
parent 98fb7548
...@@ -276,10 +276,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, ...@@ -276,10 +276,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
* hardware updates of the pte (ptep_set_access_flags safely changes * hardware updates of the pte (ptep_set_access_flags safely changes
* valid ptes without going through an invalid entry). * valid ptes without going through an invalid entry).
*/ */
if (IS_ENABLED(CONFIG_DEBUG_VM) && IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) &&
pte_valid(*ptep)) { pte_valid(*ptep) && pte_valid(pte)) {
BUG_ON(!pte_young(pte)); VM_WARN_ONCE(!pte_young(pte),
BUG_ON(pte_write(*ptep) && !pte_dirty(pte)); "%s: racy access flag clearing: 0x%016llx -> 0x%016llx",
__func__, pte_val(*ptep), pte_val(pte));
VM_WARN_ONCE(pte_write(*ptep) && !pte_dirty(pte),
"%s: racy dirty state clearing: 0x%016llx -> 0x%016llx",
__func__, pte_val(*ptep), pte_val(pte));
} }
set_pte(ptep, pte); set_pte(ptep, pte);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment