From 937e26c0d1843c92750dac9bca1c972d33e73306 Mon Sep 17 00:00:00 2001 From: KOSAKI Motohiro Date: Thu, 26 May 2011 16:24:59 -0700 Subject: m32r: convert cpumask api We plan to remove cpus_xx() old cpumask APIs later. Also, we plan to change mm_cpu_mask() implementation, allocate only nr_cpu_ids, thus *mm_cpu_mask() is dangerous operation. Then, this patch convert them. Signed-off-by: KOSAKI Motohiro Cc: Hirokazu Takata Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/m32r/kernel/smp.c | 51 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'arch/m32r/kernel/smp.c') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index fc10b39893d4..f758100b8976 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -87,7 +87,6 @@ void smp_local_timer_interrupt(void); static void send_IPI_allbutself(int, int); static void send_IPI_mask(const struct cpumask *, int, int); -unsigned long send_IPI_mask_phys(cpumask_t, int, int); /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ /* Rescheduling request Routines */ @@ -162,10 +161,10 @@ void smp_flush_cache_all(void) unsigned long *mask; preempt_disable(); - cpumask = cpu_online_map; - cpu_clear(smp_processor_id(), cpumask); + cpumask_copy(&cpumask, cpu_online_mask); + cpumask_clear_cpu(smp_processor_id(), &cpumask); spin_lock(&flushcache_lock); - mask=cpus_addr(cpumask); + mask=cpumask_bits(&cpumask); atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0); _flush_cache_copyback_all(); @@ -263,8 +262,8 @@ void smp_flush_tlb_mm(struct mm_struct *mm) preempt_disable(); cpu_id = smp_processor_id(); mmc = &mm->context[cpu_id]; - cpu_mask = *mm_cpumask(mm); - cpu_clear(cpu_id, cpu_mask); + cpumask_copy(&cpu_mask, mm_cpumask(mm)); + cpumask_clear_cpu(cpu_id, &cpu_mask); if (*mmc != NO_CONTEXT) { local_irq_save(flags); @@ -275,7 +274,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm) cpumask_clear_cpu(cpu_id, mm_cpumask(mm)); local_irq_restore(flags); } - if (!cpus_empty(cpu_mask)) + if (!cpumask_empty(&cpu_mask)) flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); preempt_enable(); @@ -333,8 +332,8 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) preempt_disable(); cpu_id = smp_processor_id(); mmc = &mm->context[cpu_id]; - cpu_mask = *mm_cpumask(mm); - cpu_clear(cpu_id, cpu_mask); + cpumask_copy(&cpu_mask, mm_cpumask(mm)); + cpumask_clear_cpu(cpu_id, &cpu_mask); #ifdef DEBUG_SMP if (!mm) @@ -348,7 +347,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) __flush_tlb_page(va); local_irq_restore(flags); } - if (!cpus_empty(cpu_mask)) + if (!cpumask_empty(&cpu_mask)) flush_tlb_others(cpu_mask, mm, vma, va); preempt_enable(); @@ -395,14 +394,14 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, * - current CPU must not be in mask * - mask must exist :) */ - BUG_ON(cpus_empty(cpumask)); + BUG_ON(cpumask_empty(&cpumask)); - BUG_ON(cpu_isset(smp_processor_id(), cpumask)); + BUG_ON(cpumask_test_cpu(smp_processor_id(), &cpumask)); BUG_ON(!mm); /* If a CPU which we ran on has gone down, OK. */ - cpus_and(cpumask, cpumask, cpu_online_map); - if (cpus_empty(cpumask)) + cpumask_and(&cpumask, &cpumask, cpu_online_mask); + if (cpumask_empty(&cpumask)) return; /* @@ -416,7 +415,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, flush_mm = mm; flush_vma = vma; flush_va = va; - mask=cpus_addr(cpumask); + mask=cpumask_bits(&cpumask); atomic_set_mask(*mask, (atomic_t *)&flush_cpumask); /* @@ -425,7 +424,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, */ send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0); - while (!cpus_empty(flush_cpumask)) { + while (!cpumask_empty((cpumask_t*)&flush_cpumask)) { /* nothing. lockup detection does not belong here */ mb(); } @@ -460,7 +459,7 @@ void smp_invalidate_interrupt(void) int cpu_id = smp_processor_id(); unsigned long *mmc = &flush_mm->context[cpu_id]; - if (!cpu_isset(cpu_id, flush_cpumask)) + if (!cpumask_test_cpu(cpu_id, &flush_cpumask)) return; if (flush_va == FLUSH_ALL) { @@ -478,7 +477,7 @@ void smp_invalidate_interrupt(void) __flush_tlb_page(va); } } - cpu_clear(cpu_id, flush_cpumask); + cpumask_clear_cpu(cpu_id, (cpumask_t*)&flush_cpumask); } /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ @@ -530,7 +529,7 @@ static void stop_this_cpu(void *dummy) /* * Remove this CPU: */ - cpu_clear(cpu_id, cpu_online_map); + set_cpu_online(cpu_id, false); /* * PSW IE = 1; @@ -725,8 +724,8 @@ static void send_IPI_allbutself(int ipi_num, int try) { cpumask_t cpumask; - cpumask = cpu_online_map; - cpu_clear(smp_processor_id(), cpumask); + cpumask_copy(&cpumask, cpu_online_mask); + cpumask_clear_cpu(smp_processor_id(), &cpumask); send_IPI_mask(&cpumask, ipi_num, try); } @@ -763,13 +762,13 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try) cpumask_and(&tmp, cpumask, cpu_online_mask); BUG_ON(!cpumask_equal(cpumask, &tmp)); - physid_mask = CPU_MASK_NONE; + cpumask_clear(&physid_mask); for_each_cpu(cpu_id, cpumask) { if ((phys_id = cpu_to_physid(cpu_id)) != -1) - cpu_set(phys_id, physid_mask); + cpumask_set_cpu(phys_id, &physid_mask); } - send_IPI_mask_phys(physid_mask, ipi_num, try); + send_IPI_mask_phys(&physid_mask, ipi_num, try); } /*==========================================================================* @@ -792,14 +791,14 @@ static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try) * ---------- --- -------------------------------------------------------- * *==========================================================================*/ -unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num, +unsigned long send_IPI_mask_phys(const cpumask_t *physid_mask, int ipi_num, int try) { spinlock_t *ipilock; volatile unsigned long *ipicr_addr; unsigned long ipicr_val; unsigned long my_physid_mask; - unsigned long mask = cpus_addr(physid_mask)[0]; + unsigned long mask = cpumask_bits(physid_mask)[0]; if (mask & ~physids_coerce(phys_cpu_present_map)) -- cgit