cpumask: use mm_cpumask() wrapper: x86
Subsystems (3)
PATCH 13/13 cpumask: use mm_cpumask() wrapper: x86
Makes code futureproof against the impending change to mm->cpu_vm_mask (to be a pointer).
It's also a chance to use the new cpumask_ ops which take a pointer (the older ones are deprecated, but there's no hurry for arch code).
Signed-off-by Rusty Russell <[email protected]>
--- arch/x86/include/asm/mmu_context.h | 6 +++--- arch/x86/kernel/ldt.c | 4 ++-- arch/x86/mm/tlb.c | 15 ++++++++------- arch/x86/xen/mmu.c | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-)
arch/x86/include/asm/mmu_context.h +3 -3
@@ -37,12 +37,12 @@ static inline void switch_mm(struct mm_sif (likely (prev != next)) {/* stop flush ipis for the previous mm */ -cpu_clear (cpu, prev->cpu_vm_mask); +cpumask_clear_cpu (cpu,mm_cpumask (prev));#ifdef CONFIG_SMP percpu_write (cpu_tlbstate.state,TLBSTATE_OK );percpu_write (cpu_tlbstate.active_mm, next);#endif -cpu_set (cpu, next->cpu_vm_mask); +cpumask_set_cpu (cpu,mm_cpumask (next));/* Re-load page tables */ load_cr3 (next->pgd);
@@ -58,7 +58,7 @@ static inline void switch_mm(struct mm_spercpu_write (cpu_tlbstate.state,TLBSTATE_OK );BUG_ON (percpu_read (cpu_tlbstate.active_mm) != next); -if (!cpu_test_and_set (cpu, next->cpu_vm_mask)) { +if (!cpumask_test_and_set_cpu (cpu,mm_cpumask (next))) {/* We were in lazy tlb mode and leave_mm disabled * tlb flush IPI delivery. We must reload CR3 * to make sure to use no freed page tables.
arch/x86/kernel/ldt.c +2 -2
@@ -67,8 +67,8 @@ static int alloc_ldt(mm_context_t *pc, i#ifdef CONFIG_SMP preempt_disable ();load_LDT (pc); -if (!cpus_equal (current->mm->cpu_vm_mask, -cpumask_of_cpu (smp_processor_id ()))) +if (!cpumask_equal (mm_cpumask (current->mm), +cpumask_of (smp_processor_id ())))smp_call_function (flush_ldt, current->mm,1 );preempt_enable ();#else
arch/x86/mm/tlb.c +8 -7
@@ -59,7 +59,8 @@ void leave_mm(int cpu) {if (percpu_read (cpu_tlbstate.state) ==TLBSTATE_OK )BUG (); -cpu_clear (cpu,percpu_read (cpu_tlbstate.active_mm)->cpu_vm_mask); +cpumask_clear_cpu (cpu, +mm_cpumask (percpu_read (cpu_tlbstate.active_mm)));load_cr3 (swapper_pg_dir); }EXPORT_SYMBOL_GPL (leave_mm);
@@ -240,8 +241,8 @@ void flush_tlb_current_task(void)preempt_disable ();local_flush_tlb (); -if (cpumask_any_but (&mm->cpu_vm_mask,smp_processor_id ()) < nr_cpu_ids) -flush_tlb_others (&mm->cpu_vm_mask, mm,TLB_FLUSH_ALL ); +if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids) +flush_tlb_others (mm_cpumask (mm), mm,TLB_FLUSH_ALL );preempt_enable (); }
@@ -255,8 +256,8 @@ void flush_tlb_mm(struct mm_struct *mm)else leave_mm (smp_processor_id ()); } -if (cpumask_any_but (&mm->cpu_vm_mask,smp_processor_id ()) < nr_cpu_ids) -flush_tlb_others (&mm->cpu_vm_mask, mm,TLB_FLUSH_ALL ); +if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids) +flush_tlb_others (mm_cpumask (mm), mm,TLB_FLUSH_ALL );preempt_enable (); }
@@ -274,8 +275,8 @@ void flush_tlb_page(struct vm_area_strucleave_mm (smp_processor_id ()); } -if (cpumask_any_but (&mm->cpu_vm_mask,smp_processor_id ()) < nr_cpu_ids) -flush_tlb_others (&mm->cpu_vm_mask, mm, va); +if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids) +flush_tlb_others (mm_cpumask (mm), mm, va);preempt_enable (); }
arch/x86/xen/mmu.c +2 -2
@@ -1141,14 +1141,14 @@ static void xen_drop_mm_ref(struct mm_st/* Get the "official" set of cpus referring to our pagetable. */ if (!alloc_cpumask_var (&mask,GFP_ATOMIC )) {for_each_online_cpu (cpu) { -if (!cpumask_test_cpu (cpu, &mm->cpu_vm_mask) +if (!cpumask_test_cpu (cpu,mm_cpumask (mm)) &&per_cpu (xen_current_cr3, cpu) !=__pa (mm->pgd))continue ;smp_call_function_single (cpu, drop_other_mm_ref, mm,1 ); }return ; } -cpumask_copy (mask, &mm->cpu_vm_mask); +cpumask_copy (mask,mm_cpumask (mm));/* It's possible that a vcpu may have a stale reference to our cr3, because its in lazy mode, and it hasn't yet flushed