Commit c733812d authored by Valentin Schneider's avatar Valentin Schneider Committed by Catalin Marinas

arm64: mm: Make arch_faults_on_old_pte() check for migratability

arch_faults_on_old_pte() relies on the calling context being
non-preemptible. CONFIG_PREEMPT_RT turns the PTE lock into a sleepable
spinlock, which doesn't disable preemption once acquired, triggering the
warning in arch_faults_on_old_pte().

It does however disable migration, ensuring the task remains on the same
CPU during the entirety of the critical section, making the read of
cpu_has_hw_af() safe and stable.

Make arch_faults_on_old_pte() check cant_migrate() instead of preemptible().

Cc: Valentin Schneider <vschneid@redhat.com>
Suggested-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
Link: https://lore.kernel.org/r/20220127192437.1192957-1-valentin.schneider@arm.comAcked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220505163207.85751-4-bigeasy@linutronix.deSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent b4d6bb38
...@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, ...@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
*/ */
static inline bool arch_faults_on_old_pte(void) static inline bool arch_faults_on_old_pte(void)
{ {
WARN_ON(preemptible()); /* The register read below requires a stable CPU to make any sense */
cant_migrate();
return !cpu_has_hw_af(); return !cpu_has_hw_af();
} }
......
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