arm64: mm: Make arch_faults_on_old_pte() check for migratability
PATCH v4 1/1 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().
---
v3 -> v4: Dropped migratable(), reuse cant_migrate() (Sebastian)
--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +2 -1
@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,*/ 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 (); }
Signature · 1 line
2.25.1
Quoted 9 lines · Valentin Schneider
arch_faults_on_old_pte()relies on the calling context being non-preemptible.CONFIG_PREEMPT_RTturns the PTE lock into a sleepable spinlock, which doesn't disable preemption once acquired, triggering the warning inarch_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.
Quoted 5 lines
Make
arch_faults_on_old_pte()checkcant_migrate()instead ofpreemptible().
Let me pick that up so I can drop the other two. I hope the ARM64 folks follow my lead ;)
Sebastian
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 25 lines · Valentin Schneider
arch_faults_on_old_pte()relies on the calling context being non-preemptible.CONFIG_PREEMPT_RTturns the PTE lock into a sleepable spinlock, which doesn't disable preemption once acquired, triggering the warning inarch_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()checkcant_migrate()instead ofpreemptible().Suggested-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Valentin Schneider <[email protected]>---
v3 -> v4: Droppedmigratable(), reusecant_migrate()(Sebastian)--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm64/include/asm/pgtable.h +0
-0
arch/arm64/include/asm/pgtable.h static inline void update_mmu_cache(struct vm_area_struct *vma, · line 1008
Quoted 9 lines
arch/arm64/include/asm/pgtable.h +2
-1@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,*/ 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 (); }
The patch looks alright but what's the plan with it? Does it go into the preempt-rt tree, mainline? It's not a fix to be queued now, so:
Quoted 3 lines · Catalin Marinas
The patch looks alright but what's the plan with it? Does it go into the preempt-rt tree, mainline? It's not a fix to be queued now, so:
It would be nice if if it could go mainline, too.
Quoted 1 line
Acked-by Catalin Marinas <[email protected]>
Sebastian
Will Deacon
maintainerQuoted 25 lines · Valentin Schneider
arch_faults_on_old_pte()relies on the calling context being non-preemptible.CONFIG_PREEMPT_RTturns the PTE lock into a sleepable spinlock, which doesn't disable preemption once acquired, triggering the warning inarch_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()checkcant_migrate()instead ofpreemptible().Suggested-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Valentin Schneider <[email protected]>---
v3 -> v4: Droppedmigratable(), reusecant_migrate()(Sebastian)--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm64/include/asm/pgtable.h +0
-0
arch/arm64/include/asm/pgtable.h static inline void update_mmu_cache(struct vm_area_struct *vma, · line 1005
Quoted 6 lines
arch/arm64/include/asm/pgtable.h +2
-1@@ -1001,7 +1001,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,*/ 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 ();
FWIW: There's a patch in the multi-generational LRU series that drops this WARN_ON() entirely. I'm not sure if/when that lot will land, but just wanted to let you know.
Will