Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc: Add mm_cpumask warning when context switching

When context switching away from an mm, add a CONFIG_DEBUG_VM warning
check to ensure this CPU is still set in the mask. This could catch
bugs where the mask is improperly trimmed while the CPU is still using
the mm.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230524060821.148015-4-npiggin@gmail.com

authored by

Nicholas Piggin and committed by
Michael Ellerman
177255af f74b2a6c

+5 -2
+5 -2
arch/powerpc/mm/mmu_context.c
··· 43 43 void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, 44 44 struct task_struct *tsk) 45 45 { 46 + int cpu = smp_processor_id(); 46 47 bool new_on_cpu = false; 47 48 48 49 /* Mark this context has been used on the new CPU */ 49 - if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) { 50 + if (!cpumask_test_cpu(cpu, mm_cpumask(next))) { 50 51 VM_WARN_ON_ONCE(next == &init_mm); 51 - cpumask_set_cpu(smp_processor_id(), mm_cpumask(next)); 52 + cpumask_set_cpu(cpu, mm_cpumask(next)); 52 53 inc_mm_active_cpus(next); 53 54 54 55 /* ··· 102 101 * sub architectures. Out of line for now 103 102 */ 104 103 switch_mmu_context(prev, next, tsk); 104 + 105 + VM_WARN_ON_ONCE(!cpumask_test_cpu(cpu, mm_cpumask(prev))); 105 106 } 106 107 107 108 #ifndef CONFIG_PPC_BOOK3S_64