Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mpic: Fix problem that affinity is not updated

Since commit 57b150cce8e004ddd36330490a68bfb59b7271e9, desc->affinity
of an irq is changed after calling desc->chip->set_affinity.
Therefore we need to fix the irq_choose_cpu() not to depend on the
desc->affinity for new mask.

Signed-off-by: Jiajun Wu <b06378@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Yang Li and committed by
Benjamin Herrenschmidt
38e1313f a1128f8f

+6 -13
+6 -13
arch/powerpc/sysdev/mpic.c
··· 567 567 #endif /* CONFIG_MPIC_U3_HT_IRQS */ 568 568 569 569 #ifdef CONFIG_SMP 570 - static int irq_choose_cpu(unsigned int virt_irq) 570 + static int irq_choose_cpu(const cpumask_t *mask) 571 571 { 572 - cpumask_t mask; 573 572 int cpuid; 574 573 575 - cpumask_copy(&mask, irq_to_desc(virt_irq)->affinity); 576 - if (cpus_equal(mask, CPU_MASK_ALL)) { 574 + if (cpumask_equal(mask, cpu_all_mask)) { 577 575 static int irq_rover; 578 576 static DEFINE_SPINLOCK(irq_rover_lock); 579 577 unsigned long flags; ··· 592 594 593 595 spin_unlock_irqrestore(&irq_rover_lock, flags); 594 596 } else { 595 - cpumask_t tmp; 596 - 597 - cpus_and(tmp, cpu_online_map, mask); 598 - 599 - if (cpus_empty(tmp)) 597 + cpuid = cpumask_first_and(mask, cpu_online_mask); 598 + if (cpuid >= nr_cpu_ids) 600 599 goto do_round_robin; 601 - 602 - cpuid = first_cpu(tmp); 603 600 } 604 601 605 602 return get_hard_smp_processor_id(cpuid); 606 603 } 607 604 #else 608 - static int irq_choose_cpu(unsigned int virt_irq) 605 + static int irq_choose_cpu(const cpumask_t *mask) 609 606 { 610 607 return hard_smp_processor_id(); 611 608 } ··· 809 816 unsigned int src = mpic_irq_to_hw(irq); 810 817 811 818 if (mpic->flags & MPIC_SINGLE_DEST_CPU) { 812 - int cpuid = irq_choose_cpu(irq); 819 + int cpuid = irq_choose_cpu(cpumask); 813 820 814 821 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 815 822 } else {