Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc64: Fix reset hangs on Niagara systems.
  cpumask: use mm_cpumask() wrapper: sparc
  cpumask: remove dangerous CPU_MASK_ALL_PTR, &CPU_MASK_ALL.: sparc
  cpumask: remove the now-obsoleted pcibus_to_cpumask(): sparc
  cpumask: remove cpu_coregroup_map: sparc
  cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: sparc
  cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: sparc64
  cpumask: Use accessors code.: sparc64
  cpumask: Use accessors code: sparc
  cpumask: arch_send_call_function_ipi_mask: sparc
  cpumask: Use smp_call_function_many(): sparc64
This commit is contained in:
Linus Torvalds 2009-03-30 18:46:12 -07:00
commit d3d52d687a
15 changed files with 72 additions and 58 deletions

View file

@ -121,8 +121,8 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
* local TLB. * local TLB.
*/ */
cpu = smp_processor_id(); cpu = smp_processor_id();
if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) { if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) {
cpu_set(cpu, mm->cpu_vm_mask); cpumask_set_cpu(cpu, mm_cpumask(mm));
__flush_tlb_mm(CTX_HWBITS(mm->context), __flush_tlb_mm(CTX_HWBITS(mm->context),
SECONDARY_CONTEXT); SECONDARY_CONTEXT);
} }
@ -141,8 +141,8 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm
if (!CTX_VALID(mm->context)) if (!CTX_VALID(mm->context))
get_new_mmu_context(mm); get_new_mmu_context(mm);
cpu = smp_processor_id(); cpu = smp_processor_id();
if (!cpu_isset(cpu, mm->cpu_vm_mask)) if (!cpumask_test_cpu(cpu, mm_cpumask(mm)))
cpu_set(cpu, mm->cpu_vm_mask); cpumask_set_cpu(cpu, mm_cpumask(mm));
load_secondary_context(mm); load_secondary_context(mm);
__flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT); __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT);

View file

@ -35,7 +35,8 @@ extern cpumask_t cpu_core_map[NR_CPUS];
extern int sparc64_multi_core; extern int sparc64_multi_core;
extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi(cpumask_t mask); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
/* /*
* General functions that each host system must provide. * General functions that each host system must provide.

View file

@ -126,7 +126,7 @@ extern void flushw_all(void);
#define switch_to(prev, next, last) do { \ #define switch_to(prev, next, last) do { \
SWITCH_ENTER(prev); \ SWITCH_ENTER(prev); \
SWITCH_DO_LAZY_FPU(next); \ SWITCH_DO_LAZY_FPU(next); \
cpu_set(smp_processor_id(), next->active_mm->cpu_vm_mask); \ cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm)); \
__asm__ __volatile__( \ __asm__ __volatile__( \
"sethi %%hi(here - 0x8), %%o7\n\t" \ "sethi %%hi(here - 0x8), %%o7\n\t" \
"mov %%g6, %%g3\n\t" \ "mov %%g6, %%g3\n\t" \

View file

@ -38,13 +38,9 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
} }
#endif #endif
#define pcibus_to_cpumask(bus) \
(pcibus_to_node(bus) == -1 ? \
CPU_MASK_ALL : \
node_to_cpumask(pcibus_to_node(bus)))
#define cpumask_of_pcibus(bus) \ #define cpumask_of_pcibus(bus) \
(pcibus_to_node(bus) == -1 ? \ (pcibus_to_node(bus) == -1 ? \
CPU_MASK_ALL_PTR : \ cpu_all_mask : \
cpumask_of_node(pcibus_to_node(bus))) cpumask_of_node(pcibus_to_node(bus)))
#define SD_NODE_INIT (struct sched_domain) { \ #define SD_NODE_INIT (struct sched_domain) { \
@ -84,7 +80,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
#define smt_capable() (sparc64_multi_core) #define smt_capable() (sparc64_multi_core)
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
#define cpu_coregroup_mask(cpu) (&cpu_core_map[cpu]) #define cpu_coregroup_mask(cpu) (&cpu_core_map[cpu])
#endif /* _ASM_SPARC64_TOPOLOGY_H */ #endif /* _ASM_SPARC64_TOPOLOGY_H */

View file

@ -653,7 +653,7 @@ static void __cpuinit dr_cpu_data(struct ds_info *dp,
if (cpu_list[i] == CPU_SENTINEL) if (cpu_list[i] == CPU_SENTINEL)
continue; continue;
if (cpu_list[i] < NR_CPUS) if (cpu_list[i] < nr_cpu_ids)
cpu_set(cpu_list[i], mask); cpu_set(cpu_list[i], mask);
} }

View file

@ -266,12 +266,12 @@ static int irq_choose_cpu(unsigned int virt_irq)
spin_lock_irqsave(&irq_rover_lock, flags); spin_lock_irqsave(&irq_rover_lock, flags);
while (!cpu_online(irq_rover)) { while (!cpu_online(irq_rover)) {
if (++irq_rover >= NR_CPUS) if (++irq_rover >= nr_cpu_ids)
irq_rover = 0; irq_rover = 0;
} }
cpuid = irq_rover; cpuid = irq_rover;
do { do {
if (++irq_rover >= NR_CPUS) if (++irq_rover >= nr_cpu_ids)
irq_rover = 0; irq_rover = 0;
} while (!cpu_online(irq_rover)); } while (!cpu_online(irq_rover));

View file

@ -567,7 +567,7 @@ static void __init report_platform_properties(void)
max_cpu = NR_CPUS; max_cpu = NR_CPUS;
} }
for (i = 0; i < max_cpu; i++) for (i = 0; i < max_cpu; i++)
cpu_set(i, cpu_possible_map); set_cpu_possible(i, true);
} }
#endif #endif

View file

@ -13,6 +13,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/reboot.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -206,13 +207,33 @@ void nmi_adjust_hz(unsigned int new_hz)
} }
EXPORT_SYMBOL_GPL(nmi_adjust_hz); EXPORT_SYMBOL_GPL(nmi_adjust_hz);
static int nmi_shutdown(struct notifier_block *nb, unsigned long cmd, void *p)
{
on_each_cpu(stop_watchdog, NULL, 1);
return 0;
}
static struct notifier_block nmi_reboot_notifier = {
.notifier_call = nmi_shutdown,
};
int __init nmi_init(void) int __init nmi_init(void)
{ {
int err;
nmi_usable = 1; nmi_usable = 1;
on_each_cpu(start_watchdog, NULL, 1); on_each_cpu(start_watchdog, NULL, 1);
return check_nmi_watchdog(); err = check_nmi_watchdog();
if (!err) {
err = register_reboot_notifier(&nmi_reboot_notifier);
if (err) {
nmi_usable = 0;
on_each_cpu(stop_watchdog, NULL, 1);
}
}
return err;
} }
static int __init setup_nmi_watchdog(char *str) static int __init setup_nmi_watchdog(char *str)

View file

@ -518,8 +518,8 @@ void __init of_fill_in_cpu_data(void)
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
cpu_set(cpuid, cpu_present_map); set_cpu_present(cpuid, true);
cpu_set(cpuid, cpu_possible_map); set_cpu_possible(cpuid, true);
#endif #endif
} }

View file

@ -70,13 +70,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
extern void smp4m_smp_done(void); extern void smp4m_smp_done(void);
extern void smp4d_smp_done(void); extern void smp4d_smp_done(void);
unsigned long bogosum = 0; unsigned long bogosum = 0;
int cpu, num; int cpu, num = 0;
for (cpu = 0, num = 0; cpu < NR_CPUS; cpu++) for_each_online_cpu(cpu) {
if (cpu_online(cpu)) { num++;
num++; bogosum += cpu_data(cpu).udelay_val;
bogosum += cpu_data(cpu).udelay_val; }
}
printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n", printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
num, bogosum/(500000/HZ), num, bogosum/(500000/HZ),
@ -144,7 +143,7 @@ void smp_flush_tlb_all(void)
void smp_flush_cache_mm(struct mm_struct *mm) void smp_flush_cache_mm(struct mm_struct *mm)
{ {
if(mm->context != NO_CONTEXT) { if(mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm); xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm);
@ -155,12 +154,13 @@ void smp_flush_cache_mm(struct mm_struct *mm)
void smp_flush_tlb_mm(struct mm_struct *mm) void smp_flush_tlb_mm(struct mm_struct *mm)
{ {
if(mm->context != NO_CONTEXT) { if(mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) { if (!cpus_empty(cpu_mask)) {
xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm); xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm);
if(atomic_read(&mm->mm_users) == 1 && current->active_mm == mm) if(atomic_read(&mm->mm_users) == 1 && current->active_mm == mm)
mm->cpu_vm_mask = cpumask_of_cpu(smp_processor_id()); cpumask_copy(mm_cpumask(mm),
cpumask_of(smp_processor_id()));
} }
local_flush_tlb_mm(mm); local_flush_tlb_mm(mm);
} }
@ -172,7 +172,7 @@ void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if (mm->context != NO_CONTEXT) { if (mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end); xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end);
@ -186,7 +186,7 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if (mm->context != NO_CONTEXT) { if (mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end); xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end);
@ -199,7 +199,7 @@ void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if(mm->context != NO_CONTEXT) { if(mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page);
@ -212,7 +212,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
struct mm_struct *mm = vma->vm_mm; struct mm_struct *mm = vma->vm_mm;
if(mm->context != NO_CONTEXT) { if(mm->context != NO_CONTEXT) {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page);
@ -241,7 +241,7 @@ void smp_flush_page_to_ram(unsigned long page)
void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr) void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
{ {
cpumask_t cpu_mask = mm->cpu_vm_mask; cpumask_t cpu_mask = *mm_cpumask(mm);
cpu_clear(smp_processor_id(), cpu_mask); cpu_clear(smp_processor_id(), cpu_mask);
if (!cpus_empty(cpu_mask)) if (!cpus_empty(cpu_mask))
xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr); xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr);
@ -332,8 +332,8 @@ void __init smp_setup_cpu_possible_map(void)
instance = 0; instance = 0;
while (!cpu_find_by_instance(instance, NULL, &mid)) { while (!cpu_find_by_instance(instance, NULL, &mid)) {
if (mid < NR_CPUS) { if (mid < NR_CPUS) {
cpu_set(mid, cpu_possible_map); set_cpu_possible(mid, true);
cpu_set(mid, cpu_present_map); set_cpu_present(mid, true);
} }
instance++; instance++;
} }
@ -351,8 +351,8 @@ void __init smp_prepare_boot_cpu(void)
printk("boot cpu id != 0, this could work but is untested\n"); printk("boot cpu id != 0, this could work but is untested\n");
current_thread_info()->cpu = cpuid; current_thread_info()->cpu = cpuid;
cpu_set(cpuid, cpu_online_map); set_cpu_online(cpuid, true);
cpu_set(cpuid, cpu_possible_map); set_cpu_possible(cpuid, true);
} }
int __cpuinit __cpu_up(unsigned int cpu) int __cpuinit __cpu_up(unsigned int cpu)

View file

@ -808,9 +808,9 @@ static void smp_start_sync_tick_client(int cpu)
extern unsigned long xcall_call_function; extern unsigned long xcall_call_function;
void arch_send_call_function_ipi(cpumask_t mask) void arch_send_call_function_ipi_mask(const struct cpumask *mask)
{ {
xcall_deliver((u64) &xcall_call_function, 0, 0, &mask); xcall_deliver((u64) &xcall_call_function, 0, 0, mask);
} }
extern unsigned long xcall_call_function_single; extern unsigned long xcall_call_function_single;
@ -850,7 +850,7 @@ static void tsb_sync(void *info)
void smp_tsb_sync(struct mm_struct *mm) void smp_tsb_sync(struct mm_struct *mm)
{ {
smp_call_function_mask(mm->cpu_vm_mask, tsb_sync, mm, 1); smp_call_function_many(mm_cpumask(mm), tsb_sync, mm, 1);
} }
extern unsigned long xcall_flush_tlb_mm; extern unsigned long xcall_flush_tlb_mm;
@ -1055,13 +1055,13 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
int cpu = get_cpu(); int cpu = get_cpu();
if (atomic_read(&mm->mm_users) == 1) { if (atomic_read(&mm->mm_users) == 1) {
mm->cpu_vm_mask = cpumask_of_cpu(cpu); cpumask_copy(mm_cpumask(mm), cpumask_of(cpu));
goto local_flush_and_out; goto local_flush_and_out;
} }
smp_cross_call_masked(&xcall_flush_tlb_mm, smp_cross_call_masked(&xcall_flush_tlb_mm,
ctx, 0, 0, ctx, 0, 0,
&mm->cpu_vm_mask); mm_cpumask(mm));
local_flush_and_out: local_flush_and_out:
__flush_tlb_mm(ctx, SECONDARY_CONTEXT); __flush_tlb_mm(ctx, SECONDARY_CONTEXT);
@ -1075,11 +1075,11 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
int cpu = get_cpu(); int cpu = get_cpu();
if (mm == current->mm && atomic_read(&mm->mm_users) == 1) if (mm == current->mm && atomic_read(&mm->mm_users) == 1)
mm->cpu_vm_mask = cpumask_of_cpu(cpu); cpumask_copy(mm_cpumask(mm), cpumask_of(cpu));
else else
smp_cross_call_masked(&xcall_flush_tlb_pending, smp_cross_call_masked(&xcall_flush_tlb_pending,
ctx, nr, (unsigned long) vaddrs, ctx, nr, (unsigned long) vaddrs,
&mm->cpu_vm_mask); mm_cpumask(mm));
__flush_tlb_pending(ctx, nr, vaddrs); __flush_tlb_pending(ctx, nr, vaddrs);

View file

@ -150,7 +150,7 @@ void __cpuinit smp4d_callin(void)
spin_lock_irqsave(&sun4d_imsk_lock, flags); spin_lock_irqsave(&sun4d_imsk_lock, flags);
cc_set_imsk(cc_get_imsk() & ~0x4000); /* Allow PIL 14 as well */ cc_set_imsk(cc_get_imsk() & ~0x4000); /* Allow PIL 14 as well */
spin_unlock_irqrestore(&sun4d_imsk_lock, flags); spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
cpu_set(cpuid, cpu_online_map); set_cpu_online(cpuid, true);
} }
@ -228,11 +228,10 @@ void __init smp4d_smp_done(void)
/* setup cpu list for irq rotation */ /* setup cpu list for irq rotation */
first = 0; first = 0;
prev = &first; prev = &first;
for (i = 0; i < NR_CPUS; i++) for_each_online_cpu(i) {
if (cpu_online(i)) { *prev = i;
*prev = i; prev = &cpu_data(i).next;
prev = &cpu_data(i).next; }
}
*prev = first; *prev = first;
local_flush_cache_all(); local_flush_cache_all();

View file

@ -113,7 +113,7 @@ void __cpuinit smp4m_callin(void)
local_irq_enable(); local_irq_enable();
cpu_set(cpuid, cpu_online_map); set_cpu_online(cpuid, true);
} }
/* /*
@ -186,11 +186,9 @@ void __init smp4m_smp_done(void)
/* setup cpu list for irq rotation */ /* setup cpu list for irq rotation */
first = 0; first = 0;
prev = &first; prev = &first;
for (i = 0; i < NR_CPUS; i++) { for_each_online_cpu(i) {
if (cpu_online(i)) { *prev = i;
*prev = i; prev = &cpu_data(i).next;
prev = &cpu_data(i).next;
}
} }
*prev = first; *prev = first;
local_flush_cache_all(); local_flush_cache_all();

View file

@ -1092,7 +1092,7 @@ static void __init numa_parse_mdesc_group_cpus(struct mdesc_handle *md,
if (strcmp(name, "cpu")) if (strcmp(name, "cpu"))
continue; continue;
id = mdesc_get_property(md, target, "id", NULL); id = mdesc_get_property(md, target, "id", NULL);
if (*id < NR_CPUS) if (*id < nr_cpu_ids)
cpu_set(*id, *mask); cpu_set(*id, *mask);
} }
} }

View file

@ -1425,7 +1425,7 @@ static void __init init_vac_layout(void)
min_line_size = vac_line_size; min_line_size = vac_line_size;
//FIXME: cpus not contiguous!! //FIXME: cpus not contiguous!!
cpu++; cpu++;
if (cpu >= NR_CPUS || !cpu_online(cpu)) if (cpu >= nr_cpu_ids || !cpu_online(cpu))
break; break;
#else #else
break; break;