Skip to content

Commit c733812

Browse files
Valentin Schneiderctmarinas
authored andcommitted
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 <[email protected]> Suggested-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Valentin Schneider <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent b4d6bb3 commit c733812

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
10011001
*/
10021002
static inline bool arch_faults_on_old_pte(void)
10031003
{
1004-
WARN_ON(preemptible());
1004+
/* The register read below requires a stable CPU to make any sense */
1005+
cant_migrate();
10051006

10061007
return !cpu_has_hw_af();
10071008
}

0 commit comments

Comments
 (0)