Commit 00bd8e91 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] make voyager work again after the cpumask_t changes

From: James Bottomley <James.Bottomley@SteelEye.com>

Most is just simple fixes; however, the needless change from atomic to
non-atomic operations in smp_invalidate_interrupt() caused me a lot of
pain to track down since it introduced some very subtle bugs.

I've also taken phys_cpu_present_map out of smp.h.  Since it
physid_mask_t is defined in mpspec.h anyway, and contains a duplicate
definition, I don't believe it can hurt anything.
parent 1097ca0a
...@@ -130,7 +130,7 @@ send_QIC_CPI(__u32 cpuset, __u8 cpi) ...@@ -130,7 +130,7 @@ send_QIC_CPI(__u32 cpuset, __u8 cpi)
{ {
int cpu; int cpu;
for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) { for_each_cpu(cpu, cpu_online_map) {
if(cpuset & (1<<cpu)) { if(cpuset & (1<<cpu)) {
#ifdef VOYAGER_DEBUG #ifdef VOYAGER_DEBUG
if(!cpu_isset(cpu, cpu_online_map)) if(!cpu_isset(cpu, cpu_online_map))
...@@ -874,10 +874,10 @@ leave_mm (unsigned long cpu) ...@@ -874,10 +874,10 @@ leave_mm (unsigned long cpu)
asmlinkage void asmlinkage void
smp_invalidate_interrupt(void) smp_invalidate_interrupt(void)
{ {
__u8 cpu = get_cpu(); __u8 cpu = smp_processor_id();
if (!(smp_invalidate_needed & (1UL << cpu))) if (!test_bit(cpu, &smp_invalidate_needed))
goto out; return;
/* This will flood messages. Don't uncomment unless you see /* This will flood messages. Don't uncomment unless you see
* Problems with cross cpu invalidation * Problems with cross cpu invalidation
VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n", VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n",
...@@ -893,9 +893,9 @@ smp_invalidate_interrupt(void) ...@@ -893,9 +893,9 @@ smp_invalidate_interrupt(void)
} else } else
leave_mm(cpu); leave_mm(cpu);
} }
smp_invalidate_needed |= 1UL << cpu; smp_mb__before_clear_bit();
out: clear_bit(cpu, &smp_invalidate_needed);
put_cpu_no_resched(); smp_mb__after_clear_bit();
} }
/* All the new flush operations for 2.4 */ /* All the new flush operations for 2.4 */
...@@ -929,6 +929,7 @@ flush_tlb_others (unsigned long cpumask, struct mm_struct *mm, ...@@ -929,6 +929,7 @@ flush_tlb_others (unsigned long cpumask, struct mm_struct *mm,
send_CPI(cpumask, VIC_INVALIDATE_CPI); send_CPI(cpumask, VIC_INVALIDATE_CPI);
while (smp_invalidate_needed) { while (smp_invalidate_needed) {
mb();
if(--stuck == 0) { if(--stuck == 0) {
printk("***WARNING*** Stuck doing invalidate CPI (CPU%d)\n", smp_processor_id()); printk("***WARNING*** Stuck doing invalidate CPI (CPU%d)\n", smp_processor_id());
break; break;
...@@ -1464,7 +1465,7 @@ send_CPI(__u32 cpuset, __u8 cpi) ...@@ -1464,7 +1465,7 @@ send_CPI(__u32 cpuset, __u8 cpi)
cpuset &= 0xff; /* only first 8 CPUs vaild for VIC CPI */ cpuset &= 0xff; /* only first 8 CPUs vaild for VIC CPI */
if(cpuset == 0) if(cpuset == 0)
return; return;
for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) { for_each_cpu(cpu, cpu_online_map) {
if(cpuset & (1<<cpu)) if(cpuset & (1<<cpu))
set_bit(cpi, &vic_cpi_mailbox[cpu]); set_bit(cpi, &vic_cpi_mailbox[cpu]);
} }
...@@ -1578,7 +1579,7 @@ enable_vic_irq(unsigned int irq) ...@@ -1578,7 +1579,7 @@ enable_vic_irq(unsigned int irq)
VDEBUG(("VOYAGER: enable_vic_irq(%d) CPU%d affinity 0x%lx\n", VDEBUG(("VOYAGER: enable_vic_irq(%d) CPU%d affinity 0x%lx\n",
irq, cpu, cpu_irq_affinity[cpu])); irq, cpu, cpu_irq_affinity[cpu]));
spin_lock_irqsave(&vic_irq_lock, flags); spin_lock_irqsave(&vic_irq_lock, flags);
for_each_cpu(real_cpu, mk_cpumask_const(cpu_online_map)) { for_each_cpu(real_cpu, cpu_online_map) {
if(!(voyager_extended_vic_processors & (1<<real_cpu))) if(!(voyager_extended_vic_processors & (1<<real_cpu)))
continue; continue;
if(!(cpu_irq_affinity[real_cpu] & mask)) { if(!(cpu_irq_affinity[real_cpu] & mask)) {
...@@ -1723,7 +1724,7 @@ after_handle_vic_irq(unsigned int irq) ...@@ -1723,7 +1724,7 @@ after_handle_vic_irq(unsigned int irq)
printk("VOYAGER SMP: CPU%d lost interrupt %d\n", printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
cpu, irq); cpu, irq);
for_each_cpu(real_cpu, mk_cpumask_const(mask)) { for_each_cpu(real_cpu, mask) {
outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
VIC_PROCESSOR_ID); VIC_PROCESSOR_ID);
...@@ -1808,7 +1809,7 @@ set_vic_irq_affinity(unsigned int irq, cpumask_t mask) ...@@ -1808,7 +1809,7 @@ set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
* bus) */ * bus) */
return; return;
for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) { for_each_cpu(cpu, cpu_online_map) {
unsigned long cpu_mask = 1 << cpu; unsigned long cpu_mask = 1 << cpu;
if(cpu_mask & real_mask) { if(cpu_mask & real_mask) {
...@@ -1874,7 +1875,7 @@ voyager_smp_dump() ...@@ -1874,7 +1875,7 @@ voyager_smp_dump()
int old_cpu = smp_processor_id(), cpu; int old_cpu = smp_processor_id(), cpu;
/* dump the interrupt masks of each processor */ /* dump the interrupt masks of each processor */
for_each_cpu(cpu, mk_cpumask_const(cpu_online_map)) { for_each_cpu(cpu, cpu_online_map) {
__u16 imr, isr, irr; __u16 imr, isr, irr;
unsigned long flags; unsigned long flags;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
*/ */
extern void smp_alloc_memory(void); extern void smp_alloc_memory(void);
extern physid_mask_t phys_cpu_present_map;
extern int pic_mode; extern int pic_mode;
extern int smp_num_siblings; extern int smp_num_siblings;
extern int cpu_sibling_map[]; extern int cpu_sibling_map[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment