arch/mips: remove references to cpu_*_map.
Subsystems (2)
PATCH 4/12 arch/mips: remove references to cpu_*_map.
From: Rusty Russell <[email protected]>
This has been obsolescent for a while; time for the final push.
Also took the chance to get rid of old cpus_* in favor of cpumask_*.
--- arch/mips/cavium-octeon/smp.c | 2 +- arch/mips/kernel/mips-mt-fpaff.c | 2 +- arch/mips/kernel/proc.c | 2 +- arch/mips/kernel/smp-bmips.c | 2 +- arch/mips/kernel/smp.c | 27 ++++++++++++--------------- arch/mips/kernel/smtc.c | 2 +- arch/mips/mm/c-octeon.c | 6 +++--- arch/mips/netlogic/common/smp.c | 6 +++--- arch/mips/pmc-sierra/yosemite/smp.c | 6 +++--- arch/mips/sgi-ip27/ip27-smp.c | 2 +- arch/mips/sibyte/bcm1480/smp.c | 5 ++--- arch/mips/sibyte/sb1250/smp.c | 7 +++---- 12 files changed, 32 insertions(+), 37 deletions(-)
arch/mips/cavium-octeon/smp.c +1 -1
@@ -268,7 +268,7 @@ static int octeon_cpu_disable(void)spin_lock (&smp_reserve_lock); -cpu_clear (cpu, cpu_online_map); +set_cpu_online (cpu, false);cpu_clear (cpu, cpu_callin_map);local_irq_disable ();fixup_irqs ();
arch/mips/kernel/mips-mt-fpaff.c +1 -1
@@ -173,7 +173,7 @@ asmlinkage long mipsmt_sys_sched_getaffiif (retval) goto out_unlock; -cpus_and (mask, p->thread.user_cpus_allowed, cpu_possible_map); +cpumask_and (&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); out_unlock:read_unlock (&tasklist_lock);
arch/mips/kernel/proc.c +1 -1
@@ -25,7 +25,7 @@ static int show_cpuinfo(struct seq_fileint i;#ifdef CONFIG_SMP -if (!cpu_isset (n, cpu_online_map)) +if (!cpu_online (n))return 0 ;#endif
arch/mips/kernel/smp-bmips.c +1 -1
@@ -319,7 +319,7 @@ static int bmips_cpu_disable(void)pr_info ("SMP: CPU%d is offline\n" , cpu); -cpu_clear (cpu, cpu_online_map); +set_cpu_online (cpu, false);cpu_clear (cpu, cpu_callin_map);local_flush_tlb_all ();
arch/mips/kernel/smp.c +12 -15
@@ -148,7 +148,7 @@ static void stop_this_cpu(void *dummy)/* * Remove this CPU: */ -cpu_clear (smp_processor_id (), cpu_online_map); +set_cpu_online (smp_processor_id (), false);for (;;) {if (cpu_wait) (*cpu_wait)();/* Wait if available. */
@@ -174,7 +174,7 @@ void __init smp_prepare_cpus(unsigned in mp_ops->prepare_cpus (max_cpus);set_cpu_sibling_map (0 );#ifndef CONFIG_HOTPLUG_CPU -init_cpu_present (&cpu_possible_map); +init_cpu_present (cpu_possible_mask);#endif }
@@ -248,7 +248,7 @@ int __cpuinit __cpu_up(unsigned int cpu)while (!cpu_isset (cpu, cpu_callin_map))udelay (100 ); -cpu_set (cpu, cpu_online_map); +set_cpu_online (cpu, true);return 0 ; }
@@ -320,13 +320,12 @@ void flush_tlb_mm(struct mm_struct *mm)if ((atomic_read (&mm->mm_users) !=1 ) || (current->mm != mm)) {smp_on_other_tlbs (flush_tlb_mm_ipi, mm); }else { -cpumask_t mask = cpu_online_map;unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, mm))cpu_context (cpu, mm) =0 ; + } }local_flush_tlb_mm (mm);
@@ -360,13 +359,12 @@ void flush_tlb_range(struct vm_area_strusmp_on_other_tlbs (flush_tlb_range_ipi, &fd); }else { -cpumask_t mask = cpu_online_map;unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, mm))cpu_context (cpu, mm) =0 ; + } }local_flush_tlb_range (vma, start, end);preempt_enable ();
@@ -407,13 +405,12 @@ void flush_tlb_page(struct vm_area_strucsmp_on_other_tlbs (flush_tlb_page_ipi, &fd); }else { -cpumask_t mask = cpu_online_map;unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, vma->vm_mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, vma->vm_mm))cpu_context (cpu, vma->vm_mm) =0 ; + } }local_flush_tlb_page (vma, page);preempt_enable ();
arch/mips/kernel/smtc.c +1 -1
@@ -292,7 +292,7 @@ static void smtc_configure_tlb(void)* possibly leave some TCs/VPEs as "slave" processors. * * Use c0_MVPConf0 to find out how many TCs are available, setting up -* cpu_possible_map and the logical/physical mappings. +* cpu_possible_mask and the logical/physical mappings. */ int __init smtc_build_cpu_map (int start_cpu_slot)
arch/mips/mm/c-octeon.c +3 -3
@@ -81,9 +81,9 @@ static void octeon_flush_icache_all_coreif (vma) mask = *mm_cpumask (vma->vm_mm);else - mask = cpu_online_map; -cpu_clear (cpu, mask); -for_each_cpu_mask (cpu, mask) + mask = *cpu_online_mask; +cpumask_clear (&mask, cpu); +for_each_cpu (cpu, &mask)octeon_send_ipi_single (cpu,SMP_ICACHE_FLUSH );preempt_enable ();
arch/mips/netlogic/common/smp.c +3 -3
@@ -165,7 +165,7 @@ void __init nlm_smp_setup(void)cpu_set (boot_cpu, phys_cpu_present_map); __cpu_number_map[boot_cpu] =0 ; __cpu_logical_map[0 ] = boot_cpu; -cpu_set (0 , cpu_possible_map); +set_cpu_possible (0 , true); num_cpus =1 ;for (i =0 ; i <NR_CPUS ; i++) {
@@ -177,14 +177,14 @@ void __init nlm_smp_setup(void)cpu_set (i, phys_cpu_present_map); __cpu_number_map[i] = num_cpus; __cpu_logical_map[num_cpus] = i; -cpu_set (num_cpus, cpu_possible_map); +set_cpu_possible (num_cpus, true); ++num_cpus; } }pr_info ("Phys CPU present map: %lx, possible map %lx\n" , (unsigned long )phys_cpu_present_map.bits[0 ], - (unsigned long )cpu_possible_map.bits[0 ]); + (unsigned long )cpumask_bits (cpu_possible_mask)[0 ]);pr_info ("Detected %i Slave CPU(s)\n" , num_cpus);nlm_set_nmi_handler (nlm_boot_secondary_cpus);
arch/mips/pmc-sierra/yosemite/smp.c +3 -3
@@ -155,10 +155,10 @@ static void __init yos_smp_setup(void) {int i; -cpus_clear (cpu_possible_map); +init_cpu_possible (cpu_none_mask);for (i =0 ; i <2 ; i++) { -cpu_set (i, cpu_possible_map); +set_cpu_possible (i, true); __cpu_number_map[i] = i; __cpu_logical_map[i] = i; }
@@ -169,7 +169,7 @@ static void __init yos_prepare_cpus(unsi/* * Be paranoid. Enable the IPI only if we're really about to go SMP. */ -if (cpus_weight (cpu_possible_map)) +if (num_possible_cpus ())set_c0_status (STATUSF_IP5 ); }
arch/mips/sgi-ip27/ip27-smp.c +1 -1
@@ -76,7 +76,7 @@ static int do_cpumask(cnodeid_t cnode, n/* Only let it join in if it's marked enabled */ if ((acpu->cpu_info.flags &KLINFO_ENABLE ) && (tot_cpus_found !=NR_CPUS )) { -cpu_set (cpuid, cpu_possible_map); +set_cpu_possible (cpuid, true);alloc_cpupda (cpuid, tot_cpus_found); cpus_found++; tot_cpus_found++;
arch/mips/sibyte/bcm1480/smp.c +2 -3
@@ -147,14 +147,13 @@ static void __init bcm1480_smp_setup(voi {int i, num; -cpus_clear (cpu_possible_map); -cpu_set (0 , cpu_possible_map); +init_cpu_possible (cpumask_of (0 )); __cpu_number_map[0 ] =0 ; __cpu_logical_map[0 ] =0 ;for (i =1 , num =0 ; i <NR_CPUS ; i++) {if (cfe_cpu_stop (i) ==0 ) { -cpu_set (i, cpu_possible_map); +set_cpu_possible (i, true); __cpu_number_map[i] = ++num; __cpu_logical_map[num] = i; }
arch/mips/sibyte/sb1250/smp.c +3 -4
@@ -126,7 +126,7 @@ static void __cpuinit sb1250_boot_second/* * Use CFE to find out how many CPUs are available, setting up -* cpu_possible_map and the logical/physical mappings. +* cpu_possible_mask and the logical/physical mappings. * XXXKW will the boot CPU ever not be physical 0? * * Common setup before any secondaries are started
@@ -135,14 +135,13 @@ static void __init sb1250_smp_setup(void {int i, num; -cpus_clear (cpu_possible_map); -cpu_set (0 , cpu_possible_map); +init_cpu_possible (cpumask_of (0 )); __cpu_number_map[0 ] =0 ; __cpu_logical_map[0 ] =0 ;for (i =1 , num =0 ; i <NR_CPUS ; i++) {if (cfe_cpu_stop (i) ==0 ) { -cpu_set (i, cpu_possible_map); +set_cpu_possible (i, true); __cpu_number_map[i] = ++num; __cpu_logical_map[num] = i; }
Quoted 10 lines · Rusty Russell
From: Rusty Russell <[email protected]>
This has been obsolescent for a while; time for the final push.
Also took the chance to get rid of old cpus_* in favor of cpumask_*.
Signed-off-by Rusty Russell <[email protected]>Cc Ralf Baechle <[email protected]>---
[...]
Quoted 34 lines
arch/mips/kernel/smp.c +3
-3@@ -148,7 +148,7 @@ static void stop_this_cpu(void *dummy)/* * Remove this CPU: */ -cpu_clear (smp_processor_id (), cpu_online_map); +set_cpu_online (smp_processor_id (), false);for (;;) {if (cpu_wait) (*cpu_wait)();/* Wait if available. */ @@ -174,7 +174,7 @@ void __init smp_prepare_cpus(unsigned in mp_ops->prepare_cpus (max_cpus);set_cpu_sibling_map (0 );#ifndef CONFIG_HOTPLUG_CPU -init_cpu_present (&cpu_possible_map); +init_cpu_present (cpu_possible_mask);#endif }@@ -248,7 +248,7 @@ int __cpuinit __cpu_up(unsigned int cpu)while (!cpu_isset (cpu, cpu_callin_map))udelay (100 ); -cpu_set (cpu, cpu_online_map); +set_cpu_online (cpu, true);return 0 ; }@@ -320,13 +320,12 @@ void flush_tlb_mm(struct mm_struct *mm)if ((atomic_read (&mm->mm_users) !=1 ) || (current->mm != mm)) {smp_on_other_tlbs (flush_tlb_mm_ipi, mm); }else {
arch/mips/kernel/smp.c void flush_tlb_mm(struct mm_struct *mm) · line 328
Quoted 10 lines
arch/mips/kernel/smp.c +3
-4-cpumask_t mask = cpu_online_map;unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, mm))cpu_context (cpu, mm) =0 ; + }
Strictly speaking, this one is not a mere cleanup. It causes a subtle change in
behaviour: earlier, it used to iterate over a local copy of cpu_online_mask, which wouldn't change. However, with this patch, it will iterate directly over cpu_online_mask, which can change underneath. (The preempt_disable() won't stop new CPUs from coming in.. it only prevents CPUs from going offline, that too provided that we use stop_machine stuff for CPU offline, which we do currently.)
Quoted 8 lines
arch/mips/kernel/smp.c +0
-1}local_flush_tlb_mm (mm);@@ -360,13 +359,12 @@ void flush_tlb_range(struct vm_area_strusmp_on_other_tlbs (flush_tlb_range_ipi, &fd); }else { -cpumask_t mask = cpu_online_map;
arch/mips/kernel/smp.c void flush_tlb_range(struct vm_area_stru · line 368
Quoted 10 lines
arch/mips/kernel/smp.c +3
-3unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, mm))cpu_context (cpu, mm) =0 ; + } }
Same here.
Quoted 7 lines
arch/mips/kernel/smp.c +0
-1local_flush_tlb_range (vma, start, end);preempt_enable ();@@ -407,13 +405,12 @@ void flush_tlb_page(struct vm_area_strucsmp_on_other_tlbs (flush_tlb_page_ipi, &fd); }else { -cpumask_t mask = cpu_online_map;
arch/mips/kernel/smp.c void flush_tlb_page(struct vm_area_struc · line 414
Quoted 10 lines
arch/mips/kernel/smp.c +3
-3unsigned int cpu; -cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, vma->vm_mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, vma->vm_mm))cpu_context (cpu, vma->vm_mm) =0 ; + } }
And here too.
Quoted 18 lines
arch/mips/kernel/smp.c +0
-0local_flush_tlb_page (vma, page);preempt_enable ();arch/mips/kernel/smtc.c +1
-1@@ -292,7 +292,7 @@ static void smtc_configure_tlb(void)* possibly leave some TCs/VPEs as "slave" processors. * * Use c0_MVPConf0 to find out how many TCs are available, setting up -* cpu_possible_map and the logical/physical mappings. +* cpu_possible_mask and the logical/physical mappings. */ int __init smtc_build_cpu_map (int start_cpu_slot)
arch/mips/mm/c-octeon.c static void octeon_flush_icache_all_core · line 85
Quoted 8 lines
arch/mips/mm/c-octeon.c +2
-3@@ -81,9 +81,9 @@ static void octeon_flush_icache_all_coreif (vma) mask = *mm_cpumask (vma->vm_mm);else - mask = cpu_online_map; -cpu_clear (cpu, mask); -for_each_cpu_mask (cpu, mask) + mask = *cpu_online_mask; +cpumask_clear (&mask, cpu);
This should be cpumask_clear_cpu(cpu, &mask);
arch/mips/mm/c-octeon.c static void octeon_flush_icache_all_core · line 89
Quoted 4 lines
arch/mips/mm/c-octeon.c +1
-0+for_each_cpu (cpu, &mask)octeon_send_ipi_single (cpu,SMP_ICACHE_FLUSH );preempt_enable ();
Regards,
Srivatsa S. Bhat
Quoted 9 lines · Srivatsa S. Bhat
arch/mips/kernel/smp.c void flush_tlb_mm(struct mm_struct *mm) · line 328
Quoted 7 lines
arch/mips/kernel/smp.c +3
-3-cpu_clear (smp_processor_id (), mask); -for_each_cpu_mask (cpu, mask) -if (cpu_context (cpu, mm)) +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id () &&cpu_context (cpu, mm))cpu_context (cpu, mm) =0 ; + }
Quoted 6 lines
Strictly speaking, this one is not a mere cleanup. It causes a subtle change in
behaviour: earlier, it used to iterate over a local copy ofcpu_online_mask, which wouldn't change. However, with this patch, it will iterate directly overcpu_online_mask, which can change underneath. (Thepreempt_disable()won't stop new CPUs from coming in.. it only prevents CPUs from going offline, that too provided that we usestop_machinestuff for CPU offline, which we do currently.)
There's a preempt_disable() around this whole function, so online_mask can't change.
Same with the others.
Quoted 5 lines
arch/mips/mm/c-octeon.c static void octeon_flush_icache_all_core · line 85
Quoted 2 lines
arch/mips/mm/c-octeon.c +2
-0+ mask = *cpu_online_mask; +cpumask_clear (&mask, cpu);This should be
cpumask_clear_cpu(cpu, &mask);
Good catch. I copied the bitmask ops, and continually regret it.
I've rolled all these together with your fixes, added your ia64 patch, and am rebasing to -next now, so I can hand this all across to akpm.
Thanks,
Rusty.