x86/irq: remove NUMA_MIGRATIE_IRQ_DESC
Subsystems (15)
PATCH 1/8 x86/irq: remove NUMA_MIGRATIE_IRQ_DESC
Impact: it is not ready yet.remove it
it causes crash on system with lots of cards with MSI-X when irq_balancer enabled...
will have one new patch that create irq_desc according to device numa node.
--- arch/x86/Kconfig | 9 -- arch/x86/configs/x86_64_defconfig | 1 arch/x86/kernel/apic/io_apic.c | 155 -------------------------------------- include/linux/irq.h | 12 -- kernel/irq/Makefile | 1 kernel/irq/chip.c | 12 -- kernel/irq/handle.c | 9 -- kernel/irq/numa_migrate.c | 133 -------------------------------- 8 files changed, 6 insertions(+), 326 deletions(-)
arch/x86/Kconfig +0 -9
@@ -275,15 +275,6 @@ config SPARSE_IRQ If you don't know what to do here, say N. -config NUMA_MIGRATE_IRQ_DESC - bool "Move irq desc when changing irq smp_affinity" - depends on SPARSE_IRQ && NUMA - default n - ---help--- - This enables moving irq_desc to cpu/node that irq will use handled. - - If you don't know what to do here, say N. - config X86_MPPARSE bool "Enable MPS table" if ACPI default y
arch/x86/configs/x86_64_defconfig +0 -1
@@ -195,7 +195,6 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_SPARSE_IRQ=y -# CONFIG_NUMA_MIGRATE_IRQ_DESC is not set CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y # CONFIG_X86_ELAN is not set
arch/x86/kernel/apic/io_apic.c +2 -153
197 lines not on this page · raw message
include/linux/irq.h +0 -12
@@ -206,22 +206,10 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu);#endif /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); -static inline struct irq_desc * -irq_remap_to_desc (unsigned int irq,struct irq_desc *desc) -{ -#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC -return irq_to_desc (irq); -#else -return desc; -#endif -} -/* * Migration helpers for obsolete names, they will go away: */
kernel/irq/Makefile +0 -1
@@ -3,5 +3,4 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_NUMA_MIGRATE_IRQ_DESC) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
kernel/irq/chip.c +2 -10
@@ -359,7 +359,6 @@ handle_level_irq(unsigned int irq, strucspin_lock (&desc->lock);mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc);if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock;
@@ -438,7 +437,6 @@ handle_fasteoi_irq(unsigned int irq, str desc->status &= ~IRQ_INPROGRESS ; out: desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc);spin_unlock (&desc->lock); }
@@ -475,7 +473,6 @@ handle_edge_irq(unsigned int irq, struct !desc->action)) { desc->status |= (IRQ_PENDING |IRQ_MASKED );mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); goto out_unlock; }kstat_incr_irqs_this_cpu (irq, desc);
@@ -483,7 +480,6 @@ handle_edge_irq(unsigned int irq, struct/* Start handling the irq */ if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc);/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -544,10 +540,8 @@ handle_percpu_irq(unsigned int irq, struif (!noirqdebug)note_interrupt (irq, desc, action_ret); -if (desc->chip->eoi) { +if (desc->chip->eoi) desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc); - } }void
@@ -582,10 +576,8 @@ __set_irq_handler(unsigned int irq, irq_/* Uninstall? */ if (handle == handle_bad_irq) { -if (desc->chip != &no_irq_chip) { +if (desc->chip != &no_irq_chip)mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); - } desc->status |=IRQ_DISABLED ; desc->depth =1 ; }
kernel/irq/handle.c +2 -7
@@ -454,11 +454,8 @@ unsigned int __do_IRQ(unsigned int irq)/* * No locking required for CPU-local interrupts: */ -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); -/* get new one */ - desc =irq_remap_to_desc (irq, desc); - }if (likely (!(desc->status &IRQ_DISABLED ))) { action_ret =handle_IRQ_event (irq, desc->action);if (!noirqdebug)
@@ -469,10 +466,8 @@ unsigned int __do_IRQ(unsigned int irq) }spin_lock (&desc->lock); -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc); - }/* * REPLAY is when Linux resends an IRQ that was dropped earlier * WAITING is used by probe to mark irqs that are being tested
kernel/irq/numa_migrate.c deleted +0 -133
133 lines not on this page · raw message
PATCH 2/8 irq: correct CPUMASKS_OFFSTACK typo -v3
Impact: fix smp_affinity copying when moving irq_desc
CPUMASKS_OFFSTACK is not defined anywhere. it is a typo
and init_allocate_desc_masks called before it set affinity to all cpus...
split init_alloc_desc_masks() into all_desc_masks() and init_desc_masks() so in the init_copy_desc_masks could use CPUMASK_OFFSTACK there. aka copy path will not calling init_desc_masks anymore.
also could use that CPUMASK_OFFSTACK in alloc_desc_masks()
v3: update after "remove numa_migrate irq_desc"
--- include/linux/irq.h | 27 ++++++++++++++++++--------- kernel/irq/handle.c | 9 ++++++--- 2 files changed, 24 insertions(+), 12 deletions(-)
include/linux/irq.h +18 -9
@@ -414,27 +414,25 @@ extern int set_irq_msi(unsigned int irq,#ifdef CONFIG_SMP /** -* init_alloc_desc_masks - allocate cpumasks for irq_desc +* alloc_desc_masks - allocate cpumasks for irq_desc * @desc: pointer to irq_desc struct * @cpu: cpu which will be handling the cpumasks * @boot: true if need bootmem * * Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). -* Side effect: affinity has all bits set, pending_mask has all bits clear. */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) { +#ifdef CONFIG_CPUMASK_OFFSTACK int node;if (boot) {alloc_bootmem_cpumask_var (&desc->affinity); -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ alloc_bootmem_cpumask_var (&desc->pending_mask); -cpumask_clear (desc->pending_mask);#endif return true; }
@@ -443,18 +441,25 @@ static inline bool init_alloc_desc_masksif (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false; -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ if (!alloc_cpumask_var_node (&desc->pending_mask,GFP_ATOMIC , node)) {free_cpumask_var (desc->affinity);return false; } -cpumask_clear (desc->pending_mask); +#endif #endif return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +cpumask_setall (desc->affinity); +#ifdef CONFIG_GENERIC_PENDING_IRQ +cpumask_clear (desc->pending_mask); +#endif +} +/** * init_copy_desc_masks - copy cpumasks for irq_desc * @old_desc: pointer to old irq_desc struct
@@ -468,7 +473,7 @@ static inline bool init_alloc_desc_masksstatic inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) { -#ifdef CONFIG_CPUMASKS_OFFSTACK +#ifdef CONFIG_CPUMASK_OFFSTACK cpumask_copy (new_desc->affinity, old_desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ
@@ -489,12 +494,16 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) {return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +} +static inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) {
kernel/irq/handle.c +6 -3
@@ -117,10 +117,11 @@ static void init_one_irq_desc(int irq, sprintk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); } +init_desc_masks (desc);arch_init_chip_data (desc, cpu); }
@@ -171,7 +172,8 @@ int __init early_irq_init(void) desc[i].irq = i; desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;lockdep_set_class (&desc[i].lock, &irq_desc_lock_class); -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); irq_desc_ptrs[i] = desc + i; }
@@ -258,7 +260,8 @@ int __init early_irq_init(void)for (i =0 ; i < count; i++) { desc[i].irq = i; -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); desc[i].kstat_irqs = kstat_irqs_all[i]; }return arch_early_irq_init ();
PATCH 3/8 irq: make set_affinity to return status -v2
In reply to Yinghai LuImpact: prepare to use it to keep affinity consistent
according to Ingo, change set_affinity() in irq_chip to return int.
v2: fix two typo
--- arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++- arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
arch/alpha/kernel/sys_dp264.c +6 -2
@@ -176,22 +176,26 @@ cpu_set_irq_affinity(unsigned int irq, c } } -static void +static int dp264_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq, *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; } -static void +static int clipper_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq -16 , *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; }static struct hw_interrupt_type dp264_irq_type = {
arch/alpha/kernel/sys_titan.c +3 -1
@@ -157,13 +157,15 @@ titan_cpu_set_irq_affinity(unsigned int } -static void +static int titan_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&titan_irq_lock);titan_cpu_set_irq_affinity (irq -16 , *affinity);titan_update_irq_hw (titan_cached_irq_mask);spin_unlock (&titan_irq_lock); + +return 0 ; } static void
arch/arm/common/gic.c +3 -1
@@ -109,7 +109,7 @@ static void gic_unmask_irq(unsigned int }#ifdef CONFIG_SMP -static void gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) +static int gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) {void __iomem *reg =gic_dist_base (irq) +GIC_DIST_TARGET + (gic_irq (irq) & ~3 );unsigned int shift = (irq %4 ) *8 ;
@@ -122,6 +122,8 @@ static void gic_set_cpu(unsigned int irq val |=1 << (cpu + shift);writel (val, reg);spin_unlock (&irq_controller_lock); + + return 0; }#endif
arch/cris/arch-v32/kernel/irq.c +3 -1
@@ -325,12 +325,14 @@ static void end_crisv32_irq(unsigned int { } -void set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) +int set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) {unsigned long flags;spin_lock_irqsave (&irq_lock, flags); irq_allocations[irq -FIRST_IRQ ].mask = *dest;spin_unlock_irqrestore (&irq_lock, flags); + +return 0 ; }static struct irq_chip crisv32_irq_type = {
arch/ia64/hp/sim/hpsim_irq.c +2 -1
@@ -21,9 +21,10 @@ hpsim_irq_noop (unsigned int irq) { } -static void +static int hpsim_set_affinity_noop (unsigned int a,const struct cpumask *b) { +return 0 ; }static struct hw_interrupt_type irq_type_hp_sim = {
arch/ia64/kernel/iosapic.c +6 -4
@@ -329,7 +329,7 @@ unmask_irq (unsigned int irq) } -static void +static int iosapic_set_affinity (unsigned int irq,const struct cpumask *mask) {#ifdef CONFIG_SMP
@@ -343,15 +343,15 @@ iosapic_set_affinity(unsigned int irq, c cpu =cpumask_first_and (cpu_online_mask, mask);if (cpu >= nr_cpu_ids) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ; dest =cpu_physical_id (cpu);if (!iosapic_intr_info[irq].count) -return ;/* not an IOSAPIC interrupt */ +return -1 ;/* not an IOSAPIC interrupt */ set_irq_affinity_info (irq, dest, redir);
@@ -376,7 +376,9 @@ iosapic_set_affinity(unsigned int irq, ciosapic_write (iosapic,IOSAPIC_RTE_HIGH (rte_index), high32); iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32); } +#endif +return 0 ; }/*
arch/ia64/kernel/msi_ia64.c +10 -6
@@ -12,7 +12,7 @@static struct irq_chip ia64_msi_chip;#ifdef CONFIG_SMP -static void ia64_set_msi_irq_affinity (unsigned int irq, +static int ia64_set_msi_irq_affinity (unsigned int irq,const cpumask_t *cpu_mask) {struct msi_msg msg;
@@ -20,10 +20,10 @@ static void ia64_set_msi_irq_affinity(unint cpu =first_cpu (*cpu_mask);if (!cpu_online (cpu)) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ;read_msi_msg (irq, &msg);
@@ -39,6 +39,8 @@ static void ia64_set_msi_irq_affinity(unwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity,cpumask_of (cpu)); + + return 0; }#endif /* CONFIG_SMP */
@@ -130,17 +132,17 @@ void arch_teardown_msi_irq(unsigned int #ifdef CONFIG_DMAR #ifdef CONFIG_SMP -static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) +static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) { struct irq_cfg *cfg = irq_cfg + irq; struct msi_msg msg; int cpu = cpumask_first(mask); if (!cpu_online(cpu)) - return; + return -1; if (irq_prepare_move(irq, cpu)) - return; + return -1; dmar_msi_read(irq, &msg);
@@ -151,6 +153,8 @@ static void dmar_msi_set_affinity(unsigndmar_msi_write (irq, &msg);cpumask_copy (irq_desc[irq].affinity, mask); + + return 0; }#endif /* CONFIG_SMP */
arch/ia64/sn/kernel/irq.c +3 -1
@@ -227,7 +227,7 @@ finish_up:return new_irq_info; } -static void sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) +static int sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) {struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;nasid_t nasid;
@@ -239,6 +239,8 @@ static void sn_set_affinity_irq(unsignedlist_for_each_entry_safe (sn_irq_info, sn_irq_info_safe, sn_irq_lh[irq], list) (void )sn_retarget_vector (sn_irq_info, nasid, slice); + +return 0 ; }#ifdef CONFIG_SMP
arch/ia64/sn/kernel/msi_sn.c +5 -3
@@ -151,7 +151,7 @@ int sn_setup_msi_irq(struct pci_dev *pde }#ifdef CONFIG_SMP -static void sn_set_msi_irq_affinity (unsigned int irq, +static int sn_set_msi_irq_affinity (unsigned int irq,const struct cpumask *cpu_mask) {struct msi_msg msg;
@@ -168,7 +168,7 @@ static void sn_set_msi_irq_affinity(unsi cpu =cpumask_first (cpu_mask); sn_irq_info = sn_msi_info[irq].sn_irq_info;if (sn_irq_info ==NULL || sn_irq_info->irq_int_bit >=0 ) -return ; +return -1 ;/* * Release XIO resources for the old MSI PCI address
@@ -189,7 +189,7 @@ static void sn_set_msi_irq_affinity(unsi new_irq_info =sn_retarget_vector (sn_irq_info, nasid, slice); sn_msi_info[irq].sn_irq_info = new_irq_info;if (new_irq_info ==NULL ) -return ; +return -1 ;/* * Map the xio address into bus space
@@ -206,6 +206,8 @@ static void sn_set_msi_irq_affinity(unsiwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity, cpu_mask); + + return 0; }#endif /* CONFIG_SMP */
arch/mips/cavium-octeon/octeon-irq.c +6 -2
@@ -177,7 +177,7 @@ static void octeon_irq_ciu0_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WORKQ0 ;/* Bit 0-63 of EN0 */
@@ -199,6 +199,8 @@ static void octeon_irq_ciu0_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN0 (cvmx_get_core_num () *2 ));write_unlock (&octeon_irq_ciu0_rwlock); + + return 0; }#endif
@@ -292,7 +294,7 @@ static void octeon_irq_ciu1_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WDOG0 ;/* Bit 0-63 of EN1 */
@@ -315,6 +317,8 @@ static void octeon_irq_ciu1_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN1 (cvmx_get_core_num () *2 +1 ));write_unlock (&octeon_irq_ciu1_rwlock); + + return 0; }#endif
arch/mips/kernel/irq-gic.c +3 -2
@@ -155,7 +155,7 @@ static void gic_unmask_irq(unsigned intstatic DEFINE_SPINLOCK (gic_lock); -static void gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +static int gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {cpumask_t tmp =CPU_MASK_NONE ;unsigned long flags;
@@ -166,7 +166,7 @@ static void gic_set_affinity(unsigned incpumask_and (&tmp, cpumask, cpu_online_mask);if (cpus_empty (tmp)) -return ; +return -1 ;/* Assumption : cpumask refers to a single CPU */ spin_lock_irqsave (&gic_lock, flags);
@@ -190,6 +190,7 @@ static void gic_set_affinity(unsigned incpumask_copy (irq_desc[irq].affinity, cpumask);spin_unlock_irqrestore (&gic_lock, flags); + return 0; }#endif
arch/mips/sibyte/bcm1480/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsignedstatic void disable_bcm1480_irq (unsigned int irq);static void ack_bcm1480_irq (unsigned int irq);#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask); +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_PCI
@@ -109,7 +109,7 @@ void bcm1480_unmask_irq(int cpu, int irq }#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on, k;u64 cur_ints;
@@ -119,7 +119,7 @@ static void bcm1480_set_affinity(unsigneif (cpumask_weight (mask) !=1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; } i =cpumask_first (mask);
@@ -155,6 +155,8 @@ static void bcm1480_set_affinity(unsigne }spin_unlock (&bcm1480_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/mips/sibyte/sb1250/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_sb1250_irq(unsigned istatic void disable_sb1250_irq (unsigned int irq);static void ack_sb1250_irq (unsigned int irq);#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask); +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_SIBYTE_HAS_LDT
@@ -103,7 +103,7 @@ void sb1250_unmask_irq(int cpu, int irq) }#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on;u64 cur_ints;
@@ -114,7 +114,7 @@ static void sb1250_set_affinity(unsignedif (cpumask_weight (mask) >1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; }/* Convert logical CPU to physical CPU */
@@ -146,6 +146,8 @@ static void sb1250_set_affinity(unsigned }spin_unlock (&sb1250_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/parisc/kernel/irq.c +4 -2
@@ -130,15 +130,17 @@ int cpu_check_affinity(unsigned int irq, return cpu_dest; } -static void cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) +static int cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {int cpu_dest; cpu_dest =cpu_check_affinity (irq, dest);if (cpu_dest <0 ) -return ; +return -1 ;cpumask_copy (&irq_desc[irq].affinity, dest); + +return 0 ; }#endif
arch/powerpc/platforms/pseries/xics.c +7 -5
@@ -333,7 +333,7 @@ static void xics_eoi_lpar(unsigned int vlpar_xirr_info_set ((0xff <<24 ) | irq); } -static void xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) +static int xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) {unsigned int irq;int status;
@@ -342,14 +342,14 @@ static void xics_set_affinity(unsigned i irq = (unsigned int )irq_map[virq].hwirq;if (irq ==XICS_IPI || irq ==XICS_IRQ_SPURIOUS ) -return ; +return -1 ; status =rtas_call (ibm_get_xive,1 ,3 , xics_status, irq);if (status) {printk (KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; }/*
@@ -363,7 +363,7 @@ static void xics_set_affinity(unsigned iprintk (KERN_WARNING "%s: No online cpus in the mask %s for irq %d\n" , __func__, cpulist, virq); -return ; +return -1 ; } status = rtas_call(ibm_set_xive, 3, 1, NULL,
@@ -372,8 +372,10 @@ static void xics_set_affinity(unsigned iif (status) {printk (KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; } + +return 0 ; }static struct irq_chip xics_pic_direct = {
arch/powerpc/sysdev/mpic.c +3 -1
@@ -807,7 +807,7 @@ static void mpic_end_ipi(unsigned int ir#endif /* CONFIG_SMP */ -void mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +int mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {struct mpic *mpic =mpic_from_irq (irq);unsigned int src =mpic_irq_to_hw (irq);
@@ -824,6 +824,8 @@ void mpic_set_affinity(unsigned int irq,mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ),mpic_physmask (cpus_addr (tmp)[0 ])); } + +return 0 ; }static unsigned int mpic_type_to_vecpri (struct mpic *mpic,unsigned int type)
arch/sparc/kernel/irq_64.c +9 -3
@@ -318,10 +318,12 @@ static void sun4u_irq_enable(unsigned in } } -static void sun4u_set_affinity (unsigned int virt_irq, +static int sun4u_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {sun4u_irq_enable (virt_irq); + +return 0 ; }/* Don't do anything. The desc->status check for IRQ_DISABLED in
@@ -377,7 +379,7 @@ static void sun4v_irq_enable(unsigned in ino, err); } -static void sun4v_set_affinity (unsigned int virt_irq, +static int sun4v_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned int ino = virt_irq_table[virt_irq].dev_ino;
@@ -388,6 +390,8 @@ static void sun4v_set_affinity(unsignedif (err !=HV_EOK )printk (KERN_ERR "sun4v_intr_settarget(%x,%lu): " "err(%d)\n" , ino, cpuid, err); + +return 0 ; }static void sun4v_irq_disable (unsigned int virt_irq)
@@ -445,7 +449,7 @@ static void sun4v_virq_enable(unsigned i dev_handle, dev_ino, err); } -static void sun4v_virt_set_affinity (unsigned int virt_irq, +static int sun4v_virt_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned long cpuid, dev_handle, dev_ino;
@@ -461,6 +465,8 @@ static void sun4v_virt_set_affinity(unsiprintk (KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " "err(%d)\n" , dev_handle, dev_ino, cpuid, err); + +return 0 ; }static void sun4v_virq_disable (unsigned int virt_irq)
arch/x86/kernel/apic/io_apic.c +41 -23
225 lines not on this page · raw message
drivers/parisc/iosapic.c +4 -2
@@ -702,7 +702,7 @@ static unsigned int iosapic_startup_irq( }#ifdef CONFIG_SMP -static void iosapic_set_affinity_irq (unsigned int irq, +static int iosapic_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {struct vector_info *vi =iosapic_get_vector (irq);
@@ -712,7 +712,7 @@ static void iosapic_set_affinity_irq(uns dest_cpu =cpu_check_affinity (irq, dest);if (dest_cpu <0 ) -return ; +return -1 ;cpumask_copy (irq_desc[irq].affinity,cpumask_of (dest_cpu)); vi->txn_addr =txn_affinity_addr (irq, dest_cpu);
@@ -724,6 +724,8 @@ static void iosapic_set_affinity_irq(unsiosapic_set_irt_data (vi, &dummy_d0, &d1);iosapic_wr_irt_entry (vi, d0, d1);spin_unlock_irqrestore (&iosapic_lock, flags); + + return 0; }#endif
drivers/xen/events.c +7 -5
@@ -694,13 +694,13 @@ void rebind_evtchn_irq(int evtchn, int i }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -static void rebind_irq_to_cpu (unsigned irq,unsigned tcpu) +static int rebind_irq_to_cpu (unsigned irq,unsigned tcpu) {struct evtchn_bind_vcpu bind_vcpu;int evtchn =evtchn_from_irq (irq);if (!VALID_EVTCHN (evtchn)) -return ; +return -1 ;/* Send future instances of this interrupt to other vcpu. */ bind_vcpu.port = evtchn;
@@ -713,13 +713,15 @@ static void rebind_irq_to_cpu(unsigned i*/ if (HYPERVISOR_event_channel_op (EVTCHNOP_bind_vcpu, &bind_vcpu) >=0 )bind_evtchn_to_cpu (evtchn, tcpu); -} +return 0 ; +} -static void set_affinity_irq (unsigned irq,const struct cpumask *dest) +static int set_affinity_irq (unsigned irq,const struct cpumask *dest) {unsigned tcpu =cpumask_first (dest); -rebind_irq_to_cpu (irq, tcpu); + +return rebind_irq_to_cpu (irq, tcpu); }int resend_irq_on_evtchn (unsigned int irq)
include/linux/irq.h +1 -1
@@ -117,7 +117,7 @@ struct irq_chip {void (*eoi)(unsigned int irq);void (*end)(unsigned int irq); -void (*set_affinity)(unsigned int irq, +int (*set_affinity)(unsigned int irq,const struct cpumask *dest);int (*retrigger)(unsigned int irq);int (*set_type)(unsigned int irq,unsigned int flow_type);
arch/mips/include/asm/irq.h +1 -1
@@ -49,7 +49,7 @@ static inline void smtc_im_ack_irq(unsig#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF #include <linux/cpumask.h> -extern void plat_set_irq_affinity (unsigned int irq, +extern int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity);extern void smtc_forward_irq (unsigned int irq);
arch/mips/mti-malta/malta-smtc.c +3 -1
@@ -114,7 +114,7 @@ struct plat_smp_ops msmtc_smp_ops = {*/ -void plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) +int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {cpumask_t tmask;int cpu =0 ;
@@ -156,5 +156,7 @@ void plat_set_irq_affinity(unsigned int/* Do any generic SMTC IRQ affinity setup */ smtc_set_irq_affinity (irq, tmask); + + return 0; }#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
Re: [PATCH 3/8] irq: make set_affinity to return status -v2
Quoted 25 lines · Yinghai Lu
Impact: prepare to use it to keep affinity consistent
according to Ingo, change
set_affinity()inirq_chipto return int.v2: fix two typo
Signed-off-by Yinghai Lu <[email protected]>--- arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++-
Quoted 8 lines
arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
Yeah, this patch looks _much_ nicer than the open-coded cpumask-copy lines. It makes it really apparent which architectures can fail the affinity setting and which not.
This is proper layered design - the previous patch was open-coding implementation details into the affinity-setting handlers and was thus obfuscating the code and was making it harder to maintain.
There is one omission: this should be Cc:-ed to [email protected], because it affects all architectures.
Ingo
Re: [PATCH 3/8] irq: make set_affinity to return status -v2
Quoted 16 lines · Ingo Molnar
Quoted 16 lines
arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++-
Quoted 8 lines
Quoted 8 lines
arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
[]
Quoted 2 lines
There is one omission: this should be Cc:-ed to [email protected], because it affects all architectures.
How is one supposed to know this tidbit?
Re: [PATCH 3/8] irq: make set_affinity to return status -v2
Quoted 25 lines · Joe Perches
Quoted 16 lines · Ingo Molnar
Quoted 16 lines
arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++-Quoted 8 lines
Quoted 8 lines
arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
Quoted 5 lines
[]
Quoted 2 lines
There is one omission: this should be Cc:-ed to [email protected], because it affects all architectures.
How is one supposed to know this tidbit?
by hanging around on lkml long enough? :)
If you think about automating it into scripts/get_maintainer.pl - maybe you could add a trigger that if a change affects more than a single arch/* architecture then linux-arch should be generated too for the Cc: list? It would be nice to have.
Ingo
PATCH 4/8 irq: only update affinity in chip set_affinity() -v3
In reply to Yinghai LuImpact: keep affinity consistent
irq_set_affinity() and move_masked_irq() try to assign affinity before calling chip set_affinity(). some archs are assigning again in set_affinity again.
something like:cpumask_cpy(desc->affinity, mask);desc->chip->set_affinity(mask);
in the failing path, affinity should not be touched.
also set_extra_move_desc() ( called by set_affinity) will rely on the old affinity to decide if need to move irq_desc to different node when logical flat apic mode is used.
So try remove those assignment, and make some missed arch to assign affinity in their set_affinity.
v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
v3: according to Ingo, change set_affinity() in irq_chip to return int.
--- kernel/irq/internals.h | 3 +++ kernel/irq/manage.c | 17 +++++++++++------ kernel/irq/migration.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-)
kernel/irq/internals.h +3 -0
@@ -42,6 +42,9 @@ static inline void unregister_handler_prextern int irq_select_affinity_usr (unsigned int irq); +extern void +irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask); +/* * Debugging printout: */
kernel/irq/manage.c +11 -6
@@ -80,7 +80,7 @@ int irq_can_set_affinity(unsigned int irreturn 1 ; } -static void +void irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask) {struct irqaction *action = desc->action;
@@ -109,17 +109,22 @@ int irq_set_affinity(unsigned int irq, cspin_lock_irqsave (&desc->lock, flags);#ifdef CONFIG_GENERIC_PENDING_IRQ -if (desc->status &IRQ_MOVE_PCNTXT ) - desc->chip->set_affinity (irq, cpumask); +if (desc->status &IRQ_MOVE_PCNTXT ) { +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + } + }else { desc->status |=IRQ_MOVE_PENDING ;cpumask_copy (desc->pending_mask, cpumask); }#else -cpumask_copy (desc->affinity, cpumask); - desc->chip->set_affinity (irq, cpumask); +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + }#endif -irq_set_thread_affinity (desc, cpumask); desc->status |=IRQ_AFFINITY_SET ;spin_unlock_irqrestore (&desc->lock, flags);return 0 ;
kernel/irq/migration.c +9 -5
@@ -1,5 +1,8 @@#include <linux/irq.h> +#include <linux/interrupt.h> + +#include "internals.h" void move_masked_irq (int irq) {
@@ -39,11 +42,12 @@ void move_masked_irq(int irq)* masking the irqs. */ if (likely (cpumask_any_and (desc->pending_mask, cpu_online_mask) - < nr_cpu_ids)) { -cpumask_and (desc->affinity, - desc->pending_mask, cpu_online_mask); - desc->chip->set_affinity (irq, desc->affinity); - } + < nr_cpu_ids)) +if (!desc->chip->set_affinity (irq, desc->pending_mask)) { +cpumask_copy (desc->affinity, desc->pending_mask); +irq_set_thread_affinity (desc, desc->pending_mask); + } +cpumask_clear (desc->pending_mask); }
Re: [PATCH 4/8] irq: only update affinity in chip set_affinity() -v3
Quoted 10 lines · Yinghai Lu
Impact: keep affinity consistent
irq_set_affinity()andmove_masked_irq()try to assign affinity before calling chipset_affinity(). some archs are assigning again inset_affinityagain.something like:
cpumask_cpy(desc->affinity, mask);desc->chip->set_affinity(mask);
Quoted 9 lines
in the failing path, affinity should not be touched.
also
set_extra_move_desc()( called byset_affinity) will rely on the old affinity to decide if need to moveirq_descto different node when logical flat apic mode is used.So try remove those assignment, and make some missed arch to assign affinity in their
set_affinity.
I don't see any arch specific changes in this patchset regarding this. Did I miss or currently there are no arch's that needs to get fixed?
thanks,
suresh
Re: [PATCH 4/8] irq: only update affinity in chip set_affinity() -v3
Quoted 17 lines · Suresh Siddha
Quoted 16 lines · Yinghai Lu
Impact: keep affinity consistent
irq_set_affinity()andmove_masked_irq()try to assign affinity before calling chipset_affinity(). some archs are assigning again inset_affinityagain.something like:
cpumask_cpy(desc->affinity, mask);desc->chip->set_affinity(mask);in the failing path, affinity should not be touched.
also
set_extra_move_desc()( called byset_affinity) will rely on the old affinity to decide if need to moveirq_descto different node when logical flat apic mode is used.
Quoted 7 lines
Quoted 3 lines
So try remove those assignment, and make some missed arch to assign affinity in their
set_affinity.I don't see any arch specific changes in this patchset regarding this. Did I miss or currently there are no arch's that needs to get fixed?
will update the comments.
YH
PATCH 5/8 irq: change irq_desc_alloc to take node instead cpu
In reply to Yinghai LuImpact: prepare to make irq_desc_alloc to numa aware
so could make irq_desc_alloc use node pass down
--- arch/x86/kernel/apic/io_apic.c | 46 +++++++++++++++++------------------------ arch/x86/lguest/boot.c | 2 - drivers/pci/intr_remapping.c | 15 +++++-------- drivers/xen/events.c | 2 - include/linux/interrupt.h | 2 - include/linux/irq.h | 12 +++------- kernel/irq/handle.c | 28 +++++++++--------------- kernel/irq/internals.h | 2 - kernel/softirq.c | 2 - 9 files changed, 46 insertions(+), 65 deletions(-)
arch/x86/kernel/apic/io_apic.c +20 -26
@@ -130,12 +130,9 @@ struct irq_pin_list {struct irq_pin_list *next; }; -static struct irq_pin_list *get_one_free_irq_2_pin (int cpu) +static struct irq_pin_list *get_one_free_irq_2_pin (int node) {struct irq_pin_list *pin; -int node; - - node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node);
@@ -210,12 +207,9 @@ static struct irq_cfg *irq_cfg(unsignedreturn cfg; } -static struct irq_cfg *get_one_free_irq_cfg (int cpu) +static struct irq_cfg *get_one_free_irq_cfg (int node) {struct irq_cfg *cfg; -int node; - - node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node);if (cfg) {
@@ -236,13 +230,13 @@ static struct irq_cfg *get_one_free_irq_return cfg; } -int arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int node) {struct irq_cfg *cfg; cfg = desc->chip_data;if (!cfg) { - desc->chip_data =get_one_free_irq_cfg (cpu); + desc->chip_data =get_one_free_irq_cfg (node);if (!desc->chip_data) {printk (KERN_ERR "can not alloc irq_cfg\n" );BUG_ON (1 );
@@ -398,13 +392,13 @@ static void ioapic_mask_entry(int apic,* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ -static void add_pin_to_irq_cpu (struct irq_cfg *cfg,int cpu,int apic,int pin) +static void add_pin_to_irq_node (struct irq_cfg *cfg,int node,int apic,int pin) {struct irq_pin_list *entry; entry = cfg->irq_2_pin;if (!entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) {printk (KERN_ERR "can not alloc irq_2_pin to add %d - %d\n" , apic, pin);
@@ -424,7 +418,7 @@ static void add_pin_to_irq_cpu(struct ir entry = entry->next; } - entry->next =get_one_free_irq_2_pin (cpu); + entry->next =get_one_free_irq_2_pin (node); entry = entry->next; entry->apic = apic; entry->pin = pin;
@@ -433,7 +427,7 @@ static void add_pin_to_irq_cpu(struct ir/* * Reroute an IRQ to a different pin. */ -static void __init replace_pin_at_irq_cpu (struct irq_cfg *cfg,int cpu, +static void __init replace_pin_at_irq_node (struct irq_cfg *cfg,int node,int oldapic,int oldpin,int newapic,int newpin) {
@@ -453,7 +447,7 @@ static void __init replace_pin_at_irq_cp/* why? call replace before add? */ if (!replaced) -add_pin_to_irq_cpu (cfg, cpu, newapic, newpin); +add_pin_to_irq_node (cfg, node, newapic, newpin); } static inline void io_apic_modify_irq(struct irq_cfg *cfg,
@@ -1395,7 +1389,7 @@ static void __init setup_IO_APIC_irqs(voint notcon =0 ;struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);apic_printk (APIC_VERBOSE ,KERN_DEBUG "init IO_APIC IRQs\n" );
@@ -1430,13 +1424,13 @@ static void __init setup_IO_APIC_irqs(vo apic->multi_timer_check(apic_id, irq))continue ; - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);continue ; } cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, apic_id, pin); +add_pin_to_irq_node (cfg, node, apic_id, pin);setup_IO_APIC_irq (apic_id, pin, irq, desc,irq_trigger (idx),irq_polarity (idx));
@@ -2756,7 +2750,7 @@ static inline void __init check_timer(vo {struct irq_desc *desc =irq_to_desc (0 );struct irq_cfg *cfg = desc->chip_data; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);int apic1, pin1, apic2, pin2;unsigned long flags;int no_pin1 =0 ;
@@ -2822,7 +2816,7 @@ static inline void __init check_timer(vo* Ok, does IRQ0 through the IOAPIC work? */ if (no_pin1) { -add_pin_to_irq_cpu (cfg, cpu, apic1, pin1); +add_pin_to_irq_node (cfg, node, apic1, pin1);setup_timer_IRQ0_pin (apic1, pin1, cfg->vector); }else {/* for edge trigger, setup_IO_APIC_irq already
@@ -2859,7 +2853,7 @@ static inline void __init check_timer(vo/* * legacy devices should be connected to IO APIC #0 */ -replace_pin_at_irq_cpu (cfg, cpu, apic1, pin1, apic2, pin2); +replace_pin_at_irq_node (cfg, node, apic1, pin1, apic2, pin2);setup_timer_IRQ0_pin (apic2, pin2, cfg->vector);enable_8259A_irq (0 );if (timer_irq_works ()) {
@@ -3078,7 +3072,7 @@ unsigned int create_irq_nr(unsigned intunsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3087,7 +3081,7 @@ unsigned int create_irq_nr(unsigned intspin_lock_irqsave (&vector_lock, flags);for (new = irq_want; new < nr_irqs; new++) { - desc_new =irq_to_desc_alloc_cpu (new, cpu); + desc_new =irq_to_desc_alloc_node (new, node);if (!desc_new) {printk (KERN_INFO "can not get irq_desc for %d\n" , new);continue ;
@@ -3861,7 +3855,7 @@ int io_apic_set_pci_routing (int ioapic, {struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3869,7 +3863,7 @@ int io_apic_set_pci_routing (int ioapic,return -EINVAL ; } - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);return 0 ;
@@ -3880,7 +3874,7 @@ int io_apic_set_pci_routing (int ioapic,*/ if (irq >=NR_IRQS_LEGACY ) { cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, ioapic, pin); +add_pin_to_irq_node (cfg, node, ioapic, pin); }setup_IO_APIC_irq (ioapic, pin, irq, desc, triggering, polarity);
arch/x86/lguest/boot.c +1 -1
@@ -640,7 +640,7 @@ static void __init lguest_init_IRQ(void)void lguest_setup_irq (unsigned int irq) { -irq_to_desc_alloc_cpu (irq,0 ); +irq_to_desc_alloc_node (irq,0 );set_irq_chip_and_handler_name (irq, &lguest_irq_controller, handle_level_irq,"level" ); }
drivers/pci/intr_remapping.c +6 -9
@@ -23,15 +23,12 @@ struct irq_2_iommu { };#ifdef CONFIG_GENERIC_HARDIRQS -static struct irq_2_iommu *get_one_free_irq_2_iommu (int cpu) +static struct irq_2_iommu *get_one_free_irq_2_iommu (int node) {struct irq_2_iommu *iommu; -int node; - - node =cpu_to_node (cpu); iommu =kzalloc_node (sizeof (*iommu),GFP_ATOMIC , node); -printk (KERN_DEBUG "alloc irq_2_iommu on cpu %d node %d\n" , cpu, node); +printk (KERN_DEBUG "alloc irq_2_iommu on node %d\n" , node);return iommu; }
@@ -48,7 +45,7 @@ static struct irq_2_iommu *irq_2_iommu(ureturn desc->irq_2_iommu; } -static struct irq_2_iommu *irq_2_iommu_alloc_cpu (unsigned int irq,int cpu) +static struct irq_2_iommu *irq_2_iommu_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;struct irq_2_iommu *irq_iommu;
@@ -56,7 +53,7 @@ static struct irq_2_iommu *irq_2_iommu_a/* * alloc irq desc if not allocated already. */ - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);return NULL ;
@@ -65,14 +62,14 @@ static struct irq_2_iommu *irq_2_iommu_a irq_iommu = desc->irq_2_iommu;if (!irq_iommu) - desc->irq_2_iommu =get_one_free_irq_2_iommu (cpu); + desc->irq_2_iommu =get_one_free_irq_2_iommu (node); return desc->irq_2_iommu; }static struct irq_2_iommu *irq_2_iommu_alloc (unsigned int irq) { -return irq_2_iommu_alloc_cpu (irq, boot_cpu_id); +return irq_2_iommu_alloc_node (irq,cpu_to_node (boot_cpu_id)); }#else /* !CONFIG_SPARSE_IRQ */
drivers/xen/events.c +1 -1
@@ -341,7 +341,7 @@ static int find_unbound_irq(void)if (irq == nr_irqs)panic ("No available IRQ to bind to: increase nr_irqs!\n" ); - desc =irq_to_desc_alloc_cpu (irq,0 ); + desc =irq_to_desc_alloc_node (irq,0 );if (WARN_ON (desc ==NULL ))return -1 ;
include/linux/interrupt.h +1 -1
@@ -580,6 +580,6 @@ struct irq_desc;extern int early_irq_init (void );extern int arch_probe_nr_irqs (void );extern int arch_early_irq_init (void ); -extern int arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int arch_init_chip_data (struct irq_desc *desc,int node);#endif
include/linux/irq.h +4 -8
@@ -187,7 +187,7 @@ struct irq_desc {spinlock_t lock;#ifdef CONFIG_SMP cpumask_var_t affinity; -unsigned int cpu; +unsigned int node;#ifdef CONFIG_GENERIC_PENDING_IRQ cpumask_var_t pending_mask;#endif
@@ -208,7 +208,7 @@ extern void arch_free_chip_data(struct iextern struct irq_desc irq_desc[NR_IRQS ];#endif /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);/* * Migration helpers for obsolete names, they will go away:
@@ -420,12 +420,10 @@ extern int set_irq_msi(unsigned int irq,* Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {#ifdef CONFIG_CPUMASK_OFFSTACK -int node; -if (boot) {alloc_bootmem_cpumask_var (&desc->affinity);
@@ -435,8 +433,6 @@ static inline bool alloc_desc_masks(strureturn true; } - node =cpu_to_node (cpu); -if (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false;
@@ -492,7 +488,7 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {return true;
kernel/irq/handle.c +11 -17
@@ -83,12 +83,10 @@ static struct irq_desc irq_desc_init = { .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), }; -void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr) +void init_kstat_irqs (struct irq_desc *desc,int node,int nr) { -int node;void *ptr; - node =cpu_to_node (cpu); ptr =kzalloc_node (nr *sizeof (*desc->kstat_irqs),GFP_ATOMIC , node);/*
@@ -96,33 +94,32 @@ void init_kstat_irqs(struct irq_desc *de* init_copy_kstat_irqs() could still use old one */ if (ptr) { -printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" , - cpu, node); +printk (KERN_DEBUG " alloc kstat_irqs on node %d\n" , node); desc->kstat_irqs = ptr; } } -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) +static void init_one_irq_desc (int irq,struct irq_desc *desc,int node) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));spin_lock_init (&desc->lock); desc->irq = irq;#ifdef CONFIG_SMP - desc->cpu = cpu; + desc->node = node;#endif lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_kstat_irqs (desc, cpu, nr_cpu_ids); +init_kstat_irqs (desc, node, nr_cpu_ids);if (!desc->kstat_irqs) {printk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); }init_desc_masks (desc); -arch_init_chip_data (desc, cpu); +arch_init_chip_data (desc, node); }/*
@@ -191,11 +188,10 @@ struct irq_desc *irq_to_desc(unsigned inreturn NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;unsigned long flags; -int node;if (irq >= nr_irqs) { WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n",
@@ -214,15 +210,13 @@ struct irq_desc *irq_to_desc_alloc_cpu(uif (desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_desc for %d on cpu %d node %d\n" , - irq, cpu, node); +printk (KERN_DEBUG " alloc irq_desc for %d on node %d\n" , irq, node);if (!desc) {printk (KERN_ERR "can not alloc irq_desc\n" );BUG_ON (1 ); } -init_one_irq_desc (irq, desc, cpu); +init_one_irq_desc (irq, desc, node); irq_desc_ptrs[irq] = desc;
@@ -272,7 +266,7 @@ struct irq_desc *irq_to_desc(unsigned inreturn (irq <NR_IRQS ) ? irq_desc + irq :NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {return irq_to_desc (irq); }
kernel/irq/internals.h +1 -1
@@ -16,7 +16,7 @@ extern void __disable_irq(struct irq_desextern void __enable_irq (struct irq_desc *desc,unsigned int irq,bool resume);extern struct lock_class_key irq_desc_lock_class; -extern void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr); +extern void init_kstat_irqs (struct irq_desc *desc,int node,int nr);extern void clear_kstat_irqs (struct irq_desc *desc);extern spinlock_t sparse_irq_lock;
kernel/softirq.c +1 -1
@@ -836,7 +836,7 @@ int __init __weak arch_early_irq_init(voreturn 0 ; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +int __weak arch_init_chip_data (struct irq_desc *desc,int node) {return 0 ; }
Re: [PATCH 5/8] irq: change irq_desc_alloc to take node instead cpu
Quoted 3 lines · Yinghai Lu
Impact: prepare to make
irq_desc_allocto numa awareso could make
irq_desc_allocuse node pass down
Yes - this static approach will work far better than dynamically migrating IRQ descriptors. IRQ migration is ... fragile, both in hardware, and in terms of sw complexity.
Ingo
PATCH 6/8 irq: make io_apic_set_pci_routing to take device
In reply to Yinghai LuImpact: so use dev_to_node
and use node in irq_desc_all_node()
--- arch/ia64/kernel/acpi.c | 5 +++-- arch/x86/include/asm/io_apic.h | 4 ++-- arch/x86/include/asm/mpspec.h | 4 +++- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/io_apic.c | 10 ++++++++-- drivers/acpi/pci_irq.c | 5 +++-- drivers/char/hpet.c | 4 ++-- drivers/pnp/pnpacpi/rsparser.c | 2 +- include/linux/acpi.h | 2 +- 9 files changed, 27 insertions(+), 17 deletions(-)
arch/ia64/kernel/acpi.c +3 -2
@@ -636,7 +636,7 @@ void __init acpi_numa_arch_fixup(void)* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {if (acpi_irq_model ==ACPI_IRQ_MODEL_PLATFORM )return gsi;
@@ -678,7 +678,8 @@ static int __init acpi_parse_fadt(struct fadt = (struct acpi_table_fadt *)fadt_header; -acpi_register_gsi (fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW ); +acpi_register_gsi (NULL , fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE , +ACPI_ACTIVE_LOW );return 0 ; }
arch/x86/include/asm/io_apic.h +2 -2
@@ -154,8 +154,8 @@ extern int timer_through_8259;extern int io_apic_get_unique_id (int ioapic,int apic_id);extern int io_apic_get_version (int ioapic);extern int io_apic_get_redir_entries (int ioapic); -extern int io_apic_set_pci_routing (int ioapic,int pin,int irq, -int edge_level,int active_high_low); +extern int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin, +int irq,int edge_level,int active_high_low);#endif /* CONFIG_ACPI */ extern int (*ioapic_renumber_irq)(int ioapic,int irq);
arch/x86/include/asm/mpspec.h +3 -1
@@ -72,7 +72,9 @@ extern void mp_register_ioapic(int id, uextern void mp_override_legacy_irq (u8 bus_irq,u8 polarity,u8 trigger,u32 gsi);extern void mp_config_acpi_legacy_irqs (void ); -extern int mp_register_gsi (u32 gsi,int edge_level,int active_high_low); +struct device ; +extern int mp_register_gsi (struct device *dev,u32 gsi,int edge_level, +int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
arch/x86/kernel/acpi/boot.c +4 -4
@@ -522,7 +522,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned in* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {unsigned int irq;unsigned int plat_gsi = gsi;
@@ -539,7 +539,7 @@ int acpi_register_gsi(u32 gsi, int trigg#ifdef CONFIG_X86_IO_APIC if (acpi_irq_model ==ACPI_IRQ_MODEL_IOAPIC ) { - plat_gsi =mp_register_gsi (gsi, triggering, polarity); + plat_gsi =mp_register_gsi (dev, gsi, triggering, polarity); }#endif acpi_gsi_to_irq (plat_gsi, &irq);
@@ -1158,7 +1158,7 @@ void __init mp_config_acpi_legacy_irqs(v } } -int mp_register_gsi (u32 gsi,int triggering,int polarity) +int mp_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {int ioapic;int ioapic_pin;
@@ -1253,7 +1253,7 @@ int mp_register_gsi(u32 gsi, int trigger } }#endif -io_apic_set_pci_routing (ioapic, ioapic_pin, gsi, +io_apic_set_pci_routing (dev, ioapic, ioapic_pin, gsi, triggering ==ACPI_EDGE_SENSITIVE ?0 :1 , polarity ==ACPI_ACTIVE_HIGH ?0 :1 );return gsi;
arch/x86/kernel/apic/io_apic.c +8 -2
@@ -3851,11 +3851,12 @@ int __init io_apic_get_version(int ioapi }#endif -int io_apic_set_pci_routing (int ioapic,int pin,int irq,int triggering,int polarity) +int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin,int irq, +int triggering,int polarity) {struct irq_desc *desc;struct irq_cfg *cfg; -int node =cpu_to_node (boot_cpu_id); +int node;if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3863,6 +3864,11 @@ int io_apic_set_pci_routing (int ioapic,return -EINVAL ; } +if (dev) + node =dev_to_node (dev); +else + node =cpu_to_node (boot_cpu_id); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);
drivers/acpi/pci_irq.c +3 -2
@@ -401,7 +401,8 @@ int acpi_pci_irq_enable(struct pci_dev */* Interrupt Line values above 0xF are forbidden */ if (dev->irq >0 && (dev->irq <=0xF )) {printk (" - using IRQ %d\n" , dev->irq); -acpi_register_gsi (dev->irq,ACPI_LEVEL_SENSITIVE , +acpi_register_gsi (&dev->dev, dev->irq, +ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );return 0 ; }else {
@@ -410,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev * } } - rc =acpi_register_gsi (gsi, triggering, polarity); + rc =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (rc <0 ) {dev_warn (&dev->dev,"PCI INT %c: failed to register GSI\n" ,pin_name (pin));
drivers/char/hpet.c +2 -2
@@ -224,7 +224,7 @@ static void hpet_timer_set_irq(struct hpbreak ; } - gsi =acpi_register_gsi (irq,ACPI_LEVEL_SENSITIVE , + gsi =acpi_register_gsi (NULL , irq,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );if (gsi >0 )break ;
@@ -939,7 +939,7 @@ static acpi_status hpet_resources(struct irqp = &res->data.extended_irq;for (i =0 ; i < irqp->interrupt_count; i++) { - irq =acpi_register_gsi (irqp->interrupts[i], + irq =acpi_register_gsi (NULL , irqp->interrupts[i], irqp->triggering, irqp->polarity);if (irq <0 )return AE_ERROR ;
drivers/pnp/pnpacpi/rsparser.c +1 -1
@@ -123,7 +123,7 @@ static void pnpacpi_parse_allocated_irqr } flags =irq_flags (triggering, polarity, shareable); - irq =acpi_register_gsi (gsi, triggering, polarity); + irq =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (irq >=0 )pcibios_penalize_isa_irq (irq,1 );else
include/linux/acpi.h +1 -1
@@ -118,7 +118,7 @@ extern int pci_mmcfg_config_num;extern int sbf_port;extern unsigned long acpi_realmode_flags; -int acpi_register_gsi (u32 gsi,int triggering,int polarity); +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq);#ifdef CONFIG_X86_IO_APIC
Re: [PATCH 6/8] irq: make io_apic_set_pci_routing to take device
Quoted 6 lines · Yinghai Lu
Impact: so use
dev_to_nodeand use node in
irq_desc_all_node()Signed-off-by Yinghai Lu <[email protected]>
Quoted 11 lines
--- arch/ia64/kernel/acpi.c | 5 +++-- arch/x86/include/asm/io_apic.h | 4 ++-- arch/x86/include/asm/mpspec.h | 4 +++- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/io_apic.c | 10 ++++++++-- drivers/acpi/pci_irq.c | 5 +++-- drivers/char/hpet.c | 4 ++-- drivers/pnp/pnpacpi/rsparser.c | 2 +- include/linux/acpi.h | 2 +- 9 files changed, 27 insertions(+), 17 deletions(-)
Please split this into two patches: one "obviously correct" one that just extends the call parameters, and another one that makes use of the new information:
arch/x86/kernel/apic/io_apic.c int io_apic_set_pci_routing (int ioapic, · line 3870
Quoted 4 lines
arch/x86/kernel/apic/io_apic.c +4
-0+if (dev) + node =dev_to_node (dev); +else + node =cpu_to_node (boot_cpu_id);
Btw., this sequence raises the question: wouldnt it be cleaner to have some sort of (somewhat artificial) 'boot platform device' that could be passed down instead of NULL, which would give dev_to_node(&boot_platform_dev) == boot_cpu_id?
Dunno - maybe it's not worth it and your solution is the cleanest.
Also, when submitting patches, please always try to Cc: affected non-x86 maintainers:
scripts/get_maintainer.pl -f drivers/acpi/pci_irq.c \ drivers/pnp/pnpacpi/rsparser.c include/linux/acpi.h \ arch/ia64/kernel/acpi.c
Thanks,
Ingo
PATCH 7/8 x86/irq: make MSI irq_desc numa aware
In reply to Yinghai LuImpact: use irq_desc_alloc_node
try to get irq_desc on the node in create_irq_nr
--- arch/x86/kernel/apic/io_apic.c | 15 +++++++++++---- include/linux/irq.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +11 -4
@@ -3065,14 +3065,13 @@ static int nr_irqs_gsi = NR_IRQS_LEGACY;/* * Dynamic irq allocate and deallocation */ -unsigned int create_irq_nr (unsigned int irq_want) +unsigned int create_irq_nr (unsigned int irq_want,int node) {/* Allocate an unused irq */ unsigned int irq;unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3090,6 +3089,11 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; + +/* different node ?*/ +if (desc_new->node != node) +continue ; +if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;break ;
@@ -3107,11 +3111,12 @@ unsigned int create_irq_nr(unsigned intint create_irq (void ) { +int node =cpu_to_node (boot_cpu_id);unsigned int irq_want;int irq; irq_want = nr_irqs_gsi; - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 ) irq =-1 ;
@@ -3369,15 +3374,17 @@ int arch_setup_msi_irqs(struct pci_dev *unsigned int irq_want;struct intel_iommu *iommu =NULL ;int index =0 ; +int node;/* x86 doesn't support multiple MSI yet */ if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; + node =dev_to_node (&dev->dev); irq_want = nr_irqs_gsi; sub_handle =0 ;list_for_each_entry (msidesc, &dev->msi_list, list) { - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 )return -1 ; irq_want = irq +1 ;
include/linux/irq.h +1 -1
@@ -374,7 +374,7 @@ extern void set_irq_noprobe(unsigned intextern void set_irq_probe (unsigned int irq);/* Handle dynamic irq creation and destruction */ -extern unsigned int create_irq_nr (unsigned int irq_want); +extern unsigned int create_irq_nr (unsigned int irq_want,int node);extern int create_irq (void );extern void destroy_irq (unsigned int irq);
Re: [PATCH 7/8] x86/irq: make MSI irq_desc numa aware
Quoted 3 lines · Yinghai Lu
Impact: use
irq_desc_alloc_nodetry to get
irq_descon the node increate_irq_nr
ok, this seems much clearer and more obvious than the migration stuff.
Eric, what do you think?
Ingo
PATCH 8/8 irq: make ht irq_desc numa aware
In reply to Yinghai LuImpact: use create_irq_nr
try to get irq_desc on the node with create_irq_nr
--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/htirq.c +3 -1
@@ -98,6 +98,7 @@ int __ht_create_irq(struct pci_dev *dev,int max_irq;int pos;int irq; +int node; pos =pci_find_ht_capability (dev,HT_CAPTYPE_IRQ );if (!pos)
@@ -125,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, cfg->msg.address_lo =0xffffffff ; cfg->msg.address_hi =0xffffffff ; - irq =create_irq (); + node =dev_to_node (&dev->dev); + irq =create_irq_nr (0 , node);if (irq <=0 ) {kfree (cfg);
Re: [PATCH 8/8] irq: make ht irq_desc numa aware
Quoted 22 lines · Yinghai Lu
Impact: use
create_irq_nrtry to get
irq_descon the node withcreate_irq_nrSigned-off-by Yinghai Lu <[email protected]>--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Index:
linux-2.6/drivers/pci/htirq.c
===================================================================drivers/pci/htirq.c +1
-0@@ -98,6 +98,7 @@ int __ht_create_irq(struct pci_dev *dev,int max_irq;int pos;int irq; +int node; pos =pci_find_ht_capability (dev,HT_CAPTYPE_IRQ );if (!pos)
drivers/pci/htirq.c int __ht_create_irq(struct pci_dev *dev, · line 133
Quoted 9 lines
drivers/pci/htirq.c +2
-1@@ -125,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, cfg->msg.address_lo =0xffffffff ; cfg->msg.address_hi =0xffffffff ; - irq =create_irq (); + node =dev_to_node (&dev->dev); + irq =create_irq_nr (0 , node);if (irq <=0 ) {kfree (cfg);
this too looks nice.
The whole series has become very reasonable (modulo the minor structure and Cc: related comments i made).
It's obviously too late in .30 to push it upstream, so the best action is to mark it broken upstream, then remove + rewrite it in the IRQ tree and we'll have all this done properly in v2.6.31.
Thomas, Eric, Suresh, what do you think?
Ingo
Re: [PATCH 8/8] irq: make ht irq_desc numa aware
Quoted 8 lines · Ingo Molnar
The whole series has become very reasonable (modulo the minor structure and Cc: related comments i made).
It's obviously too late in .30 to push it upstream, so the best action is to mark it broken upstream, then remove + rewrite it in the IRQ tree and we'll have all this done properly in v2.6.31.
Thomas, Eric, Suresh, what do you think?
Instead of marking the NUMA_MIGRATE_IRQ_DESC config option broken, I would like to see it removed in 2.6.30 (i.e., apply the first patch in this patchset for 2.6.30). As this simplifies quite a bit of code, this will help anyone debugging a problem in this irq handling area, during the life span of any distro carrying this kernel version.
thanks,
suresh
Quoted 7 lines · Yinghai Lu
Impact: it is not ready yet.remove it
it causes crash on system with lots of cards with MSI-X when
irq_balancerenabled...will have one new patch that create
irq_descaccording to device numa node.
Could you please mark it CONFIG_BROKEN instead?
Ingo
PATCH 1/9 x86/irq: remove NUMA_MIGRATE_IRQ_DESC
Impact: it is not ready yet.remove it
it causes crash on system with lots of cards with MSI-X when irq_balancer enabled...
will have new patches that create irq_desc according to device numa node.
--- arch/x86/configs/x86_64_defconfig | 1 arch/x86/kernel/apic/io_apic.c | 155 -------------------------------------- include/linux/irq.h | 12 -- kernel/irq/Makefile | 1 kernel/irq/chip.c | 12 -- kernel/irq/handle.c | 9 -- kernel/irq/numa_migrate.c | 133 -------------------------------- 7 files changed, 6 insertions(+), 317 deletions(-)
arch/x86/configs/x86_64_defconfig +0 -1
@@ -195,7 +195,6 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_SPARSE_IRQ=y -# CONFIG_NUMA_MIGRATE_IRQ_DESC is not set CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y # CONFIG_X86_ELAN is not set
arch/x86/kernel/apic/io_apic.c +2 -153
197 lines not on this page · raw message
include/linux/irq.h +0 -12
@@ -206,22 +206,10 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu);#endif /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); -static inline struct irq_desc * -irq_remap_to_desc (unsigned int irq,struct irq_desc *desc) -{ -#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC -return irq_to_desc (irq); -#else -return desc; -#endif -} -/* * Migration helpers for obsolete names, they will go away: */
kernel/irq/Makefile +0 -1
@@ -3,5 +3,4 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_NUMA_MIGRATE_IRQ_DESC) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
kernel/irq/chip.c +2 -10
@@ -359,7 +359,6 @@ handle_level_irq(unsigned int irq, strucspin_lock (&desc->lock);mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc);if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock;
@@ -438,7 +437,6 @@ handle_fasteoi_irq(unsigned int irq, str desc->status &= ~IRQ_INPROGRESS ; out: desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc);spin_unlock (&desc->lock); }
@@ -475,7 +473,6 @@ handle_edge_irq(unsigned int irq, struct !desc->action)) { desc->status |= (IRQ_PENDING |IRQ_MASKED );mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); goto out_unlock; }kstat_incr_irqs_this_cpu (irq, desc);
@@ -483,7 +480,6 @@ handle_edge_irq(unsigned int irq, struct/* Start handling the irq */ if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc);/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -544,10 +540,8 @@ handle_percpu_irq(unsigned int irq, struif (!noirqdebug)note_interrupt (irq, desc, action_ret); -if (desc->chip->eoi) { +if (desc->chip->eoi) desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc); - } }void
@@ -582,10 +576,8 @@ __set_irq_handler(unsigned int irq, irq_/* Uninstall? */ if (handle == handle_bad_irq) { -if (desc->chip != &no_irq_chip) { +if (desc->chip != &no_irq_chip)mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); - } desc->status |=IRQ_DISABLED ; desc->depth =1 ; }
kernel/irq/handle.c +2 -7
@@ -454,11 +454,8 @@ unsigned int __do_IRQ(unsigned int irq)/* * No locking required for CPU-local interrupts: */ -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); -/* get new one */ - desc =irq_remap_to_desc (irq, desc); - }if (likely (!(desc->status &IRQ_DISABLED ))) { action_ret =handle_IRQ_event (irq, desc->action);if (!noirqdebug)
@@ -469,10 +466,8 @@ unsigned int __do_IRQ(unsigned int irq) }spin_lock (&desc->lock); -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc); - }/* * REPLAY is when Linux resends an IRQ that was dropped earlier * WAITING is used by probe to mark irqs that are being tested
kernel/irq/numa_migrate.c deleted +0 -133
133 lines not on this page · raw message
PATCH 1/9 irq: correct CPUMASKS_OFFSTACK typo -v5
Impact: fix smp_affinity copying when moving irq_desc
CPUMASKS_OFFSTACK is not defined anywhere. it is a typo
and init_allocate_desc_masks called before it set affinity to all cpus...
split init_alloc_desc_masks() into all_desc_masks() and init_desc_masks()
also could use that CPUMASK_OFFSTACK in alloc_desc_masks()
v5: apply before NUMA_IRQ_DESC_MIGRATION
--- include/linux/irq.h | 27 ++++++++++++++++++--------- kernel/irq/handle.c | 9 ++++++--- kernel/irq/numa_migrate.c | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-)
include/linux/irq.h +18 -9
@@ -424,27 +424,25 @@ extern int set_irq_msi(unsigned int irq,#ifdef CONFIG_SMP /** -* init_alloc_desc_masks - allocate cpumasks for irq_desc +* alloc_desc_masks - allocate cpumasks for irq_desc * @desc: pointer to irq_desc struct * @cpu: cpu which will be handling the cpumasks * @boot: true if need bootmem * * Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). -* Side effect: affinity has all bits set, pending_mask has all bits clear. */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) { +#ifdef CONFIG_CPUMASK_OFFSTACK int node;if (boot) {alloc_bootmem_cpumask_var (&desc->affinity); -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ alloc_bootmem_cpumask_var (&desc->pending_mask); -cpumask_clear (desc->pending_mask);#endif return true; }
@@ -453,18 +451,25 @@ static inline bool init_alloc_desc_masksif (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false; -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ if (!alloc_cpumask_var_node (&desc->pending_mask,GFP_ATOMIC , node)) {free_cpumask_var (desc->affinity);return false; } -cpumask_clear (desc->pending_mask); +#endif #endif return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +cpumask_setall (desc->affinity); +#ifdef CONFIG_GENERIC_PENDING_IRQ +cpumask_clear (desc->pending_mask); +#endif +} +/** * init_copy_desc_masks - copy cpumasks for irq_desc * @old_desc: pointer to old irq_desc struct
@@ -478,7 +483,7 @@ static inline bool init_alloc_desc_masksstatic inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) { -#ifdef CONFIG_CPUMASKS_OFFSTACK +#ifdef CONFIG_CPUMASK_OFFSTACK cpumask_copy (new_desc->affinity, old_desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ
@@ -499,12 +504,16 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) {return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +} +static inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) {
kernel/irq/handle.c +6 -3
@@ -117,10 +117,11 @@ static void init_one_irq_desc(int irq, sprintk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); } +init_desc_masks (desc);arch_init_chip_data (desc, cpu); }
@@ -171,7 +172,8 @@ int __init early_irq_init(void) desc[i].irq = i; desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;lockdep_set_class (&desc[i].lock, &irq_desc_lock_class); -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); irq_desc_ptrs[i] = desc + i; }
@@ -258,7 +260,8 @@ int __init early_irq_init(void)for (i =0 ; i < count; i++) { desc[i].irq = i; -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); desc[i].kstat_irqs = kstat_irqs_all[i]; }return arch_early_irq_init ();
kernel/irq/numa_migrate.c +1 -1
@@ -37,7 +37,7 @@ static bool init_copy_one_irq_desc(int i struct irq_desc *desc, int cpu) { memcpy(desc, old_desc, sizeof(struct irq_desc)); -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "irq %d: can not get new irq_desc cpumask " "for migration.\n" , irq);return false;
[tip:irq/numa] irq, cpumask: correct CPUMASKS_OFFSTACK typo and fix fallout
Commit-ID: 9ec4fa271faf2db3b8e1419c998da1ca6b094eb6 Gitweb: http://git.kernel.org/tip/9ec4fa271faf2db3b8e1419c998da1ca6b094eb6 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 17:57:18 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:14 +0200
irq, cpumask: correct CPUMASKS_OFFSTACK typo and fix fallout
CPUMASKS_OFFSTACK is not defined anywhere (it is CPUMASK_OFFSTACK). It is a typo and init_allocate_desc_masks() is called before it set affinity to all cpus...
Split init_alloc_desc_masks() into all_desc_masks() and init_desc_masks().
Also use CPUMASK_OFFSTACK in alloc_desc_masks().
[ Impact: fix smp_affinity copying/setup when moving irq_desc between CPUs ]
LKML-Reference: <[email protected]>
--- include/linux/irq.h | 27 ++++++++++++++++++--------- kernel/irq/handle.c | 9 ++++++--- kernel/irq/numa_migrate.c | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-)
include/linux/irq.h +18 -9
@@ -424,27 +424,25 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);#ifdef CONFIG_SMP /** -* init_alloc_desc_masks - allocate cpumasks for irq_desc +* alloc_desc_masks - allocate cpumasks for irq_desc * @desc: pointer to irq_desc struct * @cpu: cpu which will be handling the cpumasks * @boot: true if need bootmem * * Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). -* Side effect: affinity has all bits set, pending_mask has all bits clear. */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) { +#ifdef CONFIG_CPUMASK_OFFSTACK int node;if (boot) {alloc_bootmem_cpumask_var (&desc->affinity); -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ alloc_bootmem_cpumask_var (&desc->pending_mask); -cpumask_clear (desc->pending_mask);#endif return true; }
@@ -453,18 +451,25 @@ static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,if (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false; -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ if (!alloc_cpumask_var_node (&desc->pending_mask,GFP_ATOMIC , node)) {free_cpumask_var (desc->affinity);return false; } -cpumask_clear (desc->pending_mask); +#endif #endif return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +cpumask_setall (desc->affinity); +#ifdef CONFIG_GENERIC_PENDING_IRQ +cpumask_clear (desc->pending_mask); +#endif +} +/** * init_copy_desc_masks - copy cpumasks for irq_desc * @old_desc: pointer to old irq_desc struct
@@ -478,7 +483,7 @@ static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,static inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) { -#ifdef CONFIG_CPUMASKS_OFFSTACK +#ifdef CONFIG_CPUMASK_OFFSTACK cpumask_copy (new_desc->affinity, old_desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ
@@ -499,12 +504,16 @@ static inline void free_desc_masks(struct irq_desc *old_desc,#else /* !CONFIG_SMP */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) {return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +} +static inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) {
kernel/irq/handle.c +6 -3
@@ -115,10 +115,11 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)printk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); } +init_desc_masks (desc);arch_init_chip_data (desc, cpu); }
@@ -169,7 +170,8 @@ int __init early_irq_init(void) desc[i].irq = i; desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;lockdep_set_class (&desc[i].lock, &irq_desc_lock_class); -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); irq_desc_ptrs[i] = desc + i; }
@@ -256,7 +258,8 @@ int __init early_irq_init(void)for (i =0 ; i < count; i++) { desc[i].irq = i; -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); desc[i].kstat_irqs = kstat_irqs_all[i]; }return arch_early_irq_init ();
kernel/irq/numa_migrate.c +1 -1
@@ -37,7 +37,7 @@ static bool init_copy_one_irq_desc(int irq, struct irq_desc *old_desc, struct irq_desc *desc, int cpu) { memcpy(desc, old_desc, sizeof(struct irq_desc)); -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "irq %d: can not get new irq_desc cpumask " "for migration.\n" , irq);return false;
PATCH 2/9 irq: correct CPUMASKS_OFFSTACK typo -v4
In reply to Yinghai LuImpact: fix smp_affinity copying when moving irq_desc
CPUMASKS_OFFSTACK is not defined anywhere. it is a typo
and init_allocate_desc_masks called before it set affinity to all cpus...
split init_alloc_desc_masks() into all_desc_masks() and init_desc_masks()
also could use that CPUMASK_OFFSTACK in alloc_desc_masks()
v3: update after "remove numa_migrate irq_desc"
v4: remove lines with numa_migration.c
--- include/linux/irq.h | 27 ++++++++++++++++++--------- kernel/irq/handle.c | 9 ++++++--- 2 files changed, 24 insertions(+), 12 deletions(-)
include/linux/irq.h +18 -9
@@ -412,27 +412,25 @@ extern int set_irq_msi(unsigned int irq,#ifdef CONFIG_SMP /** -* init_alloc_desc_masks - allocate cpumasks for irq_desc +* alloc_desc_masks - allocate cpumasks for irq_desc * @desc: pointer to irq_desc struct * @cpu: cpu which will be handling the cpumasks * @boot: true if need bootmem * * Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). -* Side effect: affinity has all bits set, pending_mask has all bits clear. */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) { +#ifdef CONFIG_CPUMASK_OFFSTACK int node;if (boot) {alloc_bootmem_cpumask_var (&desc->affinity); -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ alloc_bootmem_cpumask_var (&desc->pending_mask); -cpumask_clear (desc->pending_mask);#endif return true; }
@@ -441,18 +439,25 @@ static inline bool init_alloc_desc_masksif (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false; -cpumask_setall (desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ if (!alloc_cpumask_var_node (&desc->pending_mask,GFP_ATOMIC , node)) {free_cpumask_var (desc->affinity);return false; } -cpumask_clear (desc->pending_mask); +#endif #endif return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +cpumask_setall (desc->affinity); +#ifdef CONFIG_GENERIC_PENDING_IRQ +cpumask_clear (desc->pending_mask); +#endif +} +/** * init_copy_desc_masks - copy cpumasks for irq_desc * @old_desc: pointer to old irq_desc struct
@@ -466,7 +471,7 @@ static inline bool init_alloc_desc_masksstatic inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) { -#ifdef CONFIG_CPUMASKS_OFFSTACK +#ifdef CONFIG_CPUMASK_OFFSTACK cpumask_copy (new_desc->affinity, old_desc->affinity);#ifdef CONFIG_GENERIC_PENDING_IRQ
@@ -487,12 +492,16 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool init_alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu,bool boot) {return true; } +static inline void init_desc_masks (struct irq_desc *desc) +{ +} +static inline void init_copy_desc_masks (struct irq_desc *old_desc,struct irq_desc *new_desc) {
kernel/irq/handle.c +6 -3
@@ -117,10 +117,11 @@ static void init_one_irq_desc(int irq, sprintk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!init_alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, cpu, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); } +init_desc_masks (desc);arch_init_chip_data (desc, cpu); }
@@ -171,7 +172,8 @@ int __init early_irq_init(void) desc[i].irq = i; desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;lockdep_set_class (&desc[i].lock, &irq_desc_lock_class); -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); irq_desc_ptrs[i] = desc + i; }
@@ -258,7 +260,8 @@ int __init early_irq_init(void)for (i =0 ; i < count; i++) { desc[i].irq = i; -init_alloc_desc_masks (&desc[i],0 , true); +alloc_desc_masks (&desc[i],0 , true); +init_desc_masks (&desc[i]); desc[i].kstat_irqs = kstat_irqs_all[i]; }return arch_early_irq_init ();
PATCH 2/9 x86/irq: remove NUMA_MIGRATE_IRQ_DESC -v2
it causes crash on system with lots of cards with MSI-X when irq_balancer enabled...
will have new patches that create irq_desc according to device numa node.
v2: still keep move_irq_desc, will use it later
Impact: it is not ready yet.remove it
--- arch/x86/Kconfig | 10 ------ arch/x86/configs/x86_64_defconfig | 1 arch/x86/kernel/apic/io_apic.c | 56 ++------------------------------------ include/linux/irq.h | 10 ------ kernel/irq/Makefile | 2 - kernel/irq/chip.c | 12 +------- kernel/irq/handle.c | 9 +----- kernel/irq/numa_migrate.c | 2 - 8 files changed, 9 insertions(+), 93 deletions(-)
arch/x86/configs/x86_64_defconfig +0 -1
@@ -195,7 +195,6 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_SPARSE_IRQ=y -# CONFIG_NUMA_MIGRATE_IRQ_DESC is not set CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y # CONFIG_X86_ELAN is not set
arch/x86/kernel/apic/io_apic.c +4 -52
104 lines not on this page · raw message
include/linux/irq.h +0 -10
@@ -212,16 +212,6 @@ extern struct irq_desc *move_irq_desc(stextern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); -static inline struct irq_desc * -irq_remap_to_desc (unsigned int irq,struct irq_desc *desc) -{ -#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC -return irq_to_desc (irq); -#else -return desc; -#endif -} -/* * Migration helpers for obsolete names, they will go away: */
kernel/irq/Makefile +1 -1
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_NUMA_MIGRATE_IRQ_DESC) += numa_migrate.o +obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
kernel/irq/chip.c +2 -10
@@ -359,7 +359,6 @@ handle_level_irq(unsigned int irq, strucspin_lock (&desc->lock);mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc);if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock;
@@ -438,7 +437,6 @@ handle_fasteoi_irq(unsigned int irq, str desc->status &= ~IRQ_INPROGRESS ; out: desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc);spin_unlock (&desc->lock); }
@@ -475,7 +473,6 @@ handle_edge_irq(unsigned int irq, struct !desc->action)) { desc->status |= (IRQ_PENDING |IRQ_MASKED );mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); goto out_unlock; }kstat_incr_irqs_this_cpu (irq, desc);
@@ -483,7 +480,6 @@ handle_edge_irq(unsigned int irq, struct/* Start handling the irq */ if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc);/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -544,10 +540,8 @@ handle_percpu_irq(unsigned int irq, struif (!noirqdebug)note_interrupt (irq, desc, action_ret); -if (desc->chip->eoi) { +if (desc->chip->eoi) desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc); - } }void
@@ -582,10 +576,8 @@ __set_irq_handler(unsigned int irq, irq_/* Uninstall? */ if (handle == handle_bad_irq) { -if (desc->chip != &no_irq_chip) { +if (desc->chip != &no_irq_chip)mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); - } desc->status |=IRQ_DISABLED ; desc->depth =1 ; }
kernel/irq/handle.c +2 -7
@@ -457,11 +457,8 @@ unsigned int __do_IRQ(unsigned int irq)/* * No locking required for CPU-local interrupts: */ -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); -/* get new one */ - desc =irq_remap_to_desc (irq, desc); - }if (likely (!(desc->status &IRQ_DISABLED ))) { action_ret =handle_IRQ_event (irq, desc->action);if (!noirqdebug)
@@ -472,10 +469,8 @@ unsigned int __do_IRQ(unsigned int irq) }spin_lock (&desc->lock); -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc); - }/* * REPLAY is when Linux resends an IRQ that was dropped earlier * WAITING is used by probe to mark irqs that are being tested
arch/x86/Kconfig +0 -10
@@ -280,16 +280,6 @@ config SPARSE_IRQ If you don't know what to do here, say N. -config NUMA_MIGRATE_IRQ_DESC - bool "Move irq desc when changing irq smp_affinity" - depends on SPARSE_IRQ && NUMA - depends on BROKEN - default n - ---help--- - This enables moving irq_desc to cpu/node that irq will use handled. - - If you don't know what to do here, say N. - config X86_MPPARSE bool "Enable MPS table" if ACPI default y
kernel/irq/numa_migrate.c +0 -2
@@ -97,9 +97,7 @@ static struct irq_desc *__real_move_irq_/* free the old one */ free_one_irq_desc (old_desc, desc); -spin_unlock (&old_desc->lock);kfree (old_desc); -spin_lock (&desc->lock);return desc;
[tip:irq/numa] x86/irq: remove leftover code from NUMA_MIGRATE_IRQ_DESC
Commit-ID: fcef5911c7ea89b80d5bfc727f402f37c9eefd57 Gitweb: http://git.kernel.org/tip/fcef5911c7ea89b80d5bfc727f402f37c9eefd57 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 17:58:23 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:15 +0200
x86/irq: remove leftover code from NUMA_MIGRATE_IRQ_DESC
The original feature of migrating irq_desc dynamic was too fragile and was causing problems: it caused crashes on systems with lots of cards with MSI-X when user-space irq-balancer was enabled.
We now have new patches that create irq_desc according to device numa node. This patch removes the leftover bits of the dynamic balancer.
[ Impact: remove dead code ]
LKML-Reference: <[email protected]>
--- arch/x86/Kconfig | 10 ------ arch/x86/configs/x86_64_defconfig | 1 - arch/x86/kernel/apic/io_apic.c | 56 ++---------------------------------- include/linux/irq.h | 10 ------ kernel/irq/Makefile | 2 +- kernel/irq/chip.c | 12 +------ kernel/irq/handle.c | 9 +---- kernel/irq/numa_migrate.c | 2 - 8 files changed, 9 insertions(+), 93 deletions(-)
arch/x86/Kconfig +0 -10
@@ -274,16 +274,6 @@ config SPARSE_IRQ If you don't know what to do here, say N. -config NUMA_MIGRATE_IRQ_DESC - bool "Move irq desc when changing irq smp_affinity" - depends on SPARSE_IRQ && NUMA - depends on BROKEN - default n - ---help--- - This enables moving irq_desc to cpu/node that irq will use handled. - - If you don't know what to do here, say N. - config X86_MPPARSE bool "Enable MPS table" if ACPI default y
arch/x86/configs/x86_64_defconfig +0 -1
@@ -195,7 +195,6 @@ CONFIG_HIGH_RES_TIMERS=y CONFIG_GENERIC_CLOCKEVENTS_BUILD=y CONFIG_SMP=y CONFIG_SPARSE_IRQ=y -# CONFIG_NUMA_MIGRATE_IRQ_DESC is not set CONFIG_X86_FIND_SMP_CONFIG=y CONFIG_X86_MPPARSE=y # CONFIG_X86_ELAN is not set
arch/x86/kernel/apic/io_apic.c +4 -52
104 lines not on this page · raw message
include/linux/irq.h +0 -10
@@ -212,16 +212,6 @@ extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); -static inline struct irq_desc * -irq_remap_to_desc (unsigned int irq,struct irq_desc *desc) -{ -#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC -return irq_to_desc (irq); -#else -return desc; -#endif -} -/* * Migration helpers for obsolete names, they will go away: */
kernel/irq/Makefile +1 -1
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o resend.o chip.o devres.o obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_NUMA_MIGRATE_IRQ_DESC) += numa_migrate.o +obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
kernel/irq/chip.c +2 -10
@@ -359,7 +359,6 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)spin_lock (&desc->lock);mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc);if (unlikely (desc->status &IRQ_INPROGRESS )) goto out_unlock;
@@ -438,7 +437,6 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) desc->status &= ~IRQ_INPROGRESS ; out: desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc);spin_unlock (&desc->lock); }
@@ -475,7 +473,6 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) !desc->action)) { desc->status |= (IRQ_PENDING |IRQ_MASKED );mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); goto out_unlock; }kstat_incr_irqs_this_cpu (irq, desc);
@@ -483,7 +480,6 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)/* Start handling the irq */ if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc);/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -544,10 +540,8 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)if (!noirqdebug)note_interrupt (irq, desc, action_ret); -if (desc->chip->eoi) { +if (desc->chip->eoi) desc->chip->eoi (irq); - desc =irq_remap_to_desc (irq, desc); - } }void
@@ -582,10 +576,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,/* Uninstall? */ if (handle == handle_bad_irq) { -if (desc->chip != &no_irq_chip) { +if (desc->chip != &no_irq_chip)mask_ack_irq (desc, irq); - desc =irq_remap_to_desc (irq, desc); - } desc->status |=IRQ_DISABLED ; desc->depth =1 ; }
kernel/irq/handle.c +2 -7
@@ -458,11 +458,8 @@ unsigned int __do_IRQ(unsigned int irq)/* * No locking required for CPU-local interrupts: */ -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); -/* get new one */ - desc =irq_remap_to_desc (irq, desc); - }if (likely (!(desc->status &IRQ_DISABLED ))) { action_ret =handle_IRQ_event (irq, desc->action);if (!noirqdebug)
@@ -473,10 +470,8 @@ unsigned int __do_IRQ(unsigned int irq) }spin_lock (&desc->lock); -if (desc->chip->ack) { +if (desc->chip->ack) desc->chip->ack (irq); - desc =irq_remap_to_desc (irq, desc); - }/* * REPLAY is when Linux resends an IRQ that was dropped earlier * WAITING is used by probe to mark irqs that are being tested
kernel/irq/numa_migrate.c +0 -2
@@ -97,9 +97,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,/* free the old one */ free_one_irq_desc (old_desc, desc); -spin_unlock (&old_desc->lock);kfree (old_desc); -spin_lock (&desc->lock);return desc;
PATCH 3/9 irq: make set_affinity to return status -v2
In reply to Yinghai LuImpact: prepare to use it to keep affinity consistent
according to Ingo, change set_affinity() in irq_chip to return int.
v2: fix two typo
--- arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++- arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
arch/alpha/kernel/sys_dp264.c +6 -2
@@ -176,22 +176,26 @@ cpu_set_irq_affinity(unsigned int irq, c } } -static void +static int dp264_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq, *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; } -static void +static int clipper_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq -16 , *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; }static struct hw_interrupt_type dp264_irq_type = {
arch/alpha/kernel/sys_titan.c +3 -1
@@ -157,13 +157,15 @@ titan_cpu_set_irq_affinity(unsigned int } -static void +static int titan_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&titan_irq_lock);titan_cpu_set_irq_affinity (irq -16 , *affinity);titan_update_irq_hw (titan_cached_irq_mask);spin_unlock (&titan_irq_lock); + +return 0 ; } static void
arch/arm/common/gic.c +3 -1
@@ -109,7 +109,7 @@ static void gic_unmask_irq(unsigned int }#ifdef CONFIG_SMP -static void gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) +static int gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) {void __iomem *reg =gic_dist_base (irq) +GIC_DIST_TARGET + (gic_irq (irq) & ~3 );unsigned int shift = (irq %4 ) *8 ;
@@ -122,6 +122,8 @@ static void gic_set_cpu(unsigned int irq val |=1 << (cpu + shift);writel (val, reg);spin_unlock (&irq_controller_lock); + + return 0; }#endif
arch/cris/arch-v32/kernel/irq.c +3 -1
@@ -325,12 +325,14 @@ static void end_crisv32_irq(unsigned int { } -void set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) +int set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) {unsigned long flags;spin_lock_irqsave (&irq_lock, flags); irq_allocations[irq -FIRST_IRQ ].mask = *dest;spin_unlock_irqrestore (&irq_lock, flags); + +return 0 ; }static struct irq_chip crisv32_irq_type = {
arch/ia64/hp/sim/hpsim_irq.c +2 -1
@@ -21,9 +21,10 @@ hpsim_irq_noop (unsigned int irq) { } -static void +static int hpsim_set_affinity_noop (unsigned int a,const struct cpumask *b) { +return 0 ; }static struct hw_interrupt_type irq_type_hp_sim = {
arch/ia64/kernel/iosapic.c +6 -4
@@ -329,7 +329,7 @@ unmask_irq (unsigned int irq) } -static void +static int iosapic_set_affinity (unsigned int irq,const struct cpumask *mask) {#ifdef CONFIG_SMP
@@ -343,15 +343,15 @@ iosapic_set_affinity(unsigned int irq, c cpu =cpumask_first_and (cpu_online_mask, mask);if (cpu >= nr_cpu_ids) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ; dest =cpu_physical_id (cpu);if (!iosapic_intr_info[irq].count) -return ;/* not an IOSAPIC interrupt */ +return -1 ;/* not an IOSAPIC interrupt */ set_irq_affinity_info (irq, dest, redir);
@@ -376,7 +376,9 @@ iosapic_set_affinity(unsigned int irq, ciosapic_write (iosapic,IOSAPIC_RTE_HIGH (rte_index), high32); iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32); } +#endif +return 0 ; }/*
arch/ia64/kernel/msi_ia64.c +10 -6
@@ -12,7 +12,7 @@static struct irq_chip ia64_msi_chip;#ifdef CONFIG_SMP -static void ia64_set_msi_irq_affinity (unsigned int irq, +static int ia64_set_msi_irq_affinity (unsigned int irq,const cpumask_t *cpu_mask) {struct msi_msg msg;
@@ -20,10 +20,10 @@ static void ia64_set_msi_irq_affinity(unint cpu =first_cpu (*cpu_mask);if (!cpu_online (cpu)) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ;read_msi_msg (irq, &msg);
@@ -39,6 +39,8 @@ static void ia64_set_msi_irq_affinity(unwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity,cpumask_of (cpu)); + + return 0; }#endif /* CONFIG_SMP */
@@ -130,17 +132,17 @@ void arch_teardown_msi_irq(unsigned int #ifdef CONFIG_DMAR #ifdef CONFIG_SMP -static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) +static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) { struct irq_cfg *cfg = irq_cfg + irq; struct msi_msg msg; int cpu = cpumask_first(mask); if (!cpu_online(cpu)) - return; + return -1; if (irq_prepare_move(irq, cpu)) - return; + return -1; dmar_msi_read(irq, &msg);
@@ -151,6 +153,8 @@ static void dmar_msi_set_affinity(unsigndmar_msi_write (irq, &msg);cpumask_copy (irq_desc[irq].affinity, mask); + + return 0; }#endif /* CONFIG_SMP */
arch/ia64/sn/kernel/irq.c +3 -1
@@ -227,7 +227,7 @@ finish_up:return new_irq_info; } -static void sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) +static int sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) {struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;nasid_t nasid;
@@ -239,6 +239,8 @@ static void sn_set_affinity_irq(unsignedlist_for_each_entry_safe (sn_irq_info, sn_irq_info_safe, sn_irq_lh[irq], list) (void )sn_retarget_vector (sn_irq_info, nasid, slice); + +return 0 ; }#ifdef CONFIG_SMP
arch/ia64/sn/kernel/msi_sn.c +5 -3
@@ -151,7 +151,7 @@ int sn_setup_msi_irq(struct pci_dev *pde }#ifdef CONFIG_SMP -static void sn_set_msi_irq_affinity (unsigned int irq, +static int sn_set_msi_irq_affinity (unsigned int irq,const struct cpumask *cpu_mask) {struct msi_msg msg;
@@ -168,7 +168,7 @@ static void sn_set_msi_irq_affinity(unsi cpu =cpumask_first (cpu_mask); sn_irq_info = sn_msi_info[irq].sn_irq_info;if (sn_irq_info ==NULL || sn_irq_info->irq_int_bit >=0 ) -return ; +return -1 ;/* * Release XIO resources for the old MSI PCI address
@@ -189,7 +189,7 @@ static void sn_set_msi_irq_affinity(unsi new_irq_info =sn_retarget_vector (sn_irq_info, nasid, slice); sn_msi_info[irq].sn_irq_info = new_irq_info;if (new_irq_info ==NULL ) -return ; +return -1 ;/* * Map the xio address into bus space
@@ -206,6 +206,8 @@ static void sn_set_msi_irq_affinity(unsiwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity, cpu_mask); + + return 0; }#endif /* CONFIG_SMP */
arch/mips/cavium-octeon/octeon-irq.c +6 -2
@@ -177,7 +177,7 @@ static void octeon_irq_ciu0_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WORKQ0 ;/* Bit 0-63 of EN0 */
@@ -199,6 +199,8 @@ static void octeon_irq_ciu0_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN0 (cvmx_get_core_num () *2 ));write_unlock (&octeon_irq_ciu0_rwlock); + + return 0; }#endif
@@ -292,7 +294,7 @@ static void octeon_irq_ciu1_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WDOG0 ;/* Bit 0-63 of EN1 */
@@ -315,6 +317,8 @@ static void octeon_irq_ciu1_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN1 (cvmx_get_core_num () *2 +1 ));write_unlock (&octeon_irq_ciu1_rwlock); + + return 0; }#endif
arch/mips/kernel/irq-gic.c +3 -2
@@ -155,7 +155,7 @@ static void gic_unmask_irq(unsigned intstatic DEFINE_SPINLOCK (gic_lock); -static void gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +static int gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {cpumask_t tmp =CPU_MASK_NONE ;unsigned long flags;
@@ -166,7 +166,7 @@ static void gic_set_affinity(unsigned incpumask_and (&tmp, cpumask, cpu_online_mask);if (cpus_empty (tmp)) -return ; +return -1 ;/* Assumption : cpumask refers to a single CPU */ spin_lock_irqsave (&gic_lock, flags);
@@ -190,6 +190,7 @@ static void gic_set_affinity(unsigned incpumask_copy (irq_desc[irq].affinity, cpumask);spin_unlock_irqrestore (&gic_lock, flags); + return 0; }#endif
arch/mips/sibyte/bcm1480/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsignedstatic void disable_bcm1480_irq (unsigned int irq);static void ack_bcm1480_irq (unsigned int irq);#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask); +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_PCI
@@ -109,7 +109,7 @@ void bcm1480_unmask_irq(int cpu, int irq }#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on, k;u64 cur_ints;
@@ -119,7 +119,7 @@ static void bcm1480_set_affinity(unsigneif (cpumask_weight (mask) !=1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; } i =cpumask_first (mask);
@@ -155,6 +155,8 @@ static void bcm1480_set_affinity(unsigne }spin_unlock (&bcm1480_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/mips/sibyte/sb1250/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_sb1250_irq(unsigned istatic void disable_sb1250_irq (unsigned int irq);static void ack_sb1250_irq (unsigned int irq);#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask); +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_SIBYTE_HAS_LDT
@@ -103,7 +103,7 @@ void sb1250_unmask_irq(int cpu, int irq) }#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on;u64 cur_ints;
@@ -114,7 +114,7 @@ static void sb1250_set_affinity(unsignedif (cpumask_weight (mask) >1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; }/* Convert logical CPU to physical CPU */
@@ -146,6 +146,8 @@ static void sb1250_set_affinity(unsigned }spin_unlock (&sb1250_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/parisc/kernel/irq.c +4 -2
@@ -130,15 +130,17 @@ int cpu_check_affinity(unsigned int irq, return cpu_dest; } -static void cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) +static int cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {int cpu_dest; cpu_dest =cpu_check_affinity (irq, dest);if (cpu_dest <0 ) -return ; +return -1 ;cpumask_copy (&irq_desc[irq].affinity, dest); + +return 0 ; }#endif
arch/powerpc/platforms/pseries/xics.c +7 -5
@@ -333,7 +333,7 @@ static void xics_eoi_lpar(unsigned int vlpar_xirr_info_set ((0xff <<24 ) | irq); } -static void xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) +static int xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) {unsigned int irq;int status;
@@ -342,14 +342,14 @@ static void xics_set_affinity(unsigned i irq = (unsigned int )irq_map[virq].hwirq;if (irq ==XICS_IPI || irq ==XICS_IRQ_SPURIOUS ) -return ; +return -1 ; status =rtas_call (ibm_get_xive,1 ,3 , xics_status, irq);if (status) {printk (KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; }/*
@@ -363,7 +363,7 @@ static void xics_set_affinity(unsigned iprintk (KERN_WARNING "%s: No online cpus in the mask %s for irq %d\n" , __func__, cpulist, virq); -return ; +return -1 ; } status = rtas_call(ibm_set_xive, 3, 1, NULL,
@@ -372,8 +372,10 @@ static void xics_set_affinity(unsigned iif (status) {printk (KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; } + +return 0 ; }static struct irq_chip xics_pic_direct = {
arch/powerpc/sysdev/mpic.c +3 -1
@@ -807,7 +807,7 @@ static void mpic_end_ipi(unsigned int ir#endif /* CONFIG_SMP */ -void mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +int mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {struct mpic *mpic =mpic_from_irq (irq);unsigned int src =mpic_irq_to_hw (irq);
@@ -824,6 +824,8 @@ void mpic_set_affinity(unsigned int irq,mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ),mpic_physmask (cpus_addr (tmp)[0 ])); } + +return 0 ; }static unsigned int mpic_type_to_vecpri (struct mpic *mpic,unsigned int type)
arch/sparc/kernel/irq_64.c +9 -3
@@ -318,10 +318,12 @@ static void sun4u_irq_enable(unsigned in } } -static void sun4u_set_affinity (unsigned int virt_irq, +static int sun4u_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {sun4u_irq_enable (virt_irq); + +return 0 ; }/* Don't do anything. The desc->status check for IRQ_DISABLED in
@@ -377,7 +379,7 @@ static void sun4v_irq_enable(unsigned in ino, err); } -static void sun4v_set_affinity (unsigned int virt_irq, +static int sun4v_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned int ino = virt_irq_table[virt_irq].dev_ino;
@@ -388,6 +390,8 @@ static void sun4v_set_affinity(unsignedif (err !=HV_EOK )printk (KERN_ERR "sun4v_intr_settarget(%x,%lu): " "err(%d)\n" , ino, cpuid, err); + +return 0 ; }static void sun4v_irq_disable (unsigned int virt_irq)
@@ -445,7 +449,7 @@ static void sun4v_virq_enable(unsigned i dev_handle, dev_ino, err); } -static void sun4v_virt_set_affinity (unsigned int virt_irq, +static int sun4v_virt_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned long cpuid, dev_handle, dev_ino;
@@ -461,6 +465,8 @@ static void sun4v_virt_set_affinity(unsiprintk (KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " "err(%d)\n" , dev_handle, dev_ino, cpuid, err); + +return 0 ; }static void sun4v_virq_disable (unsigned int virt_irq)
arch/x86/kernel/apic/io_apic.c +41 -23
225 lines not on this page · raw message
drivers/parisc/iosapic.c +4 -2
@@ -702,7 +702,7 @@ static unsigned int iosapic_startup_irq( }#ifdef CONFIG_SMP -static void iosapic_set_affinity_irq (unsigned int irq, +static int iosapic_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {struct vector_info *vi =iosapic_get_vector (irq);
@@ -712,7 +712,7 @@ static void iosapic_set_affinity_irq(uns dest_cpu =cpu_check_affinity (irq, dest);if (dest_cpu <0 ) -return ; +return -1 ;cpumask_copy (irq_desc[irq].affinity,cpumask_of (dest_cpu)); vi->txn_addr =txn_affinity_addr (irq, dest_cpu);
@@ -724,6 +724,8 @@ static void iosapic_set_affinity_irq(unsiosapic_set_irt_data (vi, &dummy_d0, &d1);iosapic_wr_irt_entry (vi, d0, d1);spin_unlock_irqrestore (&iosapic_lock, flags); + + return 0; }#endif
drivers/xen/events.c +7 -5
@@ -694,13 +694,13 @@ void rebind_evtchn_irq(int evtchn, int i }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -static void rebind_irq_to_cpu (unsigned irq,unsigned tcpu) +static int rebind_irq_to_cpu (unsigned irq,unsigned tcpu) {struct evtchn_bind_vcpu bind_vcpu;int evtchn =evtchn_from_irq (irq);if (!VALID_EVTCHN (evtchn)) -return ; +return -1 ;/* Send future instances of this interrupt to other vcpu. */ bind_vcpu.port = evtchn;
@@ -713,13 +713,15 @@ static void rebind_irq_to_cpu(unsigned i*/ if (HYPERVISOR_event_channel_op (EVTCHNOP_bind_vcpu, &bind_vcpu) >=0 )bind_evtchn_to_cpu (evtchn, tcpu); -} +return 0 ; +} -static void set_affinity_irq (unsigned irq,const struct cpumask *dest) +static int set_affinity_irq (unsigned irq,const struct cpumask *dest) {unsigned tcpu =cpumask_first (dest); -rebind_irq_to_cpu (irq, tcpu); + +return rebind_irq_to_cpu (irq, tcpu); }int resend_irq_on_evtchn (unsigned int irq)
include/linux/irq.h +1 -1
@@ -117,7 +117,7 @@ struct irq_chip {void (*eoi)(unsigned int irq);void (*end)(unsigned int irq); -void (*set_affinity)(unsigned int irq, +int (*set_affinity)(unsigned int irq,const struct cpumask *dest);int (*retrigger)(unsigned int irq);int (*set_type)(unsigned int irq,unsigned int flow_type);
arch/mips/include/asm/irq.h +1 -1
@@ -49,7 +49,7 @@ static inline void smtc_im_ack_irq(unsig#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF #include <linux/cpumask.h> -extern void plat_set_irq_affinity (unsigned int irq, +extern int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity);extern void smtc_forward_irq (unsigned int irq);
arch/mips/mti-malta/malta-smtc.c +3 -1
@@ -114,7 +114,7 @@ struct plat_smp_ops msmtc_smp_ops = {*/ -void plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) +int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {cpumask_t tmask;int cpu =0 ;
@@ -156,5 +156,7 @@ void plat_set_irq_affinity(unsigned int/* Do any generic SMTC IRQ affinity setup */ smtc_set_irq_affinity (irq, tmask); + + return 0; }#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
PATCH 3/9 irq: make set_affinity to return status -v2
Impact: prepare to use it to keep affinity consistent
according to Ingo, change set_affinity() in irq_chip to return int.
v2: fix two typo
--- arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 +- arch/arm/common/gic.c | 4 +- arch/cris/arch-v32/kernel/irq.c | 4 +- arch/ia64/hp/sim/hpsim_irq.c | 3 + arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 +- arch/ia64/sn/kernel/msi_sn.c | 8 ++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 - arch/mips/kernel/irq-gic.c | 5 +- arch/mips/mti-malta/malta-smtc.c | 4 +- arch/mips/sibyte/bcm1480/irq.c | 8 ++-- arch/mips/sibyte/sb1250/irq.c | 8 ++-- arch/parisc/kernel/irq.c | 6 ++- arch/powerpc/platforms/pseries/xics.c | 12 +++--- arch/powerpc/sysdev/mpic.c | 4 +- arch/sparc/kernel/irq_64.c | 12 ++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------- drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 +++--- include/linux/irq.h | 2 - 23 files changed, 140 insertions(+), 74 deletions(-)
arch/alpha/kernel/sys_dp264.c +6 -2
@@ -176,22 +176,26 @@ cpu_set_irq_affinity(unsigned int irq, c } } -static void +static int dp264_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq, *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; } -static void +static int clipper_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq -16 , *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; }static struct hw_interrupt_type dp264_irq_type = {
arch/alpha/kernel/sys_titan.c +3 -1
@@ -157,13 +157,15 @@ titan_cpu_set_irq_affinity(unsigned int } -static void +static int titan_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&titan_irq_lock);titan_cpu_set_irq_affinity (irq -16 , *affinity);titan_update_irq_hw (titan_cached_irq_mask);spin_unlock (&titan_irq_lock); + +return 0 ; } static void
arch/arm/common/gic.c +3 -1
@@ -109,7 +109,7 @@ static void gic_unmask_irq(unsigned int }#ifdef CONFIG_SMP -static void gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) +static int gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) {void __iomem *reg =gic_dist_base (irq) +GIC_DIST_TARGET + (gic_irq (irq) & ~3 );unsigned int shift = (irq %4 ) *8 ;
@@ -122,6 +122,8 @@ static void gic_set_cpu(unsigned int irq val |=1 << (cpu + shift);writel (val, reg);spin_unlock (&irq_controller_lock); + + return 0; }#endif
arch/cris/arch-v32/kernel/irq.c +3 -1
@@ -325,12 +325,14 @@ static void end_crisv32_irq(unsigned int { } -void set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) +int set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) {unsigned long flags;spin_lock_irqsave (&irq_lock, flags); irq_allocations[irq -FIRST_IRQ ].mask = *dest;spin_unlock_irqrestore (&irq_lock, flags); + +return 0 ; }static struct irq_chip crisv32_irq_type = {
arch/ia64/hp/sim/hpsim_irq.c +2 -1
@@ -21,9 +21,10 @@ hpsim_irq_noop (unsigned int irq) { } -static void +static int hpsim_set_affinity_noop (unsigned int a,const struct cpumask *b) { +return 0 ; }static struct hw_interrupt_type irq_type_hp_sim = {
arch/ia64/kernel/iosapic.c +6 -4
@@ -329,7 +329,7 @@ unmask_irq (unsigned int irq) } -static void +static int iosapic_set_affinity (unsigned int irq,const struct cpumask *mask) {#ifdef CONFIG_SMP
@@ -343,15 +343,15 @@ iosapic_set_affinity(unsigned int irq, c cpu =cpumask_first_and (cpu_online_mask, mask);if (cpu >= nr_cpu_ids) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ; dest =cpu_physical_id (cpu);if (!iosapic_intr_info[irq].count) -return ;/* not an IOSAPIC interrupt */ +return -1 ;/* not an IOSAPIC interrupt */ set_irq_affinity_info (irq, dest, redir);
@@ -376,7 +376,9 @@ iosapic_set_affinity(unsigned int irq, ciosapic_write (iosapic,IOSAPIC_RTE_HIGH (rte_index), high32); iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32); } +#endif +return 0 ; }/*
arch/ia64/kernel/msi_ia64.c +10 -6
@@ -12,7 +12,7 @@static struct irq_chip ia64_msi_chip;#ifdef CONFIG_SMP -static void ia64_set_msi_irq_affinity (unsigned int irq, +static int ia64_set_msi_irq_affinity (unsigned int irq,const cpumask_t *cpu_mask) {struct msi_msg msg;
@@ -20,10 +20,10 @@ static void ia64_set_msi_irq_affinity(unint cpu =first_cpu (*cpu_mask);if (!cpu_online (cpu)) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ;read_msi_msg (irq, &msg);
@@ -39,6 +39,8 @@ static void ia64_set_msi_irq_affinity(unwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity,cpumask_of (cpu)); + + return 0; }#endif /* CONFIG_SMP */
@@ -130,17 +132,17 @@ void arch_teardown_msi_irq(unsigned int #ifdef CONFIG_DMAR #ifdef CONFIG_SMP -static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) +static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) { struct irq_cfg *cfg = irq_cfg + irq; struct msi_msg msg; int cpu = cpumask_first(mask); if (!cpu_online(cpu)) - return; + return -1; if (irq_prepare_move(irq, cpu)) - return; + return -1; dmar_msi_read(irq, &msg);
@@ -151,6 +153,8 @@ static void dmar_msi_set_affinity(unsigndmar_msi_write (irq, &msg);cpumask_copy (irq_desc[irq].affinity, mask); + + return 0; }#endif /* CONFIG_SMP */
arch/ia64/sn/kernel/irq.c +3 -1
@@ -227,7 +227,7 @@ finish_up:return new_irq_info; } -static void sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) +static int sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) {struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;nasid_t nasid;
@@ -239,6 +239,8 @@ static void sn_set_affinity_irq(unsignedlist_for_each_entry_safe (sn_irq_info, sn_irq_info_safe, sn_irq_lh[irq], list) (void )sn_retarget_vector (sn_irq_info, nasid, slice); + +return 0 ; }#ifdef CONFIG_SMP
arch/ia64/sn/kernel/msi_sn.c +5 -3
@@ -151,7 +151,7 @@ int sn_setup_msi_irq(struct pci_dev *pde }#ifdef CONFIG_SMP -static void sn_set_msi_irq_affinity (unsigned int irq, +static int sn_set_msi_irq_affinity (unsigned int irq,const struct cpumask *cpu_mask) {struct msi_msg msg;
@@ -168,7 +168,7 @@ static void sn_set_msi_irq_affinity(unsi cpu =cpumask_first (cpu_mask); sn_irq_info = sn_msi_info[irq].sn_irq_info;if (sn_irq_info ==NULL || sn_irq_info->irq_int_bit >=0 ) -return ; +return -1 ;/* * Release XIO resources for the old MSI PCI address
@@ -189,7 +189,7 @@ static void sn_set_msi_irq_affinity(unsi new_irq_info =sn_retarget_vector (sn_irq_info, nasid, slice); sn_msi_info[irq].sn_irq_info = new_irq_info;if (new_irq_info ==NULL ) -return ; +return -1 ;/* * Map the xio address into bus space
@@ -206,6 +206,8 @@ static void sn_set_msi_irq_affinity(unsiwrite_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity, cpu_mask); + + return 0; }#endif /* CONFIG_SMP */
arch/mips/cavium-octeon/octeon-irq.c +6 -2
@@ -177,7 +177,7 @@ static void octeon_irq_ciu0_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WORKQ0 ;/* Bit 0-63 of EN0 */
@@ -199,6 +199,8 @@ static void octeon_irq_ciu0_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN0 (cvmx_get_core_num () *2 ));write_unlock (&octeon_irq_ciu0_rwlock); + + return 0; }#endif
@@ -292,7 +294,7 @@ static void octeon_irq_ciu1_disable(unsi }#ifdef CONFIG_SMP -static void octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WDOG0 ;/* Bit 0-63 of EN1 */
@@ -315,6 +317,8 @@ static void octeon_irq_ciu1_set_affinity*/ cvmx_read_csr (CVMX_CIU_INTX_EN1 (cvmx_get_core_num () *2 +1 ));write_unlock (&octeon_irq_ciu1_rwlock); + + return 0; }#endif
arch/mips/kernel/irq-gic.c +3 -2
@@ -155,7 +155,7 @@ static void gic_unmask_irq(unsigned intstatic DEFINE_SPINLOCK (gic_lock); -static void gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +static int gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {cpumask_t tmp =CPU_MASK_NONE ;unsigned long flags;
@@ -166,7 +166,7 @@ static void gic_set_affinity(unsigned incpumask_and (&tmp, cpumask, cpu_online_mask);if (cpus_empty (tmp)) -return ; +return -1 ;/* Assumption : cpumask refers to a single CPU */ spin_lock_irqsave (&gic_lock, flags);
@@ -190,6 +190,7 @@ static void gic_set_affinity(unsigned incpumask_copy (irq_desc[irq].affinity, cpumask);spin_unlock_irqrestore (&gic_lock, flags); + return 0; }#endif
arch/mips/sibyte/bcm1480/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsignedstatic void disable_bcm1480_irq (unsigned int irq);static void ack_bcm1480_irq (unsigned int irq);#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask); +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_PCI
@@ -109,7 +109,7 @@ void bcm1480_unmask_irq(int cpu, int irq }#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on, k;u64 cur_ints;
@@ -119,7 +119,7 @@ static void bcm1480_set_affinity(unsigneif (cpumask_weight (mask) !=1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; } i =cpumask_first (mask);
@@ -155,6 +155,8 @@ static void bcm1480_set_affinity(unsigne }spin_unlock (&bcm1480_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/mips/sibyte/sb1250/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_sb1250_irq(unsigned istatic void disable_sb1250_irq (unsigned int irq);static void ack_sb1250_irq (unsigned int irq);#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask); +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_SIBYTE_HAS_LDT
@@ -103,7 +103,7 @@ void sb1250_unmask_irq(int cpu, int irq) }#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on;u64 cur_ints;
@@ -114,7 +114,7 @@ static void sb1250_set_affinity(unsignedif (cpumask_weight (mask) >1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; }/* Convert logical CPU to physical CPU */
@@ -146,6 +146,8 @@ static void sb1250_set_affinity(unsigned }spin_unlock (&sb1250_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/parisc/kernel/irq.c +4 -2
@@ -130,15 +130,17 @@ int cpu_check_affinity(unsigned int irq, return cpu_dest; } -static void cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) +static int cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {int cpu_dest; cpu_dest =cpu_check_affinity (irq, dest);if (cpu_dest <0 ) -return ; +return -1 ;cpumask_copy (&irq_desc[irq].affinity, dest); + +return 0 ; }#endif
arch/powerpc/platforms/pseries/xics.c +7 -5
@@ -333,7 +333,7 @@ static void xics_eoi_lpar(unsigned int vlpar_xirr_info_set ((0xff <<24 ) | irq); } -static void xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) +static int xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) {unsigned int irq;int status;
@@ -342,14 +342,14 @@ static void xics_set_affinity(unsigned i irq = (unsigned int )irq_map[virq].hwirq;if (irq ==XICS_IPI || irq ==XICS_IRQ_SPURIOUS ) -return ; +return -1 ; status =rtas_call (ibm_get_xive,1 ,3 , xics_status, irq);if (status) {printk (KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; }/*
@@ -363,7 +363,7 @@ static void xics_set_affinity(unsigned iprintk (KERN_WARNING "%s: No online cpus in the mask %s for irq %d\n" , __func__, cpulist, virq); -return ; +return -1 ; } status = rtas_call(ibm_set_xive, 3, 1, NULL,
@@ -372,8 +372,10 @@ static void xics_set_affinity(unsigned iif (status) {printk (KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; } + +return 0 ; }static struct irq_chip xics_pic_direct = {
arch/powerpc/sysdev/mpic.c +3 -1
@@ -807,7 +807,7 @@ static void mpic_end_ipi(unsigned int ir#endif /* CONFIG_SMP */ -void mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +int mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {struct mpic *mpic =mpic_from_irq (irq);unsigned int src =mpic_irq_to_hw (irq);
@@ -824,6 +824,8 @@ void mpic_set_affinity(unsigned int irq,mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ),mpic_physmask (cpus_addr (tmp)[0 ])); } + +return 0 ; }static unsigned int mpic_type_to_vecpri (struct mpic *mpic,unsigned int type)
arch/sparc/kernel/irq_64.c +9 -3
@@ -318,10 +318,12 @@ static void sun4u_irq_enable(unsigned in } } -static void sun4u_set_affinity (unsigned int virt_irq, +static int sun4u_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {sun4u_irq_enable (virt_irq); + +return 0 ; }/* Don't do anything. The desc->status check for IRQ_DISABLED in
@@ -377,7 +379,7 @@ static void sun4v_irq_enable(unsigned in ino, err); } -static void sun4v_set_affinity (unsigned int virt_irq, +static int sun4v_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned int ino = virt_irq_table[virt_irq].dev_ino;
@@ -388,6 +390,8 @@ static void sun4v_set_affinity(unsignedif (err !=HV_EOK )printk (KERN_ERR "sun4v_intr_settarget(%x,%lu): " "err(%d)\n" , ino, cpuid, err); + +return 0 ; }static void sun4v_irq_disable (unsigned int virt_irq)
@@ -445,7 +449,7 @@ static void sun4v_virq_enable(unsigned i dev_handle, dev_ino, err); } -static void sun4v_virt_set_affinity (unsigned int virt_irq, +static int sun4v_virt_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned long cpuid, dev_handle, dev_ino;
@@ -461,6 +465,8 @@ static void sun4v_virt_set_affinity(unsiprintk (KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " "err(%d)\n" , dev_handle, dev_ino, cpuid, err); + +return 0 ; }static void sun4v_virq_disable (unsigned int virt_irq)
arch/x86/kernel/apic/io_apic.c +41 -23
225 lines not on this page · raw message
drivers/parisc/iosapic.c +4 -2
@@ -702,7 +702,7 @@ static unsigned int iosapic_startup_irq( }#ifdef CONFIG_SMP -static void iosapic_set_affinity_irq (unsigned int irq, +static int iosapic_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {struct vector_info *vi =iosapic_get_vector (irq);
@@ -712,7 +712,7 @@ static void iosapic_set_affinity_irq(uns dest_cpu =cpu_check_affinity (irq, dest);if (dest_cpu <0 ) -return ; +return -1 ;cpumask_copy (irq_desc[irq].affinity,cpumask_of (dest_cpu)); vi->txn_addr =txn_affinity_addr (irq, dest_cpu);
@@ -724,6 +724,8 @@ static void iosapic_set_affinity_irq(unsiosapic_set_irt_data (vi, &dummy_d0, &d1);iosapic_wr_irt_entry (vi, d0, d1);spin_unlock_irqrestore (&iosapic_lock, flags); + + return 0; }#endif
drivers/xen/events.c +7 -5
@@ -694,13 +694,13 @@ void rebind_evtchn_irq(int evtchn, int i }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -static void rebind_irq_to_cpu (unsigned irq,unsigned tcpu) +static int rebind_irq_to_cpu (unsigned irq,unsigned tcpu) {struct evtchn_bind_vcpu bind_vcpu;int evtchn =evtchn_from_irq (irq);if (!VALID_EVTCHN (evtchn)) -return ; +return -1 ;/* Send future instances of this interrupt to other vcpu. */ bind_vcpu.port = evtchn;
@@ -713,13 +713,15 @@ static void rebind_irq_to_cpu(unsigned i*/ if (HYPERVISOR_event_channel_op (EVTCHNOP_bind_vcpu, &bind_vcpu) >=0 )bind_evtchn_to_cpu (evtchn, tcpu); -} +return 0 ; +} -static void set_affinity_irq (unsigned irq,const struct cpumask *dest) +static int set_affinity_irq (unsigned irq,const struct cpumask *dest) {unsigned tcpu =cpumask_first (dest); -rebind_irq_to_cpu (irq, tcpu); + +return rebind_irq_to_cpu (irq, tcpu); }int resend_irq_on_evtchn (unsigned int irq)
include/linux/irq.h +1 -1
@@ -117,7 +117,7 @@ struct irq_chip {void (*eoi)(unsigned int irq);void (*end)(unsigned int irq); -void (*set_affinity)(unsigned int irq, +int (*set_affinity)(unsigned int irq,const struct cpumask *dest);int (*retrigger)(unsigned int irq);int (*set_type)(unsigned int irq,unsigned int flow_type);
arch/mips/include/asm/irq.h +1 -1
@@ -49,7 +49,7 @@ static inline void smtc_im_ack_irq(unsig#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF #include <linux/cpumask.h> -extern void plat_set_irq_affinity (unsigned int irq, +extern int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity);extern void smtc_forward_irq (unsigned int irq);
arch/mips/mti-malta/malta-smtc.c +3 -1
@@ -114,7 +114,7 @@ struct plat_smp_ops msmtc_smp_ops = {*/ -void plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) +int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {cpumask_t tmask;int cpu =0 ;
@@ -156,5 +156,7 @@ void plat_set_irq_affinity(unsigned int/* Do any generic SMTC IRQ affinity setup */ smtc_set_irq_affinity (irq, tmask); + + return 0; }#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
[tip:irq/numa] irq: change ->set_affinity() to return status
Commit-ID: d5dedd4507d307eb3f35f21b6e16f336fdc0d82a Gitweb: http://git.kernel.org/tip/d5dedd4507d307eb3f35f21b6e16f336fdc0d82a Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 17:59:21 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:16 +0200
irq: change ->set_affinity() to return status
according to Ingo, change set_affinity() in irq_chip should return int, because that way we can handle failure cases in a much cleaner way, in the genirq layer.
v2: fix two typos
[ Impact: extend API ]
LKML-Reference: <[email protected]>
--- arch/alpha/kernel/sys_dp264.c | 8 +++- arch/alpha/kernel/sys_titan.c | 4 ++- arch/arm/common/gic.c | 4 ++- arch/cris/arch-v32/kernel/irq.c | 4 ++- arch/ia64/hp/sim/hpsim_irq.c | 3 +- arch/ia64/kernel/iosapic.c | 10 +++-- arch/ia64/kernel/msi_ia64.c | 16 +++++--- arch/ia64/sn/kernel/irq.c | 4 ++- arch/ia64/sn/kernel/msi_sn.c | 8 +++-- arch/mips/cavium-octeon/octeon-irq.c | 8 +++- arch/mips/include/asm/irq.h | 2 +- arch/mips/kernel/irq-gic.c | 5 ++- arch/mips/mti-malta/malta-smtc.c | 4 ++- arch/mips/sibyte/bcm1480/irq.c | 8 +++-- arch/mips/sibyte/sb1250/irq.c | 8 +++-- arch/parisc/kernel/irq.c | 6 ++- arch/powerpc/platforms/pseries/xics.c | 12 ++++--- arch/powerpc/sysdev/mpic.c | 4 ++- arch/sparc/kernel/irq_64.c | 12 +++++-- arch/x86/kernel/apic/io_apic.c | 64 +++++++++++++++++++++------------ drivers/parisc/iosapic.c | 6 ++- drivers/xen/events.c | 12 ++++--- include/linux/irq.h | 2 +- 23 files changed, 140 insertions(+), 74 deletions(-)
arch/alpha/kernel/sys_dp264.c +6 -2
@@ -176,22 +176,26 @@ cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) } } -static void +static int dp264_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq, *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; } -static void +static int clipper_set_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&dp264_irq_lock);cpu_set_irq_affinity (irq -16 , *affinity);tsunami_update_irq_hw (cached_irq_mask);spin_unlock (&dp264_irq_lock); + +return 0 ; }static struct hw_interrupt_type dp264_irq_type = {
arch/alpha/kernel/sys_titan.c +3 -1
@@ -157,13 +157,15 @@ titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) } -static void +static int titan_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {spin_lock (&titan_irq_lock);titan_cpu_set_irq_affinity (irq -16 , *affinity);titan_update_irq_hw (titan_cached_irq_mask);spin_unlock (&titan_irq_lock); + +return 0 ; } static void
arch/arm/common/gic.c +3 -1
@@ -109,7 +109,7 @@ static void gic_unmask_irq(unsigned int irq) }#ifdef CONFIG_SMP -static void gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) +static int gic_set_cpu (unsigned int irq,const struct cpumask *mask_val) {void __iomem *reg =gic_dist_base (irq) +GIC_DIST_TARGET + (gic_irq (irq) & ~3 );unsigned int shift = (irq %4 ) *8 ;
@@ -122,6 +122,8 @@ static void gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) val |=1 << (cpu + shift);writel (val, reg);spin_unlock (&irq_controller_lock); + + return 0; }#endif
arch/cris/arch-v32/kernel/irq.c +3 -1
@@ -325,12 +325,14 @@ static void end_crisv32_irq(unsigned int irq) { } -void set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) +int set_affinity_crisv32_irq (unsigned int irq,const struct cpumask *dest) {unsigned long flags;spin_lock_irqsave (&irq_lock, flags); irq_allocations[irq -FIRST_IRQ ].mask = *dest;spin_unlock_irqrestore (&irq_lock, flags); + +return 0 ; }static struct irq_chip crisv32_irq_type = {
arch/ia64/hp/sim/hpsim_irq.c +2 -1
@@ -21,9 +21,10 @@ hpsim_irq_noop (unsigned int irq) { } -static void +static int hpsim_set_affinity_noop (unsigned int a,const struct cpumask *b) { +return 0 ; }static struct hw_interrupt_type irq_type_hp_sim = {
arch/ia64/kernel/iosapic.c +6 -4
@@ -329,7 +329,7 @@ unmask_irq (unsigned int irq) } -static void +static int iosapic_set_affinity (unsigned int irq,const struct cpumask *mask) {#ifdef CONFIG_SMP
@@ -343,15 +343,15 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask) cpu =cpumask_first_and (cpu_online_mask, mask);if (cpu >= nr_cpu_ids) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ; dest =cpu_physical_id (cpu);if (!iosapic_intr_info[irq].count) -return ;/* not an IOSAPIC interrupt */ +return -1 ;/* not an IOSAPIC interrupt */ set_irq_affinity_info (irq, dest, redir);
@@ -376,7 +376,9 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)iosapic_write (iosapic,IOSAPIC_RTE_HIGH (rte_index), high32); iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32); } +#endif +return 0 ; }/*
arch/ia64/kernel/msi_ia64.c +10 -6
@@ -12,7 +12,7 @@static struct irq_chip ia64_msi_chip;#ifdef CONFIG_SMP -static void ia64_set_msi_irq_affinity (unsigned int irq, +static int ia64_set_msi_irq_affinity (unsigned int irq,const cpumask_t *cpu_mask) {struct msi_msg msg;
@@ -20,10 +20,10 @@ static void ia64_set_msi_irq_affinity(unsigned int irq,int cpu =first_cpu (*cpu_mask);if (!cpu_online (cpu)) -return ; +return -1 ;if (irq_prepare_move (irq, cpu)) -return ; +return -1 ;read_msi_msg (irq, &msg);
@@ -39,6 +39,8 @@ static void ia64_set_msi_irq_affinity(unsigned int irq,write_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity,cpumask_of (cpu)); + + return 0; }#endif /* CONFIG_SMP */
@@ -130,17 +132,17 @@ void arch_teardown_msi_irq(unsigned int irq) #ifdef CONFIG_DMAR #ifdef CONFIG_SMP -static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) +static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) { struct irq_cfg *cfg = irq_cfg + irq; struct msi_msg msg; int cpu = cpumask_first(mask); if (!cpu_online(cpu)) - return; + return -1; if (irq_prepare_move(irq, cpu)) - return; + return -1; dmar_msi_read(irq, &msg);
@@ -151,6 +153,8 @@ static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)dmar_msi_write (irq, &msg);cpumask_copy (irq_desc[irq].affinity, mask); + + return 0; }#endif /* CONFIG_SMP */
arch/ia64/sn/kernel/irq.c +3 -1
@@ -227,7 +227,7 @@ finish_up:return new_irq_info; } -static void sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) +static int sn_set_affinity_irq (unsigned int irq,const struct cpumask *mask) {struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;nasid_t nasid;
@@ -239,6 +239,8 @@ static void sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)list_for_each_entry_safe (sn_irq_info, sn_irq_info_safe, sn_irq_lh[irq], list) (void )sn_retarget_vector (sn_irq_info, nasid, slice); + +return 0 ; }#ifdef CONFIG_SMP
arch/ia64/sn/kernel/msi_sn.c +5 -3
@@ -151,7 +151,7 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry) }#ifdef CONFIG_SMP -static void sn_set_msi_irq_affinity (unsigned int irq, +static int sn_set_msi_irq_affinity (unsigned int irq,const struct cpumask *cpu_mask) {struct msi_msg msg;
@@ -168,7 +168,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, cpu =cpumask_first (cpu_mask); sn_irq_info = sn_msi_info[irq].sn_irq_info;if (sn_irq_info ==NULL || sn_irq_info->irq_int_bit >=0 ) -return ; +return -1 ;/* * Release XIO resources for the old MSI PCI address
@@ -189,7 +189,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq, new_irq_info =sn_retarget_vector (sn_irq_info, nasid, slice); sn_msi_info[irq].sn_irq_info = new_irq_info;if (new_irq_info ==NULL ) -return ; +return -1 ;/* * Map the xio address into bus space
@@ -206,6 +206,8 @@ static void sn_set_msi_irq_affinity(unsigned int irq,write_msi_msg (irq, &msg);cpumask_copy (irq_desc[irq].affinity, cpu_mask); + + return 0; }#endif /* CONFIG_SMP */
arch/mips/cavium-octeon/octeon-irq.c +6 -2
@@ -177,7 +177,7 @@ static void octeon_irq_ciu0_disable(unsigned int irq) }#ifdef CONFIG_SMP -static void octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu0_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WORKQ0 ;/* Bit 0-63 of EN0 */
@@ -199,6 +199,8 @@ static void octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask*/ cvmx_read_csr (CVMX_CIU_INTX_EN0 (cvmx_get_core_num () *2 ));write_unlock (&octeon_irq_ciu0_rwlock); + + return 0; }#endif
@@ -292,7 +294,7 @@ static void octeon_irq_ciu1_disable(unsigned int irq) }#ifdef CONFIG_SMP -static void octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) +static int octeon_irq_ciu1_set_affinity (unsigned int irq,const struct cpumask *dest) {int cpu;int bit = irq -OCTEON_IRQ_WDOG0 ;/* Bit 0-63 of EN1 */
@@ -315,6 +317,8 @@ static void octeon_irq_ciu1_set_affinity(unsigned int irq, const struct cpumask*/ cvmx_read_csr (CVMX_CIU_INTX_EN1 (cvmx_get_core_num () *2 +1 ));write_unlock (&octeon_irq_ciu1_rwlock); + + return 0; }#endif
arch/mips/include/asm/irq.h +1 -1
@@ -49,7 +49,7 @@ static inline void smtc_im_ack_irq(unsigned int irq)#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF #include <linux/cpumask.h> -extern void plat_set_irq_affinity (unsigned int irq, +extern int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity);extern void smtc_forward_irq (unsigned int irq);
arch/mips/kernel/irq-gic.c +3 -2
@@ -155,7 +155,7 @@ static void gic_unmask_irq(unsigned int irq)static DEFINE_SPINLOCK (gic_lock); -static void gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +static int gic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {cpumask_t tmp =CPU_MASK_NONE ;unsigned long flags;
@@ -166,7 +166,7 @@ static void gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)cpumask_and (&tmp, cpumask, cpu_online_mask);if (cpus_empty (tmp)) -return ; +return -1 ;/* Assumption : cpumask refers to a single CPU */ spin_lock_irqsave (&gic_lock, flags);
@@ -190,6 +190,7 @@ static void gic_set_affinity(unsigned int irq, const struct cpumask *cpumask)cpumask_copy (irq_desc[irq].affinity, cpumask);spin_unlock_irqrestore (&gic_lock, flags); + return 0; }#endif
arch/mips/mti-malta/malta-smtc.c +3 -1
@@ -114,7 +114,7 @@ struct plat_smp_ops msmtc_smp_ops = {*/ -void plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) +int plat_set_irq_affinity (unsigned int irq,const struct cpumask *affinity) {cpumask_t tmask;int cpu =0 ;
@@ -156,5 +156,7 @@ void plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity)/* Do any generic SMTC IRQ affinity setup */ smtc_set_irq_affinity (irq, tmask); + + return 0; }#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
arch/mips/sibyte/bcm1480/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsigned int irq);static void disable_bcm1480_irq (unsigned int irq);static void ack_bcm1480_irq (unsigned int irq);#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask); +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_PCI
@@ -109,7 +109,7 @@ void bcm1480_unmask_irq(int cpu, int irq) }#ifdef CONFIG_SMP -static void bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) +static int bcm1480_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on, k;u64 cur_ints;
@@ -119,7 +119,7 @@ static void bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)if (cpumask_weight (mask) !=1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; } i =cpumask_first (mask);
@@ -155,6 +155,8 @@ static void bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask) }spin_unlock (&bcm1480_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/mips/sibyte/sb1250/irq.c +5 -3
@@ -50,7 +50,7 @@ static void enable_sb1250_irq(unsigned int irq);static void disable_sb1250_irq (unsigned int irq);static void ack_sb1250_irq (unsigned int irq);#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask); +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask);#endif #ifdef CONFIG_SIBYTE_HAS_LDT
@@ -103,7 +103,7 @@ void sb1250_unmask_irq(int cpu, int irq) }#ifdef CONFIG_SMP -static void sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) +static int sb1250_set_affinity (unsigned int irq,const struct cpumask *mask) {int i =0 , old_cpu, cpu, int_on;u64 cur_ints;
@@ -114,7 +114,7 @@ static void sb1250_set_affinity(unsigned int irq, const struct cpumask *mask)if (cpumask_weight (mask) >1 ) {printk ("attempted to set irq affinity for irq %d to multiple CPUs\n" , irq); -return ; +return -1 ; }/* Convert logical CPU to physical CPU */
@@ -146,6 +146,8 @@ static void sb1250_set_affinity(unsigned int irq, const struct cpumask *mask) }spin_unlock (&sb1250_imr_lock);spin_unlock_irqrestore (&desc->lock, flags); + +return 0 ; }#endif
arch/parisc/kernel/irq.c +4 -2
@@ -130,15 +130,17 @@ int cpu_check_affinity(unsigned int irq, const struct cpumask *dest) return cpu_dest; } -static void cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) +static int cpu_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {int cpu_dest; cpu_dest =cpu_check_affinity (irq, dest);if (cpu_dest <0 ) -return ; +return -1 ;cpumask_copy (&irq_desc[irq].affinity, dest); + +return 0 ; }#endif
arch/powerpc/platforms/pseries/xics.c +7 -5
@@ -333,7 +333,7 @@ static void xics_eoi_lpar(unsigned int virq)lpar_xirr_info_set ((0xff <<24 ) | irq); } -static void xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) +static int xics_set_affinity (unsigned int virq,const struct cpumask *cpumask) {unsigned int irq;int status;
@@ -342,14 +342,14 @@ static void xics_set_affinity(unsigned int virq, const struct cpumask *cpumask) irq = (unsigned int )irq_map[virq].hwirq;if (irq ==XICS_IPI || irq ==XICS_IRQ_SPURIOUS ) -return ; +return -1 ; status =rtas_call (ibm_get_xive,1 ,3 , xics_status, irq);if (status) {printk (KERN_ERR "%s: ibm,get-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; }/*
@@ -363,7 +363,7 @@ static void xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)printk (KERN_WARNING "%s: No online cpus in the mask %s for irq %d\n" , __func__, cpulist, virq); -return ; +return -1 ; } status = rtas_call(ibm_set_xive, 3, 1, NULL,
@@ -372,8 +372,10 @@ static void xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)if (status) {printk (KERN_ERR "%s: ibm,set-xive irq=%u returns %d\n" , __func__, irq, status); -return ; +return -1 ; } + +return 0 ; }static struct irq_chip xics_pic_direct = {
arch/powerpc/sysdev/mpic.c +3 -1
@@ -807,7 +807,7 @@ static void mpic_end_ipi(unsigned int irq)#endif /* CONFIG_SMP */ -void mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) +int mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask) {struct mpic *mpic =mpic_from_irq (irq);unsigned int src =mpic_irq_to_hw (irq);
@@ -824,6 +824,8 @@ void mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)mpic_irq_write (src,MPIC_INFO (IRQ_DESTINATION ),mpic_physmask (cpus_addr (tmp)[0 ])); } + +return 0 ; }static unsigned int mpic_type_to_vecpri (struct mpic *mpic,unsigned int type)
arch/sparc/kernel/irq_64.c +9 -3
@@ -318,10 +318,12 @@ static void sun4u_irq_enable(unsigned int virt_irq) } } -static void sun4u_set_affinity (unsigned int virt_irq, +static int sun4u_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {sun4u_irq_enable (virt_irq); + +return 0 ; }/* Don't do anything. The desc->status check for IRQ_DISABLED in
@@ -377,7 +379,7 @@ static void sun4v_irq_enable(unsigned int virt_irq) ino, err); } -static void sun4v_set_affinity (unsigned int virt_irq, +static int sun4v_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned int ino = virt_irq_table[virt_irq].dev_ino;
@@ -388,6 +390,8 @@ static void sun4v_set_affinity(unsigned int virt_irq,if (err !=HV_EOK )printk (KERN_ERR "sun4v_intr_settarget(%x,%lu): " "err(%d)\n" , ino, cpuid, err); + +return 0 ; }static void sun4v_irq_disable (unsigned int virt_irq)
@@ -445,7 +449,7 @@ static void sun4v_virq_enable(unsigned int virt_irq) dev_handle, dev_ino, err); } -static void sun4v_virt_set_affinity (unsigned int virt_irq, +static int sun4v_virt_set_affinity (unsigned int virt_irq,const struct cpumask *mask) {unsigned long cpuid, dev_handle, dev_ino;
@@ -461,6 +465,8 @@ static void sun4v_virt_set_affinity(unsigned int virt_irq,printk (KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " "err(%d)\n" , dev_handle, dev_ino, cpuid, err); + +return 0 ; }static void sun4v_virq_disable (unsigned int virt_irq)
arch/x86/kernel/apic/io_apic.c +41 -23
225 lines not on this page · raw message
drivers/parisc/iosapic.c +4 -2
@@ -702,7 +702,7 @@ static unsigned int iosapic_startup_irq(unsigned int irq) }#ifdef CONFIG_SMP -static void iosapic_set_affinity_irq (unsigned int irq, +static int iosapic_set_affinity_irq (unsigned int irq,const struct cpumask *dest) {struct vector_info *vi =iosapic_get_vector (irq);
@@ -712,7 +712,7 @@ static void iosapic_set_affinity_irq(unsigned int irq, dest_cpu =cpu_check_affinity (irq, dest);if (dest_cpu <0 ) -return ; +return -1 ;cpumask_copy (irq_desc[irq].affinity,cpumask_of (dest_cpu)); vi->txn_addr =txn_affinity_addr (irq, dest_cpu);
@@ -724,6 +724,8 @@ static void iosapic_set_affinity_irq(unsigned int irq,iosapic_set_irt_data (vi, &dummy_d0, &d1);iosapic_wr_irt_entry (vi, d0, d1);spin_unlock_irqrestore (&iosapic_lock, flags); + + return 0; }#endif
drivers/xen/events.c +7 -5
@@ -688,13 +688,13 @@ void rebind_evtchn_irq(int evtchn, int irq) }/* Rebind an evtchn so that it gets delivered to a specific cpu */ -static void rebind_irq_to_cpu (unsigned irq,unsigned tcpu) +static int rebind_irq_to_cpu (unsigned irq,unsigned tcpu) {struct evtchn_bind_vcpu bind_vcpu;int evtchn =evtchn_from_irq (irq);if (!VALID_EVTCHN (evtchn)) -return ; +return -1 ;/* Send future instances of this interrupt to other vcpu. */ bind_vcpu.port = evtchn;
@@ -707,13 +707,15 @@ static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)*/ if (HYPERVISOR_event_channel_op (EVTCHNOP_bind_vcpu, &bind_vcpu) >=0 )bind_evtchn_to_cpu (evtchn, tcpu); -} +return 0 ; +} -static void set_affinity_irq (unsigned irq,const struct cpumask *dest) +static int set_affinity_irq (unsigned irq,const struct cpumask *dest) {unsigned tcpu =cpumask_first (dest); -rebind_irq_to_cpu (irq, tcpu); + +return rebind_irq_to_cpu (irq, tcpu); }int resend_irq_on_evtchn (unsigned int irq)
include/linux/irq.h +1 -1
@@ -117,7 +117,7 @@ struct irq_chip {void (*eoi)(unsigned int irq);void (*end)(unsigned int irq); -void (*set_affinity)(unsigned int irq, +int (*set_affinity)(unsigned int irq,const struct cpumask *dest);int (*retrigger)(unsigned int irq);int (*set_type)(unsigned int irq,unsigned int flow_type);
[tip:irq/numa] irq: change ->set_affinity() to return status, fix
In reply to Yinghai LuCommit-ID: b2e5d8588de0b5341eddad87dbe48d2185eaa3dd Gitweb: http://git.kernel.org/tip/b2e5d8588de0b5341eddad87dbe48d2185eaa3dd Author: Ingo Molnar <[email protected]> AuthorDate: Wed, 6 May 2009 07:55:33 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 6 May 2009 07:55:33 +0200
irq: change ->set_affinity() to return status, fix
This build failure:
arch/powerpc/sysdev/mpic.c:810: error: conflicting types for 'mpic_set_affinity' arch/powerpc/sysdev/mpic.h:39: error: previous declaration of 'mpic_set_affinity' was here make[2]: *** [arch/powerpc/sysdev/mpic.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Triggers because the function prototype was not updated when the function call signature got changed by:
d5dedd4: irq: change ->set_affinity() to return status
[ Impact: build fix on powerpc ]
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Yinghai Lu <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
--- arch/powerpc/sysdev/mpic.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/sysdev/mpic.h +1 -1
@@ -36,6 +36,6 @@ static inline int mpic_pasemi_msi_init(struct mpic *mpic)extern int mpic_set_irq_type (unsigned int virq,unsigned int flow_type);extern void mpic_set_vector (unsigned int virq,unsigned int vector); -extern void mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask); +extern int mpic_set_affinity (unsigned int irq,const struct cpumask *cpumask);#endif /* _POWERPC_SYSDEV_MPIC_H */
PATCH 4/9 irq: only update affinity if set_affinity() sucessfully -v4
In reply to Yinghai LuImpact: don't change smp_affinity if set_affinity fail
irq_set_affinity() and move_masked_irq() try to assign affinity before calling chip set_affinity(). some archs are assigning again in set_affinity again.
something like:cpumask_cpy(desc->affinity, mask);desc->chip->set_affinity(mask);
in the failing path, affinity should not be touched.
So try update the afffinity only if set_affinity return wth 0 also call irq_set_thread_affinity accordingly
v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
v3: according to Ingo, change set_affinity() in irq_chip to return int.
v4: update comments by removing moving irq_desc code.
--- kernel/irq/internals.h | 3 +++ kernel/irq/manage.c | 17 +++++++++++------ kernel/irq/migration.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-)
kernel/irq/internals.h +3 -0
@@ -42,6 +42,9 @@ static inline void unregister_handler_prextern int irq_select_affinity_usr (unsigned int irq); +extern void +irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask); +/* * Debugging printout: */
kernel/irq/manage.c +11 -6
@@ -80,7 +80,7 @@ int irq_can_set_affinity(unsigned int irreturn 1 ; } -static void +void irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask) {struct irqaction *action = desc->action;
@@ -109,17 +109,22 @@ int irq_set_affinity(unsigned int irq, cspin_lock_irqsave (&desc->lock, flags);#ifdef CONFIG_GENERIC_PENDING_IRQ -if (desc->status &IRQ_MOVE_PCNTXT ) - desc->chip->set_affinity (irq, cpumask); +if (desc->status &IRQ_MOVE_PCNTXT ) { +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + } + }else { desc->status |=IRQ_MOVE_PENDING ;cpumask_copy (desc->pending_mask, cpumask); }#else -cpumask_copy (desc->affinity, cpumask); - desc->chip->set_affinity (irq, cpumask); +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + }#endif -irq_set_thread_affinity (desc, cpumask); desc->status |=IRQ_AFFINITY_SET ;spin_unlock_irqrestore (&desc->lock, flags);return 0 ;
kernel/irq/migration.c +9 -5
@@ -1,5 +1,8 @@#include <linux/irq.h> +#include <linux/interrupt.h> + +#include "internals.h" void move_masked_irq (int irq) {
@@ -39,11 +42,12 @@ void move_masked_irq(int irq)* masking the irqs. */ if (likely (cpumask_any_and (desc->pending_mask, cpu_online_mask) - < nr_cpu_ids)) { -cpumask_and (desc->affinity, - desc->pending_mask, cpu_online_mask); - desc->chip->set_affinity (irq, desc->affinity); - } + < nr_cpu_ids)) +if (!desc->chip->set_affinity (irq, desc->pending_mask)) { +cpumask_copy (desc->affinity, desc->pending_mask); +irq_set_thread_affinity (desc, desc->pending_mask); + } +cpumask_clear (desc->pending_mask); }
PATCH 4/9 irq: only update affinity if set_affinity() sucessfully -v4
Impact: don't change smp_affinity if set_affinity fail
irq_set_affinity() and move_masked_irq() try to assign affinity before calling chip set_affinity(). some archs are assigning again in set_affinity again.
something like:cpumask_cpy(desc->affinity, mask);desc->chip->set_affinity(mask);
in the failing path, affinity should not be touched.
So try update the afffinity only if set_affinity return wth 0 also call irq_set_thread_affinity accordingly
v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
v3: according to Ingo, change set_affinity() in irq_chip to return int.
v4: update comments by removing moving irq_desc code.
--- kernel/irq/internals.h | 3 +++ kernel/irq/manage.c | 17 +++++++++++------ kernel/irq/migration.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-)
kernel/irq/internals.h +3 -0
@@ -42,6 +42,9 @@ static inline void unregister_handler_prextern int irq_select_affinity_usr (unsigned int irq); +extern void +irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask); +/* * Debugging printout: */
kernel/irq/manage.c +11 -6
@@ -80,7 +80,7 @@ int irq_can_set_affinity(unsigned int irreturn 1 ; } -static void +void irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask) {struct irqaction *action = desc->action;
@@ -109,17 +109,22 @@ int irq_set_affinity(unsigned int irq, cspin_lock_irqsave (&desc->lock, flags);#ifdef CONFIG_GENERIC_PENDING_IRQ -if (desc->status &IRQ_MOVE_PCNTXT ) - desc->chip->set_affinity (irq, cpumask); +if (desc->status &IRQ_MOVE_PCNTXT ) { +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + } + }else { desc->status |=IRQ_MOVE_PENDING ;cpumask_copy (desc->pending_mask, cpumask); }#else -cpumask_copy (desc->affinity, cpumask); - desc->chip->set_affinity (irq, cpumask); +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + }#endif -irq_set_thread_affinity (desc, cpumask); desc->status |=IRQ_AFFINITY_SET ;spin_unlock_irqrestore (&desc->lock, flags);return 0 ;
kernel/irq/migration.c +9 -5
@@ -1,5 +1,8 @@#include <linux/irq.h> +#include <linux/interrupt.h> + +#include "internals.h" void move_masked_irq (int irq) {
@@ -39,11 +42,12 @@ void move_masked_irq(int irq)* masking the irqs. */ if (likely (cpumask_any_and (desc->pending_mask, cpu_online_mask) - < nr_cpu_ids)) { -cpumask_and (desc->affinity, - desc->pending_mask, cpu_online_mask); - desc->chip->set_affinity (irq, desc->affinity); - } + < nr_cpu_ids)) +if (!desc->chip->set_affinity (irq, desc->pending_mask)) { +cpumask_copy (desc->affinity, desc->pending_mask); +irq_set_thread_affinity (desc, desc->pending_mask); + } +cpumask_clear (desc->pending_mask); }
[tip:irq/numa] irq: only update affinity if ->set_affinity() is sucessfull
Commit-ID: 57b150cce8e004ddd36330490a68bfb59b7271e9 Gitweb: http://git.kernel.org/tip/57b150cce8e004ddd36330490a68bfb59b7271e9 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 17:59:53 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:16 +0200
irq: only update affinity if ->set_affinity() is sucessfull
irq_set_affinity() and move_masked_irq() try to assign affinity before calling chip set_affinity(). Some archs are assigning it in ->set_affinity() again.
We do something like:
cpumask_cpy(desc->affinity, mask);
desc->chip->set_affinity(mask);
But in the failure path, affinity should not be touched - otherwise we'll end up with a different affinity mask despite the failure to migrate the IRQ.
So try to update the afffinity only if set_affinity returns with 0. Also call irq_set_thread_affinity accordingly.
v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
v3: according to Ingo, change set_affinity() in irq_chip should return int.
v4: update comments by removing moving irq_desc code.
[ Impact: fix /proc/irq/*/smp_affinity setting corner case bug ]
LKML-Reference: <[email protected]>
--- kernel/irq/internals.h | 3 +++ kernel/irq/manage.c | 17 +++++++++++------ kernel/irq/migration.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-)
kernel/irq/internals.h +3 -0
@@ -42,6 +42,9 @@ static inline void unregister_handler_proc(unsigned int irq,extern int irq_select_affinity_usr (unsigned int irq); +extern void +irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask); +/* * Debugging printout: */
kernel/irq/manage.c +11 -6
@@ -80,7 +80,7 @@ int irq_can_set_affinity(unsigned int irq)return 1 ; } -static void +void irq_set_thread_affinity (struct irq_desc *desc,const struct cpumask *cpumask) {struct irqaction *action = desc->action;
@@ -109,17 +109,22 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)spin_lock_irqsave (&desc->lock, flags);#ifdef CONFIG_GENERIC_PENDING_IRQ -if (desc->status &IRQ_MOVE_PCNTXT ) - desc->chip->set_affinity (irq, cpumask); +if (desc->status &IRQ_MOVE_PCNTXT ) { +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + } + }else { desc->status |=IRQ_MOVE_PENDING ;cpumask_copy (desc->pending_mask, cpumask); }#else -cpumask_copy (desc->affinity, cpumask); - desc->chip->set_affinity (irq, cpumask); +if (!desc->chip->set_affinity (irq, cpumask)) { +cpumask_copy (desc->affinity, cpumask); +irq_set_thread_affinity (desc, cpumask); + }#endif -irq_set_thread_affinity (desc, cpumask); desc->status |=IRQ_AFFINITY_SET ;spin_unlock_irqrestore (&desc->lock, flags);return 0 ;
kernel/irq/migration.c +9 -5
@@ -1,5 +1,8 @@#include <linux/irq.h> +#include <linux/interrupt.h> + +#include "internals.h" void move_masked_irq (int irq) {
@@ -39,11 +42,12 @@ void move_masked_irq(int irq)* masking the irqs. */ if (likely (cpumask_any_and (desc->pending_mask, cpu_online_mask) - < nr_cpu_ids)) { -cpumask_and (desc->affinity, - desc->pending_mask, cpu_online_mask); - desc->chip->set_affinity (irq, desc->affinity); - } + < nr_cpu_ids)) +if (!desc->chip->set_affinity (irq, desc->pending_mask)) { +cpumask_copy (desc->affinity, desc->pending_mask); +irq_set_thread_affinity (desc, desc->pending_mask); + } +cpumask_clear (desc->pending_mask); }
PATCH 5/9 x86/irq: change irq_desc_alloc to take node instead cpu
In reply to Yinghai LuImpact: prepare to make irq_desc_alloc to numa aware
so could make irq_desc_alloc use node pass down
--- arch/x86/kernel/apic/io_apic.c | 46 +++++++++++++++++------------------------ arch/x86/lguest/boot.c | 2 - drivers/pci/intr_remapping.c | 15 +++++-------- drivers/xen/events.c | 2 - include/linux/interrupt.h | 2 - include/linux/irq.h | 12 +++------- kernel/irq/handle.c | 28 +++++++++--------------- kernel/irq/internals.h | 2 - kernel/softirq.c | 2 - 9 files changed, 46 insertions(+), 65 deletions(-)
arch/x86/kernel/apic/io_apic.c +20 -26
@@ -130,12 +130,9 @@ struct irq_pin_list {struct irq_pin_list *next; }; -static struct irq_pin_list *get_one_free_irq_2_pin (int cpu) +static struct irq_pin_list *get_one_free_irq_2_pin (int node) {struct irq_pin_list *pin; -int node; - - node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node);
@@ -210,12 +207,9 @@ static struct irq_cfg *irq_cfg(unsignedreturn cfg; } -static struct irq_cfg *get_one_free_irq_cfg (int cpu) +static struct irq_cfg *get_one_free_irq_cfg (int node) {struct irq_cfg *cfg; -int node; - - node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node);if (cfg) {
@@ -236,13 +230,13 @@ static struct irq_cfg *get_one_free_irq_return cfg; } -int arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int node) {struct irq_cfg *cfg; cfg = desc->chip_data;if (!cfg) { - desc->chip_data =get_one_free_irq_cfg (cpu); + desc->chip_data =get_one_free_irq_cfg (node);if (!desc->chip_data) {printk (KERN_ERR "can not alloc irq_cfg\n" );BUG_ON (1 );
@@ -398,13 +392,13 @@ static void ioapic_mask_entry(int apic,* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ -static void add_pin_to_irq_cpu (struct irq_cfg *cfg,int cpu,int apic,int pin) +static void add_pin_to_irq_node (struct irq_cfg *cfg,int node,int apic,int pin) {struct irq_pin_list *entry; entry = cfg->irq_2_pin;if (!entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) {printk (KERN_ERR "can not alloc irq_2_pin to add %d - %d\n" , apic, pin);
@@ -424,7 +418,7 @@ static void add_pin_to_irq_cpu(struct ir entry = entry->next; } - entry->next =get_one_free_irq_2_pin (cpu); + entry->next =get_one_free_irq_2_pin (node); entry = entry->next; entry->apic = apic; entry->pin = pin;
@@ -433,7 +427,7 @@ static void add_pin_to_irq_cpu(struct ir/* * Reroute an IRQ to a different pin. */ -static void __init replace_pin_at_irq_cpu (struct irq_cfg *cfg,int cpu, +static void __init replace_pin_at_irq_node (struct irq_cfg *cfg,int node,int oldapic,int oldpin,int newapic,int newpin) {
@@ -453,7 +447,7 @@ static void __init replace_pin_at_irq_cp/* why? call replace before add? */ if (!replaced) -add_pin_to_irq_cpu (cfg, cpu, newapic, newpin); +add_pin_to_irq_node (cfg, node, newapic, newpin); } static inline void io_apic_modify_irq(struct irq_cfg *cfg,
@@ -1395,7 +1389,7 @@ static void __init setup_IO_APIC_irqs(voint notcon =0 ;struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);apic_printk (APIC_VERBOSE ,KERN_DEBUG "init IO_APIC IRQs\n" );
@@ -1430,13 +1424,13 @@ static void __init setup_IO_APIC_irqs(vo apic->multi_timer_check(apic_id, irq))continue ; - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);continue ; } cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, apic_id, pin); +add_pin_to_irq_node (cfg, node, apic_id, pin);setup_IO_APIC_irq (apic_id, pin, irq, desc,irq_trigger (idx),irq_polarity (idx));
@@ -2756,7 +2750,7 @@ static inline void __init check_timer(vo {struct irq_desc *desc =irq_to_desc (0 );struct irq_cfg *cfg = desc->chip_data; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);int apic1, pin1, apic2, pin2;unsigned long flags;int no_pin1 =0 ;
@@ -2822,7 +2816,7 @@ static inline void __init check_timer(vo* Ok, does IRQ0 through the IOAPIC work? */ if (no_pin1) { -add_pin_to_irq_cpu (cfg, cpu, apic1, pin1); +add_pin_to_irq_node (cfg, node, apic1, pin1);setup_timer_IRQ0_pin (apic1, pin1, cfg->vector); }else {/* for edge trigger, setup_IO_APIC_irq already
@@ -2859,7 +2853,7 @@ static inline void __init check_timer(vo/* * legacy devices should be connected to IO APIC #0 */ -replace_pin_at_irq_cpu (cfg, cpu, apic1, pin1, apic2, pin2); +replace_pin_at_irq_node (cfg, node, apic1, pin1, apic2, pin2);setup_timer_IRQ0_pin (apic2, pin2, cfg->vector);enable_8259A_irq (0 );if (timer_irq_works ()) {
@@ -3078,7 +3072,7 @@ unsigned int create_irq_nr(unsigned intunsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3087,7 +3081,7 @@ unsigned int create_irq_nr(unsigned intspin_lock_irqsave (&vector_lock, flags);for (new = irq_want; new < nr_irqs; new++) { - desc_new =irq_to_desc_alloc_cpu (new, cpu); + desc_new =irq_to_desc_alloc_node (new, node);if (!desc_new) {printk (KERN_INFO "can not get irq_desc for %d\n" , new);continue ;
@@ -3861,7 +3855,7 @@ int io_apic_set_pci_routing (int ioapic, {struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3869,7 +3863,7 @@ int io_apic_set_pci_routing (int ioapic,return -EINVAL ; } - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);return 0 ;
@@ -3880,7 +3874,7 @@ int io_apic_set_pci_routing (int ioapic,*/ if (irq >=NR_IRQS_LEGACY ) { cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, ioapic, pin); +add_pin_to_irq_node (cfg, node, ioapic, pin); }setup_IO_APIC_irq (ioapic, pin, irq, desc, triggering, polarity);
arch/x86/lguest/boot.c +1 -1
@@ -640,7 +640,7 @@ static void __init lguest_init_IRQ(void)void lguest_setup_irq (unsigned int irq) { -irq_to_desc_alloc_cpu (irq,0 ); +irq_to_desc_alloc_node (irq,0 );set_irq_chip_and_handler_name (irq, &lguest_irq_controller, handle_level_irq,"level" ); }
drivers/pci/intr_remapping.c +6 -9
@@ -23,15 +23,12 @@ struct irq_2_iommu { };#ifdef CONFIG_GENERIC_HARDIRQS -static struct irq_2_iommu *get_one_free_irq_2_iommu (int cpu) +static struct irq_2_iommu *get_one_free_irq_2_iommu (int node) {struct irq_2_iommu *iommu; -int node; - - node =cpu_to_node (cpu); iommu =kzalloc_node (sizeof (*iommu),GFP_ATOMIC , node); -printk (KERN_DEBUG "alloc irq_2_iommu on cpu %d node %d\n" , cpu, node); +printk (KERN_DEBUG "alloc irq_2_iommu on node %d\n" , node);return iommu; }
@@ -48,7 +45,7 @@ static struct irq_2_iommu *irq_2_iommu(ureturn desc->irq_2_iommu; } -static struct irq_2_iommu *irq_2_iommu_alloc_cpu (unsigned int irq,int cpu) +static struct irq_2_iommu *irq_2_iommu_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;struct irq_2_iommu *irq_iommu;
@@ -56,7 +53,7 @@ static struct irq_2_iommu *irq_2_iommu_a/* * alloc irq desc if not allocated already. */ - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);return NULL ;
@@ -65,14 +62,14 @@ static struct irq_2_iommu *irq_2_iommu_a irq_iommu = desc->irq_2_iommu;if (!irq_iommu) - desc->irq_2_iommu =get_one_free_irq_2_iommu (cpu); + desc->irq_2_iommu =get_one_free_irq_2_iommu (node); return desc->irq_2_iommu; }static struct irq_2_iommu *irq_2_iommu_alloc (unsigned int irq) { -return irq_2_iommu_alloc_cpu (irq, boot_cpu_id); +return irq_2_iommu_alloc_node (irq,cpu_to_node (boot_cpu_id)); }#else /* !CONFIG_SPARSE_IRQ */
drivers/xen/events.c +1 -1
@@ -341,7 +341,7 @@ static int find_unbound_irq(void)if (irq == nr_irqs)panic ("No available IRQ to bind to: increase nr_irqs!\n" ); - desc =irq_to_desc_alloc_cpu (irq,0 ); + desc =irq_to_desc_alloc_node (irq,0 );if (WARN_ON (desc ==NULL ))return -1 ;
include/linux/interrupt.h +1 -1
@@ -580,6 +580,6 @@ struct irq_desc;extern int early_irq_init (void );extern int arch_probe_nr_irqs (void );extern int arch_early_irq_init (void ); -extern int arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int arch_init_chip_data (struct irq_desc *desc,int node);#endif
include/linux/irq.h +4 -8
@@ -187,7 +187,7 @@ struct irq_desc {spinlock_t lock;#ifdef CONFIG_SMP cpumask_var_t affinity; -unsigned int cpu; +unsigned int node;#ifdef CONFIG_GENERIC_PENDING_IRQ cpumask_var_t pending_mask;#endif
@@ -208,7 +208,7 @@ extern void arch_free_chip_data(struct iextern struct irq_desc irq_desc[NR_IRQS ];#endif /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);/* * Migration helpers for obsolete names, they will go away:
@@ -420,12 +420,10 @@ extern int set_irq_msi(unsigned int irq,* Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {#ifdef CONFIG_CPUMASK_OFFSTACK -int node; -if (boot) {alloc_bootmem_cpumask_var (&desc->affinity);
@@ -435,8 +433,6 @@ static inline bool alloc_desc_masks(strureturn true; } - node =cpu_to_node (cpu); -if (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false;
@@ -492,7 +488,7 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {return true;
kernel/irq/handle.c +11 -17
@@ -83,12 +83,10 @@ static struct irq_desc irq_desc_init = { .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), }; -void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr) +void init_kstat_irqs (struct irq_desc *desc,int node,int nr) { -int node;void *ptr; - node =cpu_to_node (cpu); ptr =kzalloc_node (nr *sizeof (*desc->kstat_irqs),GFP_ATOMIC , node);/*
@@ -96,33 +94,32 @@ void init_kstat_irqs(struct irq_desc *de* init_copy_kstat_irqs() could still use old one */ if (ptr) { -printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" , - cpu, node); +printk (KERN_DEBUG " alloc kstat_irqs on node %d\n" , node); desc->kstat_irqs = ptr; } } -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) +static void init_one_irq_desc (int irq,struct irq_desc *desc,int node) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));spin_lock_init (&desc->lock); desc->irq = irq;#ifdef CONFIG_SMP - desc->cpu = cpu; + desc->node = node;#endif lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_kstat_irqs (desc, cpu, nr_cpu_ids); +init_kstat_irqs (desc, node, nr_cpu_ids);if (!desc->kstat_irqs) {printk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); }init_desc_masks (desc); -arch_init_chip_data (desc, cpu); +arch_init_chip_data (desc, node); }/*
@@ -191,11 +188,10 @@ struct irq_desc *irq_to_desc(unsigned inreturn NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;unsigned long flags; -int node;if (irq >= nr_irqs) { WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n",
@@ -214,15 +210,13 @@ struct irq_desc *irq_to_desc_alloc_cpu(uif (desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_desc for %d on cpu %d node %d\n" , - irq, cpu, node); +printk (KERN_DEBUG " alloc irq_desc for %d on node %d\n" , irq, node);if (!desc) {printk (KERN_ERR "can not alloc irq_desc\n" );BUG_ON (1 ); } -init_one_irq_desc (irq, desc, cpu); +init_one_irq_desc (irq, desc, node); irq_desc_ptrs[irq] = desc;
@@ -272,7 +266,7 @@ struct irq_desc *irq_to_desc(unsigned inreturn (irq <NR_IRQS ) ? irq_desc + irq :NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {return irq_to_desc (irq); }
kernel/irq/internals.h +1 -1
@@ -16,7 +16,7 @@ extern void __disable_irq(struct irq_desextern void __enable_irq (struct irq_desc *desc,unsigned int irq,bool resume);extern struct lock_class_key irq_desc_lock_class; -extern void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr); +extern void init_kstat_irqs (struct irq_desc *desc,int node,int nr);extern void clear_kstat_irqs (struct irq_desc *desc);extern spinlock_t sparse_irq_lock;
kernel/softirq.c +1 -1
@@ -836,7 +836,7 @@ int __init __weak arch_early_irq_init(voreturn 0 ; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +int __weak arch_init_chip_data (struct irq_desc *desc,int node) {return 0 ; }
PATCH 5/9 x86/irq: change irq_desc_alloc to take node instead cpu -v2
Impact: prepare to make irq_desc_alloc to numa aware
so could make irq_desc_alloc use node pass down
v2: keep move_irq_desc related
--- arch/x86/kernel/apic/io_apic.c | 58 ++++++++++++++++++----------------------- arch/x86/lguest/boot.c | 2 - drivers/pci/intr_remapping.c | 15 ++++------ drivers/xen/events.c | 2 - include/linux/interrupt.h | 2 - include/linux/irq.h | 16 ++++------- kernel/irq/handle.c | 28 +++++++------------ kernel/irq/internals.h | 2 - kernel/irq/numa_migrate.c | 36 ++++++++----------------- kernel/softirq.c | 2 - 10 files changed, 66 insertions(+), 97 deletions(-)
arch/x86/kernel/apic/io_apic.c +26 -32
@@ -130,12 +130,9 @@ struct irq_pin_list {struct irq_pin_list *next; }; -static struct irq_pin_list *get_one_free_irq_2_pin (int cpu) +static struct irq_pin_list *get_one_free_irq_2_pin (int node) {struct irq_pin_list *pin; -int node; - - node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node);
@@ -210,12 +207,9 @@ static struct irq_cfg *irq_cfg(unsignedreturn cfg; } -static struct irq_cfg *get_one_free_irq_cfg (int cpu) +static struct irq_cfg *get_one_free_irq_cfg (int node) {struct irq_cfg *cfg; -int node; - - node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node);if (cfg) {
@@ -236,13 +230,13 @@ static struct irq_cfg *get_one_free_irq_return cfg; } -int arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int node) {struct irq_cfg *cfg; cfg = desc->chip_data;if (!cfg) { - desc->chip_data =get_one_free_irq_cfg (cpu); + desc->chip_data =get_one_free_irq_cfg (node);if (!desc->chip_data) {printk (KERN_ERR "can not alloc irq_cfg\n" );BUG_ON (1 );
@@ -254,7 +248,7 @@ int arch_init_chip_data(struct irq_desc/* for move_irq_desc */ static void -init_copy_irq_2_pin (struct irq_cfg *old_cfg,struct irq_cfg *cfg,int cpu) +init_copy_irq_2_pin (struct irq_cfg *old_cfg,struct irq_cfg *cfg,int node) {struct irq_pin_list *old_entry, *head, *tail, *entry;
@@ -263,7 +257,7 @@ init_copy_irq_2_pin(struct irq_cfg *old_if (!old_entry)return ; - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry)return ;
@@ -273,7 +267,7 @@ init_copy_irq_2_pin(struct irq_cfg *old_ tail = entry; old_entry = old_entry->next;while (old_entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) { entry = head;while (entry) {
@@ -313,12 +307,12 @@ static void free_irq_2_pin(struct irq_cf }void arch_init_copy_chip_data (struct irq_desc *old_desc, -struct irq_desc *desc,int cpu) +struct irq_desc *desc,int node) {struct irq_cfg *cfg;struct irq_cfg *old_cfg; - cfg =get_one_free_irq_cfg (cpu); + cfg =get_one_free_irq_cfg (node);if (!cfg)return ;
@@ -329,7 +323,7 @@ void arch_init_copy_chip_data(struct irqmemcpy (cfg, old_cfg,sizeof (struct irq_cfg )); -init_copy_irq_2_pin (old_cfg, cfg, cpu); +init_copy_irq_2_pin (old_cfg, cfg, node); }static void free_irq_cfg (struct irq_cfg *old_cfg)
@@ -501,13 +495,13 @@ static void ioapic_mask_entry(int apic,* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ -static void add_pin_to_irq_cpu (struct irq_cfg *cfg,int cpu,int apic,int pin) +static void add_pin_to_irq_node (struct irq_cfg *cfg,int node,int apic,int pin) {struct irq_pin_list *entry; entry = cfg->irq_2_pin;if (!entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) {printk (KERN_ERR "can not alloc irq_2_pin to add %d - %d\n" , apic, pin);
@@ -527,7 +521,7 @@ static void add_pin_to_irq_cpu(struct ir entry = entry->next; } - entry->next =get_one_free_irq_2_pin (cpu); + entry->next =get_one_free_irq_2_pin (node); entry = entry->next; entry->apic = apic; entry->pin = pin;
@@ -536,7 +530,7 @@ static void add_pin_to_irq_cpu(struct ir/* * Reroute an IRQ to a different pin. */ -static void __init replace_pin_at_irq_cpu (struct irq_cfg *cfg,int cpu, +static void __init replace_pin_at_irq_node (struct irq_cfg *cfg,int node,int oldapic,int oldpin,int newapic,int newpin) {
@@ -556,7 +550,7 @@ static void __init replace_pin_at_irq_cp/* why? call replace before add? */ if (!replaced) -add_pin_to_irq_cpu (cfg, cpu, newapic, newpin); +add_pin_to_irq_node (cfg, node, newapic, newpin); } static inline void io_apic_modify_irq(struct irq_cfg *cfg,
@@ -1482,7 +1476,7 @@ static void __init setup_IO_APIC_irqs(voint notcon =0 ;struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);apic_printk (APIC_VERBOSE ,KERN_DEBUG "init IO_APIC IRQs\n" );
@@ -1517,13 +1511,13 @@ static void __init setup_IO_APIC_irqs(vo apic->multi_timer_check(apic_id, irq))continue ; - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);continue ; } cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, apic_id, pin); +add_pin_to_irq_node (cfg, node, apic_id, pin);setup_IO_APIC_irq (apic_id, pin, irq, desc,irq_trigger (idx),irq_polarity (idx));
@@ -2821,7 +2815,7 @@ static inline void __init check_timer(vo {struct irq_desc *desc =irq_to_desc (0 );struct irq_cfg *cfg = desc->chip_data; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);int apic1, pin1, apic2, pin2;unsigned long flags;int no_pin1 =0 ;
@@ -2887,7 +2881,7 @@ static inline void __init check_timer(vo* Ok, does IRQ0 through the IOAPIC work? */ if (no_pin1) { -add_pin_to_irq_cpu (cfg, cpu, apic1, pin1); +add_pin_to_irq_node (cfg, node, apic1, pin1);setup_timer_IRQ0_pin (apic1, pin1, cfg->vector); }else {/* for edge trigger, setup_IO_APIC_irq already
@@ -2924,7 +2918,7 @@ static inline void __init check_timer(vo/* * legacy devices should be connected to IO APIC #0 */ -replace_pin_at_irq_cpu (cfg, cpu, apic1, pin1, apic2, pin2); +replace_pin_at_irq_node (cfg, node, apic1, pin1, apic2, pin2);setup_timer_IRQ0_pin (apic2, pin2, cfg->vector);enable_8259A_irq (0 );if (timer_irq_works ()) {
@@ -3143,7 +3137,7 @@ unsigned int create_irq_nr(unsigned intunsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3152,7 +3146,7 @@ unsigned int create_irq_nr(unsigned intspin_lock_irqsave (&vector_lock, flags);for (new = irq_want; new < nr_irqs; new++) { - desc_new =irq_to_desc_alloc_cpu (new, cpu); + desc_new =irq_to_desc_alloc_node (new, node);if (!desc_new) {printk (KERN_INFO "can not get irq_desc for %d\n" , new);continue ;
@@ -3926,7 +3920,7 @@ int io_apic_set_pci_routing (int ioapic, {struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3934,7 +3928,7 @@ int io_apic_set_pci_routing (int ioapic,return -EINVAL ; } - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);return 0 ;
@@ -3945,7 +3939,7 @@ int io_apic_set_pci_routing (int ioapic,*/ if (irq >=NR_IRQS_LEGACY ) { cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, ioapic, pin); +add_pin_to_irq_node (cfg, node, ioapic, pin); }setup_IO_APIC_irq (ioapic, pin, irq, desc, triggering, polarity);
arch/x86/lguest/boot.c +1 -1
@@ -642,7 +642,7 @@ static void __init lguest_init_IRQ(void)void lguest_setup_irq (unsigned int irq) { -irq_to_desc_alloc_cpu (irq,0 ); +irq_to_desc_alloc_node (irq,0 );set_irq_chip_and_handler_name (irq, &lguest_irq_controller, handle_level_irq,"level" ); }
drivers/pci/intr_remapping.c +6 -9
@@ -31,15 +31,12 @@ struct irq_2_iommu { };#ifdef CONFIG_GENERIC_HARDIRQS -static struct irq_2_iommu *get_one_free_irq_2_iommu (int cpu) +static struct irq_2_iommu *get_one_free_irq_2_iommu (int node) {struct irq_2_iommu *iommu; -int node; - - node =cpu_to_node (cpu); iommu =kzalloc_node (sizeof (*iommu),GFP_ATOMIC , node); -printk (KERN_DEBUG "alloc irq_2_iommu on cpu %d node %d\n" , cpu, node); +printk (KERN_DEBUG "alloc irq_2_iommu on node %d\n" , node);return iommu; }
@@ -56,7 +53,7 @@ static struct irq_2_iommu *irq_2_iommu(ureturn desc->irq_2_iommu; } -static struct irq_2_iommu *irq_2_iommu_alloc_cpu (unsigned int irq,int cpu) +static struct irq_2_iommu *irq_2_iommu_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;struct irq_2_iommu *irq_iommu;
@@ -64,7 +61,7 @@ static struct irq_2_iommu *irq_2_iommu_a/* * alloc irq desc if not allocated already. */ - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);return NULL ;
@@ -73,14 +70,14 @@ static struct irq_2_iommu *irq_2_iommu_a irq_iommu = desc->irq_2_iommu;if (!irq_iommu) - desc->irq_2_iommu =get_one_free_irq_2_iommu (cpu); + desc->irq_2_iommu =get_one_free_irq_2_iommu (node); return desc->irq_2_iommu; }static struct irq_2_iommu *irq_2_iommu_alloc (unsigned int irq) { -return irq_2_iommu_alloc_cpu (irq, boot_cpu_id); +return irq_2_iommu_alloc_node (irq,cpu_to_node (boot_cpu_id)); }#else /* !CONFIG_SPARSE_IRQ */
drivers/xen/events.c +1 -1
@@ -341,7 +341,7 @@ static int find_unbound_irq(void)if (irq == nr_irqs)panic ("No available IRQ to bind to: increase nr_irqs!\n" ); - desc =irq_to_desc_alloc_cpu (irq,0 ); + desc =irq_to_desc_alloc_node (irq,0 );if (WARN_ON (desc ==NULL ))return -1 ;
include/linux/interrupt.h +1 -1
@@ -580,6 +580,6 @@ struct irq_desc;extern int early_irq_init (void );extern int arch_probe_nr_irqs (void );extern int arch_early_irq_init (void ); -extern int arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int arch_init_chip_data (struct irq_desc *desc,int node);#endif
include/linux/irq.h +6 -10
@@ -187,7 +187,7 @@ struct irq_desc {spinlock_t lock;#ifdef CONFIG_SMP cpumask_var_t affinity; -unsigned int cpu; +unsigned int node;#ifdef CONFIG_GENERIC_PENDING_IRQ cpumask_var_t pending_mask;#endif
@@ -201,16 +201,16 @@ struct irq_desc { }____cacheline_internodealigned_in_smp ;extern void arch_init_copy_chip_data (struct irq_desc *old_desc, -struct irq_desc *desc,int cpu); +struct irq_desc *desc,int node);extern void arch_free_chip_data (struct irq_desc *old_desc,struct irq_desc *desc);#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ];#else /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); +extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node);#endif /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);/* * Migration helpers for obsolete names, they will go away:
@@ -422,12 +422,10 @@ extern int set_irq_msi(unsigned int irq,* Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {#ifdef CONFIG_CPUMASK_OFFSTACK -int node; -if (boot) {alloc_bootmem_cpumask_var (&desc->affinity);
@@ -437,8 +435,6 @@ static inline bool alloc_desc_masks(strureturn true; } - node =cpu_to_node (cpu); -if (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false;
@@ -494,7 +490,7 @@ static inline void free_desc_masks(struc#else /* !CONFIG_SMP */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {return true;
kernel/irq/handle.c +11 -17
@@ -83,12 +83,10 @@ static struct irq_desc irq_desc_init = { .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), }; -void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr) +void init_kstat_irqs (struct irq_desc *desc,int node,int nr) { -int node;void *ptr; - node =cpu_to_node (cpu); ptr =kzalloc_node (nr *sizeof (*desc->kstat_irqs),GFP_ATOMIC , node);/*
@@ -96,33 +94,32 @@ void init_kstat_irqs(struct irq_desc *de* init_copy_kstat_irqs() could still use old one */ if (ptr) { -printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" , - cpu, node); +printk (KERN_DEBUG " alloc kstat_irqs on node %d\n" , node); desc->kstat_irqs = ptr; } } -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) +static void init_one_irq_desc (int irq,struct irq_desc *desc,int node) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));spin_lock_init (&desc->lock); desc->irq = irq;#ifdef CONFIG_SMP - desc->cpu = cpu; + desc->node = node;#endif lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_kstat_irqs (desc, cpu, nr_cpu_ids); +init_kstat_irqs (desc, node, nr_cpu_ids);if (!desc->kstat_irqs) {printk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); }init_desc_masks (desc); -arch_init_chip_data (desc, cpu); +arch_init_chip_data (desc, node); }/*
@@ -191,11 +188,10 @@ struct irq_desc *irq_to_desc(unsigned inreturn NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;unsigned long flags; -int node;if (irq >= nr_irqs) { WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n",
@@ -214,15 +210,13 @@ struct irq_desc *irq_to_desc_alloc_cpu(uif (desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_desc for %d on cpu %d node %d\n" , - irq, cpu, node); +printk (KERN_DEBUG " alloc irq_desc for %d on node %d\n" , irq, node);if (!desc) {printk (KERN_ERR "can not alloc irq_desc\n" );BUG_ON (1 ); } -init_one_irq_desc (irq, desc, cpu); +init_one_irq_desc (irq, desc, node); irq_desc_ptrs[irq] = desc;
@@ -272,7 +266,7 @@ struct irq_desc *irq_to_desc(unsigned inreturn (irq <NR_IRQS ) ? irq_desc + irq :NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {return irq_to_desc (irq); }
kernel/irq/internals.h +1 -1
@@ -16,7 +16,7 @@ extern void __disable_irq(struct irq_desextern void __enable_irq (struct irq_desc *desc,unsigned int irq,bool resume);extern struct lock_class_key irq_desc_lock_class; -extern void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr); +extern void init_kstat_irqs (struct irq_desc *desc,int node,int nr);extern void clear_kstat_irqs (struct irq_desc *desc);extern spinlock_t sparse_irq_lock;
kernel/softirq.c +1 -1
@@ -836,7 +836,7 @@ int __init __weak arch_early_irq_init(voreturn 0 ; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +int __weak arch_init_chip_data (struct irq_desc *desc,int node) {return 0 ; }
kernel/irq/numa_migrate.c +12 -24
@@ -15,9 +15,9 @@static void init_copy_kstat_irqs (struct irq_desc *old_desc,struct irq_desc *desc, -int cpu,int nr) +int node,int nr) { -init_kstat_irqs (desc, cpu, nr); +init_kstat_irqs (desc, node, nr);if (desc->kstat_irqs != old_desc->kstat_irqs) memcpy(desc->kstat_irqs, old_desc->kstat_irqs,
@@ -34,20 +34,20 @@ static void free_kstat_irqs(struct irq_d }static bool init_copy_one_irq_desc (int irq,struct irq_desc *old_desc, -struct irq_desc *desc,int cpu) +struct irq_desc *desc,int node) {memcpy (desc, old_desc,sizeof (struct irq_desc )); -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "irq %d: can not get new irq_desc cpumask " "for migration.\n" , irq);return false; }spin_lock_init (&desc->lock); - desc->cpu = cpu; + desc->node = node;lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids); +init_copy_kstat_irqs (old_desc, desc, node, nr_cpu_ids);init_copy_desc_masks (old_desc, desc); -arch_init_copy_chip_data (old_desc, desc, cpu); +arch_init_copy_chip_data (old_desc, desc, node);return true; }
@@ -59,12 +59,11 @@ static void free_one_irq_desc(struct irq }static struct irq_desc *__real_move_irq_desc (struct irq_desc *old_desc, -int cpu) +int node) {struct irq_desc *desc;unsigned int irq;unsigned long flags; -int node; irq = old_desc->irq;
@@ -76,7 +75,6 @@ static struct irq_desc *__real_move_irq_if (desc && old_desc != desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node);if (!desc) { printk(KERN_ERR "irq %d: can not get new irq_desc "
@@ -85,7 +83,7 @@ static struct irq_desc *__real_move_irq_ desc = old_desc; goto out_unlock; } -if (!init_copy_one_irq_desc (irq, old_desc, desc, cpu)) { +if (!init_copy_one_irq_desc (irq, old_desc, desc, node)) {/* still use old one */ kfree (desc); desc = old_desc;
@@ -107,24 +105,14 @@ out_unlock:return desc; } -struct irq_desc *move_irq_desc (struct irq_desc *desc,int cpu) +struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) { -int old_cpu; -int node, old_node; -/* those all static, do move them */ if (desc->irq <NR_IRQS_LEGACY )return desc; - old_cpu = desc->cpu; -if (old_cpu != cpu) { - node =cpu_to_node (cpu); - old_node =cpu_to_node (old_cpu); -if (old_node != node) - desc =__real_move_irq_desc (desc, cpu); -else - desc->cpu = cpu; - } +if (desc->node != node) + desc =__real_move_irq_desc (desc, node);return desc; }
[tip:irq/numa] x86/irq: change irq_desc_alloc() to take node instead of cpu
Commit-ID: 85ac16d033370caf6f48d743c8dc8103700f5cc5 Gitweb: http://git.kernel.org/tip/85ac16d033370caf6f48d743c8dc8103700f5cc5 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 18:00:38 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:17 +0200
x86/irq: change irq_desc_alloc() to take node instead of cpu
This simplifies the node awareness of the code. All our allocators only deal with a NUMA node ID locality not with CPU ids anyway - so there's no need to maintain (and transform) a CPU id all across the IRq layer.
v2: keep move_irq_desc related
[ Impact: cleanup, prepare IRQ code to be NUMA-aware ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/io_apic.c | 58 ++++++++++++++++++---------------------- arch/x86/lguest/boot.c | 2 +- drivers/pci/intr_remapping.c | 15 ++++------ drivers/xen/events.c | 2 +- include/linux/interrupt.h | 2 +- include/linux/irq.h | 16 ++++------- kernel/irq/handle.c | 28 +++++++----------- kernel/irq/internals.h | 2 +- kernel/irq/numa_migrate.c | 36 ++++++++---------------- kernel/softirq.c | 2 +- 10 files changed, 66 insertions(+), 97 deletions(-)
arch/x86/kernel/apic/io_apic.c +26 -32
@@ -129,12 +129,9 @@ struct irq_pin_list {struct irq_pin_list *next; }; -static struct irq_pin_list *get_one_free_irq_2_pin (int cpu) +static struct irq_pin_list *get_one_free_irq_2_pin (int node) {struct irq_pin_list *pin; -int node; - - node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node);
@@ -209,12 +206,9 @@ static struct irq_cfg *irq_cfg(unsigned int irq)return cfg; } -static struct irq_cfg *get_one_free_irq_cfg (int cpu) +static struct irq_cfg *get_one_free_irq_cfg (int node) {struct irq_cfg *cfg; -int node; - - node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node);if (cfg) {
@@ -235,13 +229,13 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)return cfg; } -int arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int node) {struct irq_cfg *cfg; cfg = desc->chip_data;if (!cfg) { - desc->chip_data =get_one_free_irq_cfg (cpu); + desc->chip_data =get_one_free_irq_cfg (node);if (!desc->chip_data) {printk (KERN_ERR "can not alloc irq_cfg\n" );BUG_ON (1 );
@@ -253,7 +247,7 @@ int arch_init_chip_data(struct irq_desc *desc, int cpu)/* for move_irq_desc */ static void -init_copy_irq_2_pin (struct irq_cfg *old_cfg,struct irq_cfg *cfg,int cpu) +init_copy_irq_2_pin (struct irq_cfg *old_cfg,struct irq_cfg *cfg,int node) {struct irq_pin_list *old_entry, *head, *tail, *entry;
@@ -262,7 +256,7 @@ init_copy_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg, int cpu)if (!old_entry)return ; - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry)return ;
@@ -272,7 +266,7 @@ init_copy_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg, int cpu) tail = entry; old_entry = old_entry->next;while (old_entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) { entry = head;while (entry) {
@@ -312,12 +306,12 @@ static void free_irq_2_pin(struct irq_cfg *old_cfg, struct irq_cfg *cfg) }void arch_init_copy_chip_data (struct irq_desc *old_desc, -struct irq_desc *desc,int cpu) +struct irq_desc *desc,int node) {struct irq_cfg *cfg;struct irq_cfg *old_cfg; - cfg =get_one_free_irq_cfg (cpu); + cfg =get_one_free_irq_cfg (node);if (!cfg)return ;
@@ -328,7 +322,7 @@ void arch_init_copy_chip_data(struct irq_desc *old_desc,memcpy (cfg, old_cfg,sizeof (struct irq_cfg )); -init_copy_irq_2_pin (old_cfg, cfg, cpu); +init_copy_irq_2_pin (old_cfg, cfg, node); }static void free_irq_cfg (struct irq_cfg *old_cfg)
@@ -615,13 +609,13 @@ set_ioapic_affinity_irq(unsigned int irq, const struct cpumask *mask)* shared ISA-space IRQs, so we have to support them. We are super * fast in the common case, and fast for shared ISA-space IRQs. */ -static void add_pin_to_irq_cpu (struct irq_cfg *cfg,int cpu,int apic,int pin) +static void add_pin_to_irq_node (struct irq_cfg *cfg,int node,int apic,int pin) {struct irq_pin_list *entry; entry = cfg->irq_2_pin;if (!entry) { - entry =get_one_free_irq_2_pin (cpu); + entry =get_one_free_irq_2_pin (node);if (!entry) {printk (KERN_ERR "can not alloc irq_2_pin to add %d - %d\n" , apic, pin);
@@ -641,7 +635,7 @@ static void add_pin_to_irq_cpu(struct irq_cfg *cfg, int cpu, int apic, int pin) entry = entry->next; } - entry->next =get_one_free_irq_2_pin (cpu); + entry->next =get_one_free_irq_2_pin (node); entry = entry->next; entry->apic = apic; entry->pin = pin;
@@ -650,7 +644,7 @@ static void add_pin_to_irq_cpu(struct irq_cfg *cfg, int cpu, int apic, int pin)/* * Reroute an IRQ to a different pin. */ -static void __init replace_pin_at_irq_cpu (struct irq_cfg *cfg,int cpu, +static void __init replace_pin_at_irq_node (struct irq_cfg *cfg,int node,int oldapic,int oldpin,int newapic,int newpin) {
@@ -670,7 +664,7 @@ static void __init replace_pin_at_irq_cpu(struct irq_cfg *cfg, int cpu,/* why? call replace before add? */ if (!replaced) -add_pin_to_irq_cpu (cfg, cpu, newapic, newpin); +add_pin_to_irq_node (cfg, node, newapic, newpin); } static inline void io_apic_modify_irq(struct irq_cfg *cfg,
@@ -1612,7 +1606,7 @@ static void __init setup_IO_APIC_irqs(void)int notcon =0 ;struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);apic_printk (APIC_VERBOSE ,KERN_DEBUG "init IO_APIC IRQs\n" );
@@ -1647,13 +1641,13 @@ static void __init setup_IO_APIC_irqs(void) apic->multi_timer_check(apic_id, irq))continue ; - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);continue ; } cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, apic_id, pin); +add_pin_to_irq_node (cfg, node, apic_id, pin);setup_IO_APIC_irq (apic_id, pin, irq, desc,irq_trigger (idx),irq_polarity (idx));
@@ -2863,7 +2857,7 @@ static inline void __init check_timer(void) {struct irq_desc *desc =irq_to_desc (0 );struct irq_cfg *cfg = desc->chip_data; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);int apic1, pin1, apic2, pin2;unsigned long flags;int no_pin1 =0 ;
@@ -2929,7 +2923,7 @@ static inline void __init check_timer(void)* Ok, does IRQ0 through the IOAPIC work? */ if (no_pin1) { -add_pin_to_irq_cpu (cfg, cpu, apic1, pin1); +add_pin_to_irq_node (cfg, node, apic1, pin1);setup_timer_IRQ0_pin (apic1, pin1, cfg->vector); }else {/* for edge trigger, setup_IO_APIC_irq already
@@ -2966,7 +2960,7 @@ static inline void __init check_timer(void)/* * legacy devices should be connected to IO APIC #0 */ -replace_pin_at_irq_cpu (cfg, cpu, apic1, pin1, apic2, pin2); +replace_pin_at_irq_node (cfg, node, apic1, pin1, apic2, pin2);setup_timer_IRQ0_pin (apic2, pin2, cfg->vector);enable_8259A_irq (0 );if (timer_irq_works ()) {
@@ -3185,7 +3179,7 @@ unsigned int create_irq_nr(unsigned int irq_want)unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3194,7 +3188,7 @@ unsigned int create_irq_nr(unsigned int irq_want)spin_lock_irqsave (&vector_lock, flags);for (new = irq_want; new < nr_irqs; new++) { - desc_new =irq_to_desc_alloc_cpu (new, cpu); + desc_new =irq_to_desc_alloc_node (new, node);if (!desc_new) {printk (KERN_INFO "can not get irq_desc for %d\n" , new);continue ;
@@ -3968,7 +3962,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p {struct irq_desc *desc;struct irq_cfg *cfg; -int cpu = boot_cpu_id; +int node =cpu_to_node (boot_cpu_id);if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3976,7 +3970,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int preturn -EINVAL ; } - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);return 0 ;
@@ -3987,7 +3981,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p*/ if (irq >=NR_IRQS_LEGACY ) { cfg = desc->chip_data; -add_pin_to_irq_cpu (cfg, cpu, ioapic, pin); +add_pin_to_irq_node (cfg, node, ioapic, pin); }setup_IO_APIC_irq (ioapic, pin, irq, desc, triggering, polarity);
arch/x86/lguest/boot.c +1 -1
@@ -636,7 +636,7 @@ static void __init lguest_init_IRQ(void)void lguest_setup_irq (unsigned int irq) { -irq_to_desc_alloc_cpu (irq,0 ); +irq_to_desc_alloc_node (irq,0 );set_irq_chip_and_handler_name (irq, &lguest_irq_controller, handle_level_irq,"level" ); }
drivers/pci/intr_remapping.c +6 -9
@@ -23,15 +23,12 @@ struct irq_2_iommu { };#ifdef CONFIG_GENERIC_HARDIRQS -static struct irq_2_iommu *get_one_free_irq_2_iommu (int cpu) +static struct irq_2_iommu *get_one_free_irq_2_iommu (int node) {struct irq_2_iommu *iommu; -int node; - - node =cpu_to_node (cpu); iommu =kzalloc_node (sizeof (*iommu),GFP_ATOMIC , node); -printk (KERN_DEBUG "alloc irq_2_iommu on cpu %d node %d\n" , cpu, node); +printk (KERN_DEBUG "alloc irq_2_iommu on node %d\n" , node);return iommu; }
@@ -48,7 +45,7 @@ static struct irq_2_iommu *irq_2_iommu(unsigned int irq)return desc->irq_2_iommu; } -static struct irq_2_iommu *irq_2_iommu_alloc_cpu (unsigned int irq,int cpu) +static struct irq_2_iommu *irq_2_iommu_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;struct irq_2_iommu *irq_iommu;
@@ -56,7 +53,7 @@ static struct irq_2_iommu *irq_2_iommu_alloc_cpu(unsigned int irq, int cpu)/* * alloc irq desc if not allocated already. */ - desc =irq_to_desc_alloc_cpu (irq, cpu); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc for %d\n" , irq);return NULL ;
@@ -65,14 +62,14 @@ static struct irq_2_iommu *irq_2_iommu_alloc_cpu(unsigned int irq, int cpu) irq_iommu = desc->irq_2_iommu;if (!irq_iommu) - desc->irq_2_iommu =get_one_free_irq_2_iommu (cpu); + desc->irq_2_iommu =get_one_free_irq_2_iommu (node); return desc->irq_2_iommu; }static struct irq_2_iommu *irq_2_iommu_alloc (unsigned int irq) { -return irq_2_iommu_alloc_cpu (irq, boot_cpu_id); +return irq_2_iommu_alloc_node (irq,cpu_to_node (boot_cpu_id)); }#else /* !CONFIG_SPARSE_IRQ */
drivers/xen/events.c +1 -1
@@ -335,7 +335,7 @@ static int find_unbound_irq(void)if (irq == nr_irqs)panic ("No available IRQ to bind to: increase nr_irqs!\n" ); - desc =irq_to_desc_alloc_cpu (irq,0 ); + desc =irq_to_desc_alloc_node (irq,0 );if (WARN_ON (desc ==NULL ))return -1 ;
include/linux/interrupt.h +1 -1
@@ -566,6 +566,6 @@ struct irq_desc;extern int early_irq_init (void );extern int arch_probe_nr_irqs (void );extern int arch_early_irq_init (void ); -extern int arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int arch_init_chip_data (struct irq_desc *desc,int node);#endif
include/linux/irq.h +6 -10
@@ -187,7 +187,7 @@ struct irq_desc {spinlock_t lock;#ifdef CONFIG_SMP cpumask_var_t affinity; -unsigned int cpu; +unsigned int node;#ifdef CONFIG_GENERIC_PENDING_IRQ cpumask_var_t pending_mask;#endif
@@ -201,16 +201,16 @@ struct irq_desc { }____cacheline_internodealigned_in_smp ;extern void arch_init_copy_chip_data (struct irq_desc *old_desc, -struct irq_desc *desc,int cpu); +struct irq_desc *desc,int node);extern void arch_free_chip_data (struct irq_desc *old_desc,struct irq_desc *desc);#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ];#else /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); +extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node);#endif /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);/* * Migration helpers for obsolete names, they will go away:
@@ -422,12 +422,10 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);* Allocates affinity and pending_mask cpumask if required. * Returns true if successful (or not required). */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {#ifdef CONFIG_CPUMASK_OFFSTACK -int node; -if (boot) {alloc_bootmem_cpumask_var (&desc->affinity);
@@ -437,8 +435,6 @@ static inline bool alloc_desc_masks(struct irq_desc *desc, int cpu,return true; } - node =cpu_to_node (cpu); -if (!alloc_cpumask_var_node (&desc->affinity,GFP_ATOMIC , node))return false;
@@ -494,7 +490,7 @@ static inline void free_desc_masks(struct irq_desc *old_desc,#else /* !CONFIG_SMP */ -static inline bool alloc_desc_masks (struct irq_desc *desc,int cpu, +static inline bool alloc_desc_masks (struct irq_desc *desc,int node,bool boot) {return true;
kernel/irq/handle.c +11 -17
@@ -81,12 +81,10 @@ static struct irq_desc irq_desc_init = { .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), }; -void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr) +void init_kstat_irqs (struct irq_desc *desc,int node,int nr) { -int node;void *ptr; - node =cpu_to_node (cpu); ptr =kzalloc_node (nr *sizeof (*desc->kstat_irqs),GFP_ATOMIC , node);/*
@@ -94,33 +92,32 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)* init_copy_kstat_irqs() could still use old one */ if (ptr) { -printk (KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n" , - cpu, node); +printk (KERN_DEBUG " alloc kstat_irqs on node %d\n" , node); desc->kstat_irqs = ptr; } } -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) +static void init_one_irq_desc (int irq,struct irq_desc *desc,int node) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));spin_lock_init (&desc->lock); desc->irq = irq;#ifdef CONFIG_SMP - desc->cpu = cpu; + desc->node = node;#endif lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_kstat_irqs (desc, cpu, nr_cpu_ids); +init_kstat_irqs (desc, node, nr_cpu_ids);if (!desc->kstat_irqs) {printk (KERN_ERR "can not alloc kstat_irqs\n" );BUG_ON (1 ); } -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "can not alloc irq_desc cpumasks\n" );BUG_ON (1 ); }init_desc_masks (desc); -arch_init_chip_data (desc, cpu); +arch_init_chip_data (desc, node); }/*
@@ -189,11 +186,10 @@ struct irq_desc *irq_to_desc(unsigned int irq)return NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {struct irq_desc *desc;unsigned long flags; -int node;if (irq >= nr_irqs) { WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n",
@@ -212,15 +208,13 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)if (desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_desc for %d on cpu %d node %d\n" , - irq, cpu, node); +printk (KERN_DEBUG " alloc irq_desc for %d on node %d\n" , irq, node);if (!desc) {printk (KERN_ERR "can not alloc irq_desc\n" );BUG_ON (1 ); } -init_one_irq_desc (irq, desc, cpu); +init_one_irq_desc (irq, desc, node); irq_desc_ptrs[irq] = desc;
@@ -270,7 +264,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)return (irq <NR_IRQS ) ? irq_desc + irq :NULL ; } -struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) +struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node) {return irq_to_desc (irq); }
kernel/irq/internals.h +1 -1
@@ -16,7 +16,7 @@ extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);extern void __enable_irq (struct irq_desc *desc,unsigned int irq,bool resume);extern struct lock_class_key irq_desc_lock_class; -extern void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr); +extern void init_kstat_irqs (struct irq_desc *desc,int node,int nr);extern void clear_kstat_irqs (struct irq_desc *desc);extern spinlock_t sparse_irq_lock;
kernel/irq/numa_migrate.c +12 -24
@@ -15,9 +15,9 @@static void init_copy_kstat_irqs (struct irq_desc *old_desc,struct irq_desc *desc, -int cpu,int nr) +int node,int nr) { -init_kstat_irqs (desc, cpu, nr); +init_kstat_irqs (desc, node, nr);if (desc->kstat_irqs != old_desc->kstat_irqs) memcpy(desc->kstat_irqs, old_desc->kstat_irqs,
@@ -34,20 +34,20 @@ static void free_kstat_irqs(struct irq_desc *old_desc, struct irq_desc *desc) }static bool init_copy_one_irq_desc (int irq,struct irq_desc *old_desc, -struct irq_desc *desc,int cpu) +struct irq_desc *desc,int node) {memcpy (desc, old_desc,sizeof (struct irq_desc )); -if (!alloc_desc_masks (desc, cpu, false)) { +if (!alloc_desc_masks (desc, node, false)) {printk (KERN_ERR "irq %d: can not get new irq_desc cpumask " "for migration.\n" , irq);return false; }spin_lock_init (&desc->lock); - desc->cpu = cpu; + desc->node = node;lockdep_set_class (&desc->lock, &irq_desc_lock_class); -init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids); +init_copy_kstat_irqs (old_desc, desc, node, nr_cpu_ids);init_copy_desc_masks (old_desc, desc); -arch_init_copy_chip_data (old_desc, desc, cpu); +arch_init_copy_chip_data (old_desc, desc, node);return true; }
@@ -59,12 +59,11 @@ static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc) }static struct irq_desc *__real_move_irq_desc (struct irq_desc *old_desc, -int cpu) +int node) {struct irq_desc *desc;unsigned int irq;unsigned long flags; -int node; irq = old_desc->irq;
@@ -76,7 +75,6 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,if (desc && old_desc != desc) goto out_unlock; - node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node);if (!desc) { printk(KERN_ERR "irq %d: can not get new irq_desc "
@@ -85,7 +83,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, desc = old_desc; goto out_unlock; } -if (!init_copy_one_irq_desc (irq, old_desc, desc, cpu)) { +if (!init_copy_one_irq_desc (irq, old_desc, desc, node)) {/* still use old one */ kfree (desc); desc = old_desc;
@@ -107,24 +105,14 @@ out_unlock:return desc; } -struct irq_desc *move_irq_desc (struct irq_desc *desc,int cpu) +struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) { -int old_cpu; -int node, old_node; -/* those all static, do move them */ if (desc->irq <NR_IRQS_LEGACY )return desc; - old_cpu = desc->cpu; -if (old_cpu != cpu) { - node =cpu_to_node (cpu); - old_node =cpu_to_node (old_cpu); -if (old_node != node) - desc =__real_move_irq_desc (desc, cpu); -else - desc->cpu = cpu; - } +if (desc->node != node) + desc =__real_move_irq_desc (desc, node);return desc; }
kernel/softirq.c +1 -1
@@ -828,7 +828,7 @@ int __init __weak arch_early_irq_init(void)return 0 ; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +int __weak arch_init_chip_data (struct irq_desc *desc,int node) {return 0 ; }
PATCH 6/9 irq: make io_apic_set_pci_routing to take device
In reply to Yinghai LuImpact: so use dev_to_node later
--- arch/ia64/kernel/acpi.c | 5 +++-- arch/x86/include/asm/io_apic.h | 4 ++-- arch/x86/include/asm/mpspec.h | 4 +++- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/io_apic.c | 3 ++- drivers/acpi/pci_irq.c | 5 +++-- drivers/char/hpet.c | 4 ++-- drivers/pnp/pnpacpi/rsparser.c | 2 +- include/linux/acpi.h | 2 +- 9 files changed, 21 insertions(+), 16 deletions(-)
Index: linux-2.6/arch/ia64/kernel/acpi.c =================================--- linux-2.6.orig/arch/ia64/kernel/acpi.c +++ linux-2.6/arch/ia64/kernel/acpi.c
@@ -636,7 +636,7 @@ void __init acpi_numa_arch_fixup(void)
* success: return IRQ number (>=0)
* failure: return < 0
*/
-int acpi_register_gsi(u32 gsi, int triggering, int polarity)
+int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
{
if (acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM)
return gsi;
@@ -678,7 +678,8 @@ static int __init acpi_parse_fadt(struct
fadt = (struct acpi_table_fadt *)fadt_header;
- acpi_register_gsi(fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
+ acpi_register_gsi(NULL, fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE,
+ ACPI_ACTIVE_LOW);
return 0;
}
Index: linux-2.6/arch/x86/include/asm/io_apic.h =================================--- linux-2.6.orig/arch/x86/include/asm/io_apic.h +++ linux-2.6/arch/x86/include/asm/io_apic.h
@@ -154,8 +154,8 @@ extern int timer_through_8259;
extern int io_apic_get_unique_id(int ioapic, int apic_id);
extern int io_apic_get_version(int ioapic);
extern int io_apic_get_redir_entries(int ioapic);
-extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
- int edge_level, int active_high_low);
+extern int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin,
+ int irq, int edge_level, int active_high_low);
#endif /* CONFIG_ACPI */
extern int (*ioapic_renumber_irq)(int ioapic, int irq);
Index: linux-2.6/arch/x86/include/asm/mpspec.h =================================--- linux-2.6.orig/arch/x86/include/asm/mpspec.h +++ linux-2.6/arch/x86/include/asm/mpspec.h
@@ -72,7 +72,9 @@ extern void mp_register_ioapic(int id, u
extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
u32 gsi);
extern void mp_config_acpi_legacy_irqs(void);
-extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low); +struct device;
+extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level,
+ int active_high_low);
extern int acpi_probe_gsi(void);
#ifdef CONFIG_X86_IO_APIC
extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
Index: linux-2.6/arch/x86/kernel/acpi/boot.c =================================--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c +++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -522,7 +522,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned in
* success: return IRQ number (>=0)
* failure: return < 0
*/
-int acpi_register_gsi(u32 gsi, int triggering, int polarity)
+int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
{
unsigned int irq;
unsigned int plat_gsi = gsi;
@@ -539,7 +539,7 @@ int acpi_register_gsi(u32 gsi, int trigg
#ifdef CONFIG_X86_IO_APIC
if (acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC) {
- plat_gsi = mp_register_gsi(gsi, triggering, polarity);
+ plat_gsi = mp_register_gsi(dev, gsi, triggering, polarity);
}
#endif
acpi_gsi_to_irq(plat_gsi, &irq);
@@ -1158,7 +1158,7 @@ void __init mp_config_acpi_legacy_irqs(v
}
}
-int mp_register_gsi(u32 gsi, int triggering, int polarity)
+int mp_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
{
int ioapic;
int ioapic_pin;
@@ -1253,7 +1253,7 @@ int mp_register_gsi(u32 gsi, int trigger
}
}
#endif
- io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
+ io_apic_set_pci_routing(dev, ioapic, ioapic_pin, gsi,
triggering = ACPI_EDGE_SENSITIVE ? 0 : 1, polarity = ACPI_ACTIVE_HIGH ? 0 : 1);
return gsi;
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c =================================--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c +++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -3851,7 +3851,8 @@ int __init io_apic_get_version(int ioapi
}
#endif
-int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) +int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,
+ int triggering, int polarity)
{
struct irq_desc *desc;
struct irq_cfg *cfg;
Index: linux-2.6/drivers/acpi/pci_irq.c =================================--- linux-2.6.orig/drivers/acpi/pci_irq.c +++ linux-2.6/drivers/acpi/pci_irq.c
@@ -401,7 +401,8 @@ int acpi_pci_irq_enable(struct pci_dev *
/* Interrupt Line values above 0xF are forbidden */
if (dev->irq > 0 && (dev->irq <= 0xF)) {
printk(" - using IRQ %d\n", dev->irq);
- acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
+ acpi_register_gsi(&dev->dev, dev->irq,
+ ACPI_LEVEL_SENSITIVE,
ACPI_ACTIVE_LOW);
return 0;
} else {
@@ -410,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev *
}
}
- rc = acpi_register_gsi(gsi, triggering, polarity);
+ rc = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
if (rc < 0) {
dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n",
pin_name(pin));
Index: linux-2.6/drivers/char/hpet.c =================================--- linux-2.6.orig/drivers/char/hpet.c +++ linux-2.6/drivers/char/hpet.c
@@ -224,7 +224,7 @@ static void hpet_timer_set_irq(struct hp
break;
}
- gsi = acpi_register_gsi(irq, ACPI_LEVEL_SENSITIVE,
+ gsi = acpi_register_gsi(NULL, irq, ACPI_LEVEL_SENSITIVE,
ACPI_ACTIVE_LOW);
if (gsi > 0)
break;
@@ -939,7 +939,7 @@ static acpi_status hpet_resources(struct
irqp = &res->data.extended_irq;
for (i = 0; i < irqp->interrupt_count; i++) {
- irq = acpi_register_gsi(irqp->interrupts[i],
+ irq = acpi_register_gsi(NULL, irqp->interrupts[i],
irqp->triggering, irqp->polarity);
if (irq < 0)
return AE_ERROR;
Index: linux-2.6/drivers/pnp/pnpacpi/rsparser.c =================================--- linux-2.6.orig/drivers/pnp/pnpacpi/rsparser.c +++ linux-2.6/drivers/pnp/pnpacpi/rsparser.c
@@ -123,7 +123,7 @@ static void pnpacpi_parse_allocated_irqr
}
flags = irq_flags(triggering, polarity, shareable);
- irq = acpi_register_gsi(gsi, triggering, polarity);
+ irq = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
if (irq >= 0)
pcibios_penalize_isa_irq(irq, 1);
else
Index: linux-2.6/include/linux/acpi.h =================================--- linux-2.6.orig/include/linux/acpi.h +++ linux-2.6/include/linux/acpi.h
@@ -118,7 +118,7 @@ extern int pci_mmcfg_config_num;
extern int sbf_port;
extern unsigned long acpi_realmode_flags;
-int acpi_register_gsi (u32 gsi, int triggering, int polarity);
+int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
#ifdef CONFIG_X86_IO_APIC
Re: [PATCH 6/9] irq: make io_apic_set_pci_routing to take device
re: touching ACPI files in this patch with no material effect
PATCH 1/1 x86/acpi: remove compress irq trick for 32bit
We already have per cpu vector for 32bit, and don't need this trick any more.
on 3 ioapic system (24 per ioapic) before patch got
ACPI: PCI Interrupt Link [ILSB] enabled at IRQ 71
IOAPIC[2]: Set routing entry (10-23 -> 0xa9 -> IRQ 64 Mode:1 Active:1) pci 0000:80:01.1: PCI INT A -> Link[ILSB] -> GSI 71 (level, low) -> IRQ 64
ACPI: PCI Interrupt Link [LE5B] enabled at IRQ 67
IOAPIC[2]: Set routing entry (10-19 -> 0xb1 -> IRQ 65 Mode:1 Active:1) pci 0000:83:00.0: PCI INT B -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65
ACPI: PCI Interrupt Link [LE5A] enabled at IRQ 66
IOAPIC[2]: Set routing entry (10-18 -> 0xb9 -> IRQ 66 Mode:1 Active:1) pci 0000:83:00.1: PCI INT A -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66
ACPI: PCI Interrupt Link [LE5D] enabled at IRQ 65
IOAPIC[2]: Set routing entry (10-17 -> 0xc1 -> IRQ 67 Mode:1 Active:1) pci 0000:84:00.0: PCI INT B -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67
ACPI: PCI Interrupt Link [LE5C] enabled at IRQ 64
IOAPIC[2]: Set routing entry (10-16 -> 0xc9 -> IRQ 68 Mode:1 Active:1) pci 0000:84:00.1: PCI INT A -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:87:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:87:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67 pci 0000:88:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:88:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65 pci 0000:8b:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:8b:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67 pci 0000:8c:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:8c:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65
after patch will get
ACPI: PCI Interrupt Link [ILSB] enabled at IRQ 71
IOAPIC[2]: Set routing entry (10-23 -> 0xa9 -> IRQ 71 Mode:1 Active:1) pci 0000:80:01.1: PCI INT A -> Link[ILSB] -> GSI 71 (level, low) -> IRQ 71
ACPI: PCI Interrupt Link [LE5B] enabled at IRQ 67
IOAPIC[2]: Set routing entry (10-19 -> 0xb1 -> IRQ 67 Mode:1 Active:1) pci 0000:83:00.0: PCI INT B -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67
ACPI: PCI Interrupt Link [LE5A] enabled at IRQ 66
IOAPIC[2]: Set routing entry (10-18 -> 0xb9 -> IRQ 66 Mode:1 Active:1) pci 0000:83:00.1: PCI INT A -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66
ACPI: PCI Interrupt Link [LE5D] enabled at IRQ 65
IOAPIC[2]: Set routing entry (10-17 -> 0xc1 -> IRQ 65 Mode:1 Active:1) pci 0000:84:00.0: PCI INT B -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65
ACPI: PCI Interrupt Link [LE5C] enabled at IRQ 64
IOAPIC[2]: Set routing entry (10-16 -> 0xc9 -> IRQ 64 Mode:1 Active:1) pci 0000:84:00.1: PCI INT A -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:87:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:87:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65 pci 0000:88:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:88:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67 pci 0000:8b:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:8b:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65 pci 0000:8c:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:8c:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67
[ Impact: make irq = gsi on 32bit system with more ioapics ]
--- arch/x86/kernel/acpi/boot.c | 65 ++++---------------------------------------- 1 file changed, 7 insertions(+), 58 deletions(-)
arch/x86/kernel/acpi/boot.c +7 -58
@@ -1162,22 +1162,9 @@ int mp_register_gsi(struct device *dev, {int ioapic;int ioapic_pin; -#ifdef CONFIG_X86_32 -#define MAX_GSI_NUM 4096 -#define IRQ_COMPRESSION_START 64 - -static int pci_irq =IRQ_COMPRESSION_START ; -/* -* Mapping between Global System Interrupts, which -* represent all possible interrupts, and IRQs -* assigned to actual devices. -*/ -static int gsi_to_irq[MAX_GSI_NUM ]; -#else if (acpi_irq_model !=ACPI_IRQ_MODEL_IOAPIC )return gsi; -#endif /* Don't set up the ACPI SCI because it's already set up */ if (acpi_gbl_FADT.sci_interrupt == gsi)
@@ -1196,66 +1183,28 @@ int mp_register_gsi(struct device *dev, gsi =ioapic_renumber_irq (ioapic, gsi);#endif -/* -* Avoid pin reprogramming. PRTs typically include entries -* with redundant pin->gsi mappings (but unique PCI devices); -* we only program the IOAPIC on the first. -*/ if (ioapic_pin >MP_MAX_IOAPIC_PIN ) {printk (KERN_ERR "Invalid reference to IOAPIC pin " "%d-%d\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin);return gsi; } + +/* +* Avoid pin reprogramming. PRTs typically include entries +* with redundant pin->gsi mappings (but unique PCI devices); +* we only program the IOAPIC on the first. +*/ if (test_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {pr_debug ("Pin %d-%d already programmed\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin); -#ifdef CONFIG_X86_32 -return (gsi <IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]); -#else return gsi; -#endif } -set_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed); -#ifdef CONFIG_X86_32 -/* -* For GSI >= 64, use IRQ compression -*/ -if ((gsi >=IRQ_COMPRESSION_START ) - && (triggering ==ACPI_LEVEL_SENSITIVE )) { -/* -* For PCI devices assign IRQs in order, avoiding gaps -* due to unused I/O APIC pins. -*/ -int irq = gsi; -if (gsi <MAX_GSI_NUM ) { -/* -* Retain the VIA chipset work-around (gsi > 15), but -* avoid a problem where the 8254 timer (IRQ0) is setup -* via an override (so it's not on pin 0 of the ioapic), -* and at the same time, the pin 0 interrupt is a PCI -* type. The gsi > 15 test could cause these two pins -* to be shared as IRQ0, and they are not shareable. -* So test for this condition, and if necessary, avoid -* the pin collision. -*/ - gsi = pci_irq++; -/* -* Don't assign IRQ used by ACPI SCI -*/ -if (gsi == acpi_gbl_FADT.sci_interrupt) - gsi = pci_irq++; - gsi_to_irq[irq] = gsi; - }else { -printk (KERN_ERR "GSI %u is too high\n" , gsi); -return gsi; - } - } -#endif io_apic_set_pci_routing (dev, ioapic, ioapic_pin, gsi, triggering ==ACPI_EDGE_SENSITIVE ?0 :1 , polarity ==ACPI_ACTIVE_HIGH ?0 :1 ); +return gsi; }
PATCH 1/1 x86/acpi: calling mp_config_acpi_gsi in mp_register_gsi
it seems that change about calling mp_config_acpi_gsi in acpi_pci_irq_enable() never get into mainline.
actually we could call that in mp_register_gsi with struct device... also could make mp_config_acpi_gsi to be static
[Impact: make update_mptable working]
--- arch/x86/include/asm/mpspec.h | 9 ------ arch/x86/kernel/acpi/boot.c | 62 ++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 35 deletions(-)
arch/x86/include/asm/mpspec.h +0 -9
@@ -77,17 +77,8 @@ extern int mp_register_gsi(struct device int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC -extern int mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity);extern int mp_find_ioapic (int gsi);extern int mp_find_ioapic_pin (int ioapic,int gsi); -#else -static inline int -mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity) -{ -return 0 ; -}#endif #else /* !CONFIG_ACPI: */ static inline int acpi_probe_gsi (void )
arch/x86/kernel/acpi/boot.c +36 -26
86 lines not on this page · raw message
Re: [PATCH] x86/acpi: calling mp_config_acpi_gsi in mp_register_gsi
it seems it still have some problem. will have -v2.
YH
Quoted 132 lines · Yinghai Lu
it seems that change about calling
mp_config_acpi_gsiinacpi_pci_irq_enable()never get into mainline.actually we could call that in
mp_register_gsiwith struct device... also could makemp_config_acpi_gsito be static[Impact: make
update_mptableworking]Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/include/asm/mpspec.h | 9 ------ arch/x86/kernel/acpi/boot.c | 62 ++++++++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 35 deletions(-)Index:
linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================arch/x86/include/asm/mpspec.h +0
-9@@ -77,17 +77,8 @@ extern int mp_register_gsi(struct device int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC -extern int mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity);extern int mp_find_ioapic (int gsi);extern int mp_find_ioapic_pin (int ioapic,int gsi); -#else -static inline int -mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity) -{ -return 0 ; -}#endif #else /* !CONFIG_ACPI: */ static inline int acpi_probe_gsi (void )Index:
linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================arch/x86/kernel/acpi/boot.c +36
-26@@ -33,6 +33,7 @@#include <linux/irq.h> #include <linux/bootmem.h> #include <linux/ioport.h> +#include <linux/pci.h> #include <asm/pgtable.h> #include <asm/io_apic.h> @@ -1158,6 +1159,40 @@ void __init mp_config_acpi_legacy_irqs(v } } +static int mp_config_acpi_gsi (struct device *dev,u32 gsi,int triggering, +int polarity) +{ +#ifdef CONFIG_X86_MPPARSE +struct mpc_intsrc mp_irq; +struct pci_dev *pdev; +unsigned char number; +unsigned int devfn; +int ioapic; +u8 pin; + +if (!acpi_ioapic) +return 0 ; + + pdev =to_pci_dev (dev); + number = pdev->bus->number; + devfn = pdev->devfn; + pin = pdev->pin; +/* print the entry should happen on mptable identically */ + mp_irq.type =MP_INTSRC ; + mp_irq.irqtype = mp_INT; + mp_irq.irqflag = (triggering ==ACPI_EDGE_SENSITIVE ?4 :0x0c ) | + (polarity ==ACPI_ACTIVE_HIGH ?1 :3 ); + mp_irq.srcbus = number; + mp_irq.srcbusirq = (((devfn >>3 ) &0x1f ) <<2 ) | ((pin -1 ) &3 ); + ioapic =mp_find_ioapic (gsi); + mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; + mp_irq.dstirq =mp_find_ioapic_pin (ioapic, gsi); + +save_mp_irq (&mp_irq); +#endif +return 0 ; +} +int mp_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {int ioapic;@@ -1189,6 +1224,7 @@ int mp_register_gsi(struct device *dev, ioapic_pin);return gsi; } +mp_config_acpi_gsi (dev, gsi, triggering, polarity);/* * Avoid pin reprogramming. PRTs typically include entries @@ -1208,32 +1244,6 @@ int mp_register_gsi(struct device *dev,return gsi; } -int mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity) -{ -#ifdef CONFIG_X86_MPPARSE -struct mpc_intsrc mp_irq; -int ioapic; - -if (!acpi_ioapic) -return 0 ; - -/* print the entry should happen on mptable identically */ - mp_irq.type =MP_INTSRC ; - mp_irq.irqtype = mp_INT; - mp_irq.irqflag = (triggering ==ACPI_EDGE_SENSITIVE ?4 :0x0c ) | - (polarity ==ACPI_ACTIVE_HIGH ?1 :3 ); - mp_irq.srcbus = number; - mp_irq.srcbusirq = (((devfn >>3 ) &0x1f ) <<2 ) | ((pin -1 ) &3 ); - ioapic =mp_find_ioapic (gsi); - mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; - mp_irq.dstirq =mp_find_ioapic_pin (ioapic, gsi); - -save_mp_irq (&mp_irq); -#endif -return 0 ; -} -/* * Parse IOAPIC related entries in MADT * returns 0 on success, < 0 on error
PATCH 1/1 x86/acpi: calling mp_config_acpi_gsi in mp_register_gsi -v2
In reply to Yinghai Luit seems that change about calling mp_config_acpi_gsi in acpi_pci_irq_enable() never get into mainline.
actually we could call that in mp_register_gsi with struct device... also could make mp_config_acpi_gsi to be static
v2: some calling could have to be pci device, need to check that
[Impact: make update_mptable working]
--- arch/x86/include/asm/mpspec.h | 9 ----- arch/x86/kernel/acpi/boot.c | 66 +++++++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 35 deletions(-)
arch/x86/include/asm/mpspec.h +0 -9
@@ -77,17 +77,8 @@ extern int mp_register_gsi(struct device int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC -extern int mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity);extern int mp_find_ioapic (int gsi);extern int mp_find_ioapic_pin (int ioapic,int gsi); -#else -static inline int -mp_config_acpi_gsi (unsigned char number,unsigned int devfn,u8 pin, -u32 gsi,int triggering,int polarity) -{ -return 0 ; -}#endif #else /* !CONFIG_ACPI: */ static inline int acpi_probe_gsi (void )
arch/x86/kernel/acpi/boot.c +40 -26
90 lines not on this page · raw message
Re: [PATCH] x86/acpi: remove compress irq trick for 32bit
In reply to Yinghai LuQuoted 152 lines · Yinghai Lu
We already have per cpu vector for 32bit, and don't need this trick any more.
on 3 ioapic system (24 per ioapic) before patch got
ACPI: PCI Interrupt Link [ILSB] enabled at IRQ 71
IOAPIC[2]: Set routing entry (10-23 ->0xa9-> IRQ 64 Mode:1 Active:1) pci 0000:80:01.1: PCI INT A -> Link[ILSB] -> GSI 71 (level, low) -> IRQ 64
ACPI: PCI Interrupt Link [LE5B] enabled at IRQ 67
IOAPIC[2]: Set routing entry (10-19 ->0xb1-> IRQ 65 Mode:1 Active:1) pci 0000:83:00.0: PCI INT B -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65
ACPI: PCI Interrupt Link [LE5A] enabled at IRQ 66
IOAPIC[2]: Set routing entry (10-18 ->0xb9-> IRQ 66 Mode:1 Active:1) pci 0000:83:00.1: PCI INT A -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66
ACPI: PCI Interrupt Link [LE5D] enabled at IRQ 65
IOAPIC[2]: Set routing entry (10-17 ->0xc1-> IRQ 67 Mode:1 Active:1) pci 0000:84:00.0: PCI INT B -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67
ACPI: PCI Interrupt Link [LE5C] enabled at IRQ 64
IOAPIC[2]: Set routing entry (10-16 ->0xc9-> IRQ 68 Mode:1 Active:1) pci 0000:84:00.1: PCI INT A -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:87:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:87:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67 pci 0000:88:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:88:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65 pci 0000:8b:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:8b:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 67 pci 0000:8c:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 68 pci 0000:8c:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 65after patch will get
ACPI: PCI Interrupt Link [ILSB] enabled at IRQ 71
IOAPIC[2]: Set routing entry (10-23 ->0xa9-> IRQ 71 Mode:1 Active:1) pci 0000:80:01.1: PCI INT A -> Link[ILSB] -> GSI 71 (level, low) -> IRQ 71
ACPI: PCI Interrupt Link [LE5B] enabled at IRQ 67
IOAPIC[2]: Set routing entry (10-19 ->0xb1-> IRQ 67 Mode:1 Active:1) pci 0000:83:00.0: PCI INT B -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67
ACPI: PCI Interrupt Link [LE5A] enabled at IRQ 66
IOAPIC[2]: Set routing entry (10-18 ->0xb9-> IRQ 66 Mode:1 Active:1) pci 0000:83:00.1: PCI INT A -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66
ACPI: PCI Interrupt Link [LE5D] enabled at IRQ 65
IOAPIC[2]: Set routing entry (10-17 ->0xc1-> IRQ 65 Mode:1 Active:1) pci 0000:84:00.0: PCI INT B -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65
ACPI: PCI Interrupt Link [LE5C] enabled at IRQ 64
IOAPIC[2]: Set routing entry (10-16 ->0xc9-> IRQ 64 Mode:1 Active:1) pci 0000:84:00.1: PCI INT A -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:87:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:87:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65 pci 0000:88:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:88:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67 pci 0000:8b:00.0: PCI INT B -> Link[LE5A] -> GSI 66 (level, low) -> IRQ 66 pci 0000:8b:00.1: PCI INT A -> Link[LE5D] -> GSI 65 (level, low) -> IRQ 65 pci 0000:8c:00.0: PCI INT B -> Link[LE5C] -> GSI 64 (level, low) -> IRQ 64 pci 0000:8c:00.1: PCI INT A -> Link[LE5B] -> GSI 67 (level, low) -> IRQ 67[ Impact: make irq = gsi on 32bit system with more ioapics ]
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/acpi/boot.c | 65 ++++---------------------------------------- 1 file changed, 7 insertions(+), 58 deletions(-)Index:
linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================arch/x86/kernel/acpi/boot.c +6
-55@@ -1162,22 +1162,9 @@ int mp_register_gsi(struct device *dev, {int ioapic;int ioapic_pin; -#ifdef CONFIG_X86_32 -#define MAX_GSI_NUM 4096 -#define IRQ_COMPRESSION_START 64 - -static int pci_irq =IRQ_COMPRESSION_START ; -/* -* Mapping between Global System Interrupts, which -* represent all possible interrupts, and IRQs -* assigned to actual devices. -*/ -static int gsi_to_irq[MAX_GSI_NUM ]; -#else if (acpi_irq_model !=ACPI_IRQ_MODEL_IOAPIC )return gsi; -#endif /* Don't set up the ACPI SCI because it's already set up */ if (acpi_gbl_FADT.sci_interrupt == gsi)@@ -1196,66 +1183,28 @@ int mp_register_gsi(struct device *dev, gsi =ioapic_renumber_irq (ioapic, gsi);#endif -/* -* Avoid pin reprogramming. PRTs typically include entries -* with redundant pin->gsi mappings (but unique PCI devices); -* we only program the IOAPIC on the first. -*/ if (ioapic_pin >MP_MAX_IOAPIC_PIN ) {printk (KERN_ERR "Invalid reference to IOAPIC pin " "%d-%d\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin);return gsi; } + +/* +* Avoid pin reprogramming. PRTs typically include entries +* with redundant pin->gsi mappings (but unique PCI devices); +* we only program the IOAPIC on the first. +*/ if (test_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {pr_debug ("Pin %d-%d already programmed\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin); -#ifdef CONFIG_X86_32 -return (gsi <IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]); -#else return gsi; -#endif } -set_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed); -#ifdef CONFIG_X86_32 -/* -* For GSI >= 64, use IRQ compression -*/ -if ((gsi >=IRQ_COMPRESSION_START ) - && (triggering ==ACPI_LEVEL_SENSITIVE )) { -/* -* For PCI devices assign IRQs in order, avoiding gaps -* due to unused I/O APIC pins. -*/ -int irq = gsi; -if (gsi <MAX_GSI_NUM ) { -/* -* Retain the VIA chipset work-around (gsi > 15), but -* avoid a problem where the 8254 timer (IRQ0) is setup -* via an override (so it's not on pin 0 of the ioapic), -* and at the same time, the pin 0 interrupt is a PCI -* type. The gsi > 15 test could cause these two pins -* to be shared as IRQ0, and they are not shareable. -* So test for this condition, and if necessary, avoid -* the pin collision. -*/ - gsi = pci_irq++; -/* -* Don't assign IRQ used by ACPI SCI -*/ -if (gsi == acpi_gbl_FADT.sci_interrupt) - gsi = pci_irq++; - gsi_to_irq[irq] = gsi; - }else { -printk (KERN_ERR "GSI %u is too high\n" , gsi); -return gsi;
arch/x86/kernel/acpi/boot.c int mp_register_gsi(struct device *dev, · line 1210
Quoted 10 lines
arch/x86/kernel/acpi/boot.c +1
-3- } - } -#endif io_apic_set_pci_routing (dev, ioapic, ioapic_pin, gsi, triggering ==ACPI_EDGE_SENSITIVE ?0 :1 , polarity ==ACPI_ACTIVE_HIGH ?0 :1 ); +return gsi; }
Nice!
Len, any preference about which tree should carry this?
Ingo
Re: [PATCH] x86/acpi: remove compress irq trick for 32bit
In reply to Yinghai LuYinghai,
I'm really happy to see this workaround finally get removed.
Ingo,
go ahead and keep this with your irq patches.
thanks,
Len Brown, Intel Open Source Technology Center
Re: [PATCH] x86/acpi: remove compress irq trick for 32bit
Quoted 7 lines · Len Brown
Yinghai,
I'm really happy to see this workaround finally get removed.Acked-by Len Brown <[email protected]>Ingo,
go ahead and keep this with your irq patches.
thanks Len!
Ingo
PATCH 6/9 irq: make io_apic_set_pci_routing to take device
In reply to Yinghai LuImpact: so use dev_to_node later
--- arch/ia64/kernel/acpi.c | 5 +++-- arch/x86/include/asm/io_apic.h | 4 ++-- arch/x86/include/asm/mpspec.h | 4 +++- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/io_apic.c | 3 ++- drivers/acpi/pci_irq.c | 5 +++-- drivers/char/hpet.c | 4 ++-- drivers/pnp/pnpacpi/rsparser.c | 2 +- include/linux/acpi.h | 2 +- 9 files changed, 21 insertions(+), 16 deletions(-)
arch/ia64/kernel/acpi.c +3 -2
@@ -636,7 +636,7 @@ void __init acpi_numa_arch_fixup(void)* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {if (acpi_irq_model ==ACPI_IRQ_MODEL_PLATFORM )return gsi;
@@ -678,7 +678,8 @@ static int __init acpi_parse_fadt(struct fadt = (struct acpi_table_fadt *)fadt_header; -acpi_register_gsi (fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW ); +acpi_register_gsi (NULL , fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE , +ACPI_ACTIVE_LOW );return 0 ; }
arch/x86/include/asm/io_apic.h +2 -2
@@ -154,8 +154,8 @@ extern int timer_through_8259;extern int io_apic_get_unique_id (int ioapic,int apic_id);extern int io_apic_get_version (int ioapic);extern int io_apic_get_redir_entries (int ioapic); -extern int io_apic_set_pci_routing (int ioapic,int pin,int irq, -int edge_level,int active_high_low); +extern int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin, +int irq,int edge_level,int active_high_low);#endif /* CONFIG_ACPI */ extern int (*ioapic_renumber_irq)(int ioapic,int irq);
arch/x86/include/asm/mpspec.h +3 -1
@@ -72,7 +72,9 @@ extern void mp_register_ioapic(int id, uextern void mp_override_legacy_irq (u8 bus_irq,u8 polarity,u8 trigger,u32 gsi);extern void mp_config_acpi_legacy_irqs (void ); -extern int mp_register_gsi (u32 gsi,int edge_level,int active_high_low); +struct device ; +extern int mp_register_gsi (struct device *dev,u32 gsi,int edge_level, +int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
arch/x86/kernel/acpi/boot.c +4 -4
@@ -522,7 +522,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned in* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {unsigned int irq;unsigned int plat_gsi = gsi;
@@ -539,7 +539,7 @@ int acpi_register_gsi(u32 gsi, int trigg#ifdef CONFIG_X86_IO_APIC if (acpi_irq_model ==ACPI_IRQ_MODEL_IOAPIC ) { - plat_gsi =mp_register_gsi (gsi, triggering, polarity); + plat_gsi =mp_register_gsi (dev, gsi, triggering, polarity); }#endif acpi_gsi_to_irq (plat_gsi, &irq);
@@ -1158,7 +1158,7 @@ void __init mp_config_acpi_legacy_irqs(v } } -int mp_register_gsi (u32 gsi,int triggering,int polarity) +int mp_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {int ioapic;int ioapic_pin;
@@ -1253,7 +1253,7 @@ int mp_register_gsi(u32 gsi, int trigger } }#endif -io_apic_set_pci_routing (ioapic, ioapic_pin, gsi, +io_apic_set_pci_routing (dev, ioapic, ioapic_pin, gsi, triggering ==ACPI_EDGE_SENSITIVE ?0 :1 , polarity ==ACPI_ACTIVE_HIGH ?0 :1 );return gsi;
arch/x86/kernel/apic/io_apic.c +2 -1
@@ -3916,7 +3916,8 @@ int __init io_apic_get_version(int ioapi }#endif -int io_apic_set_pci_routing (int ioapic,int pin,int irq,int triggering,int polarity) +int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin,int irq, +int triggering,int polarity) {struct irq_desc *desc;struct irq_cfg *cfg;
drivers/acpi/pci_irq.c +3 -2
@@ -401,7 +401,8 @@ int acpi_pci_irq_enable(struct pci_dev */* Interrupt Line values above 0xF are forbidden */ if (dev->irq >0 && (dev->irq <=0xF )) {printk (" - using IRQ %d\n" , dev->irq); -acpi_register_gsi (dev->irq,ACPI_LEVEL_SENSITIVE , +acpi_register_gsi (&dev->dev, dev->irq, +ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );return 0 ; }else {
@@ -410,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev * } } - rc =acpi_register_gsi (gsi, triggering, polarity); + rc =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (rc <0 ) {dev_warn (&dev->dev,"PCI INT %c: failed to register GSI\n" ,pin_name (pin));
drivers/char/hpet.c +2 -2
@@ -224,7 +224,7 @@ static void hpet_timer_set_irq(struct hpbreak ; } - gsi =acpi_register_gsi (irq,ACPI_LEVEL_SENSITIVE , + gsi =acpi_register_gsi (NULL , irq,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );if (gsi >0 )break ;
@@ -939,7 +939,7 @@ static acpi_status hpet_resources(struct irqp = &res->data.extended_irq;for (i =0 ; i < irqp->interrupt_count; i++) { - irq =acpi_register_gsi (irqp->interrupts[i], + irq =acpi_register_gsi (NULL , irqp->interrupts[i], irqp->triggering, irqp->polarity);if (irq <0 )return AE_ERROR ;
drivers/pnp/pnpacpi/rsparser.c +1 -1
@@ -123,7 +123,7 @@ static void pnpacpi_parse_allocated_irqr } flags =irq_flags (triggering, polarity, shareable); - irq =acpi_register_gsi (gsi, triggering, polarity); + irq =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (irq >=0 )pcibios_penalize_isa_irq (irq,1 );else
include/linux/acpi.h +1 -1
@@ -119,7 +119,7 @@ extern int pci_mmcfg_config_num;extern int sbf_port;extern unsigned long acpi_realmode_flags; -int acpi_register_gsi (u32 gsi,int triggering,int polarity); +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq);#ifdef CONFIG_X86_IO_APIC
[tip:irq/numa] irq: change ACPI GSI APIs to also take a device argument
Commit-ID: a2f809b08ae4dddc1015c7dcd8659e5729e45b3e Gitweb: http://git.kernel.org/tip/a2f809b08ae4dddc1015c7dcd8659e5729e45b3e Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 18:01:20 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:17 +0200
irq: change ACPI GSI APIs to also take a device argument
We want to use dev_to_node() later on, to be aware of the 'home node' of the GSI in question.
[ Impact: cleanup, prepare the IRQ code to be more NUMA aware ]
LKML-Reference: <[email protected]>
--- arch/ia64/kernel/acpi.c | 5 +++-- arch/x86/include/asm/io_apic.h | 4 ++-- arch/x86/include/asm/mpspec.h | 4 +++- arch/x86/kernel/acpi/boot.c | 8 ++++---- arch/x86/kernel/apic/io_apic.c | 3 ++- drivers/acpi/pci_irq.c | 5 +++-- drivers/char/hpet.c | 4 ++-- drivers/pnp/pnpacpi/rsparser.c | 2 +- include/linux/acpi.h | 2 +- 9 files changed, 21 insertions(+), 16 deletions(-)
arch/ia64/kernel/acpi.c +3 -2
@@ -636,7 +636,7 @@ void __init acpi_numa_arch_fixup(void)* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {if (acpi_irq_model ==ACPI_IRQ_MODEL_PLATFORM )return gsi;
@@ -678,7 +678,8 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table) fadt = (struct acpi_table_fadt *)fadt_header; -acpi_register_gsi (fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW ); +acpi_register_gsi (NULL , fadt->sci_interrupt,ACPI_LEVEL_SENSITIVE , +ACPI_ACTIVE_LOW );return 0 ; }
arch/x86/include/asm/io_apic.h +2 -2
@@ -154,8 +154,8 @@ extern int timer_through_8259;extern int io_apic_get_unique_id (int ioapic,int apic_id);extern int io_apic_get_version (int ioapic);extern int io_apic_get_redir_entries (int ioapic); -extern int io_apic_set_pci_routing (int ioapic,int pin,int irq, -int edge_level,int active_high_low); +extern int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin, +int irq,int edge_level,int active_high_low);#endif /* CONFIG_ACPI */ extern int (*ioapic_renumber_irq)(int ioapic,int irq);
arch/x86/include/asm/mpspec.h +3 -1
@@ -72,7 +72,9 @@ extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);extern void mp_override_legacy_irq (u8 bus_irq,u8 polarity,u8 trigger,u32 gsi);extern void mp_config_acpi_legacy_irqs (void ); -extern int mp_register_gsi (u32 gsi,int edge_level,int active_high_low); +struct device ; +extern int mp_register_gsi (struct device *dev,u32 gsi,int edge_level, +int active_high_low);extern int acpi_probe_gsi (void );#ifdef CONFIG_X86_IO_APIC extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
arch/x86/kernel/acpi/boot.c +4 -4
@@ -522,7 +522,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)* success: return IRQ number (>=0) * failure: return < 0 */ -int acpi_register_gsi (u32 gsi,int triggering,int polarity) +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {unsigned int irq;unsigned int plat_gsi = gsi;
@@ -539,7 +539,7 @@ int acpi_register_gsi(u32 gsi, int triggering, int polarity)#ifdef CONFIG_X86_IO_APIC if (acpi_irq_model ==ACPI_IRQ_MODEL_IOAPIC ) { - plat_gsi =mp_register_gsi (gsi, triggering, polarity); + plat_gsi =mp_register_gsi (dev, gsi, triggering, polarity); }#endif acpi_gsi_to_irq (plat_gsi, &irq);
@@ -1158,7 +1158,7 @@ void __init mp_config_acpi_legacy_irqs(void) } } -int mp_register_gsi (u32 gsi,int triggering,int polarity) +int mp_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity) {int ioapic;int ioapic_pin;
@@ -1253,7 +1253,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) } }#endif -io_apic_set_pci_routing (ioapic, ioapic_pin, gsi, +io_apic_set_pci_routing (dev, ioapic, ioapic_pin, gsi, triggering ==ACPI_EDGE_SENSITIVE ?0 :1 , polarity ==ACPI_ACTIVE_HIGH ?0 :1 );return gsi;
arch/x86/kernel/apic/io_apic.c +2 -1
@@ -3958,7 +3958,8 @@ int __init io_apic_get_version(int ioapic) }#endif -int io_apic_set_pci_routing (int ioapic,int pin,int irq,int triggering,int polarity) +int io_apic_set_pci_routing (struct device *dev,int ioapic,int pin,int irq, +int triggering,int polarity) {struct irq_desc *desc;struct irq_cfg *cfg;
drivers/acpi/pci_irq.c +3 -2
@@ -401,7 +401,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)/* Interrupt Line values above 0xF are forbidden */ if (dev->irq >0 && (dev->irq <=0xF )) {printk (" - using IRQ %d\n" , dev->irq); -acpi_register_gsi (dev->irq,ACPI_LEVEL_SENSITIVE , +acpi_register_gsi (&dev->dev, dev->irq, +ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );return 0 ; }else {
@@ -410,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } } - rc =acpi_register_gsi (gsi, triggering, polarity); + rc =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (rc <0 ) {dev_warn (&dev->dev,"PCI INT %c: failed to register GSI\n" ,pin_name (pin));
drivers/char/hpet.c +2 -2
@@ -224,7 +224,7 @@ static void hpet_timer_set_irq(struct hpet_dev *devp)break ; } - gsi =acpi_register_gsi (irq,ACPI_LEVEL_SENSITIVE , + gsi =acpi_register_gsi (NULL , irq,ACPI_LEVEL_SENSITIVE ,ACPI_ACTIVE_LOW );if (gsi >0 )break ;
@@ -939,7 +939,7 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) irqp = &res->data.extended_irq;for (i =0 ; i < irqp->interrupt_count; i++) { - irq =acpi_register_gsi (irqp->interrupts[i], + irq =acpi_register_gsi (NULL , irqp->interrupts[i], irqp->triggering, irqp->polarity);if (irq <0 )return AE_ERROR ;
drivers/pnp/pnpacpi/rsparser.c +1 -1
@@ -123,7 +123,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, } flags =irq_flags (triggering, polarity, shareable); - irq =acpi_register_gsi (gsi, triggering, polarity); + irq =acpi_register_gsi (&dev->dev, gsi, triggering, polarity);if (irq >=0 )pcibios_penalize_isa_irq (irq,1 );else
include/linux/acpi.h +1 -1
@@ -119,7 +119,7 @@ extern int pci_mmcfg_config_num;extern int sbf_port;extern unsigned long acpi_realmode_flags; -int acpi_register_gsi (u32 gsi,int triggering,int polarity); +int acpi_register_gsi (struct device *dev,u32 gsi,int triggering,int polarity);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq);#ifdef CONFIG_X86_IO_APIC
PATCH 7/9 irq: make io_apic_set_pci_routing to use device
In reply to Yinghai LuImpact: dev_to_node(dev)
so use right node in irq_desc_alloc_node()
--- arch/x86/kernel/apic/io_apic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/io_apic.c +6 -1
@@ -3856,7 +3856,7 @@ int io_apic_set_pci_routing(struct devic {struct irq_desc *desc;struct irq_cfg *cfg; -int node =cpu_to_node (boot_cpu_id); +int node;if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3864,6 +3864,11 @@ int io_apic_set_pci_routing(struct devicreturn -EINVAL ; } +if (dev) + node =dev_to_node (dev); +else + node =cpu_to_node (boot_cpu_id); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);
PATCH 7/9 irq: make io_apic_set_pci_routing to use device
Impact: dev_to_node(dev)
so use right node in irq_desc_alloc_node()
--- arch/x86/kernel/apic/io_apic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/io_apic.c +6 -1
@@ -3921,7 +3921,7 @@ int io_apic_set_pci_routing(struct devic {struct irq_desc *desc;struct irq_cfg *cfg; -int node =cpu_to_node (boot_cpu_id); +int node;if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3929,6 +3929,11 @@ int io_apic_set_pci_routing(struct devicreturn -EINVAL ; } +if (dev) + node =dev_to_node (dev); +else + node =cpu_to_node (boot_cpu_id); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);
[tip:irq/numa] irq: change io_apic_set_pci_routing() to use device parameter
Commit-ID: 024154cfdd802654cb236a18c78b6e37351e2c49 Gitweb: http://git.kernel.org/tip/024154cfdd802654cb236a18c78b6e37351e2c49 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 18:01:50 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:18 +0200
irq: change io_apic_set_pci_routing() to use device parameter
Make actual use of the device parameter passed down to io_apic_set_pci_routing() - to have the IRQ descriptor on the home node of the device.
If no device has been passed down, we assume it's a platform device and use the boot node ID for the IRQ descriptor.
[ Impact: optimization, make IO-APIC code more NUMA aware ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/io_apic.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/x86/kernel/apic/io_apic.c +6 -1
@@ -3963,7 +3963,7 @@ int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq, {struct irq_desc *desc;struct irq_cfg *cfg; -int node =cpu_to_node (boot_cpu_id); +int node;if (!IO_APIC_IRQ (irq)) { apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -3971,6 +3971,11 @@ int io_apic_set_pci_routing(struct device *dev, int ioapic, int pin, int irq,return -EINVAL ; } +if (dev) + node =dev_to_node (dev); +else + node =cpu_to_node (boot_cpu_id); + desc =irq_to_desc_alloc_node (irq, node);if (!desc) {printk (KERN_INFO "can not get irq_desc %d\n" , irq);
PATCH 8/9 x86/irq: make MSI irq_desc numa aware
In reply to Yinghai LuImpact: use irq_desc_alloc_node
try to get irq_desc on the node in create_irq_nr
--- arch/x86/kernel/apic/io_apic.c | 15 +++++++++++---- include/linux/irq.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +11 -4
@@ -3065,14 +3065,13 @@ static int nr_irqs_gsi = NR_IRQS_LEGACY;/* * Dynamic irq allocate and deallocation */ -unsigned int create_irq_nr (unsigned int irq_want) +unsigned int create_irq_nr (unsigned int irq_want,int node) {/* Allocate an unused irq */ unsigned int irq;unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3090,6 +3089,11 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; + +/* different node ?*/ +if (desc_new->node != node) +continue ; +if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;break ;
@@ -3107,11 +3111,12 @@ unsigned int create_irq_nr(unsigned intint create_irq (void ) { +int node =cpu_to_node (boot_cpu_id);unsigned int irq_want;int irq; irq_want = nr_irqs_gsi; - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 ) irq =-1 ;
@@ -3369,15 +3374,17 @@ int arch_setup_msi_irqs(struct pci_dev *unsigned int irq_want;struct intel_iommu *iommu =NULL ;int index =0 ; +int node;/* x86 doesn't support multiple MSI yet */ if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; + node =dev_to_node (&dev->dev); irq_want = nr_irqs_gsi; sub_handle =0 ;list_for_each_entry (msidesc, &dev->msi_list, list) { - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 )return -1 ; irq_want = irq +1 ;
include/linux/irq.h +1 -1
@@ -374,7 +374,7 @@ extern void set_irq_noprobe(unsigned intextern void set_irq_probe (unsigned int irq);/* Handle dynamic irq creation and destruction */ -extern unsigned int create_irq_nr (unsigned int irq_want); +extern unsigned int create_irq_nr (unsigned int irq_want,int node);extern int create_irq (void );extern void destroy_irq (unsigned int irq);
PATCH 8/9 x86/irq: make MSI irq_desc numa aware -v2
try to get irq_desc on the node in create_irq_nr
v2: don't check if we can move it when sparse_irq is not used [ Impact: use irq_desc_alloc_node ]
--- arch/x86/kernel/apic/io_apic.c | 17 +++++++++++++---- include/linux/irq.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +13 -4
@@ -3027,14 +3027,13 @@ static int nr_irqs_gsi = NR_IRQS_LEGACY;/* * Dynamic irq allocate and deallocation */ -unsigned int create_irq_nr (unsigned int irq_want) +unsigned int create_irq_nr (unsigned int irq_want,int node) {/* Allocate an unused irq */ unsigned int irq;unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3052,6 +3051,13 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; + +#ifdef CONFIG_SPARSE_IRQ +/* different node ?*/ +if (desc_new->node != node) +continue ; +#endif +if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;break ;
@@ -3069,11 +3075,12 @@ unsigned int create_irq_nr(unsigned intint create_irq (void ) { +int node =cpu_to_node (boot_cpu_id);unsigned int irq_want;int irq; irq_want = nr_irqs_gsi; - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 ) irq =-1 ;
@@ -3331,15 +3338,17 @@ int arch_setup_msi_irqs(struct pci_dev *unsigned int irq_want;struct intel_iommu *iommu =NULL ;int index =0 ; +int node;/* x86 doesn't support multiple MSI yet */ if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; + node =dev_to_node (&dev->dev); irq_want = nr_irqs_gsi; sub_handle =0 ;list_for_each_entry (msidesc, &dev->msi_list, list) { - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 )return -1 ; irq_want = irq +1 ;
include/linux/irq.h +1 -1
@@ -374,7 +374,7 @@ extern void set_irq_noprobe(unsigned intextern void set_irq_probe (unsigned int irq);/* Handle dynamic irq creation and destruction */ -extern unsigned int create_irq_nr (unsigned int irq_want); +extern unsigned int create_irq_nr (unsigned int irq_want,int node);extern int create_irq (void );extern void destroy_irq (unsigned int irq);
PATCH 8/9 x86/irq: make MSI irq_desc numa aware -v3
In reply to Yinghai Lutry to get irq_desc on the node in create_irq_nr
v2: don't check if we can move it when sparse_irq is not used
v3: use move_irq_des, if that node is not what we want [ Impact: use irq_desc_alloc_node ]
--- arch/x86/kernel/apic/io_apic.c | 17 +++++++++++++---- include/linux/irq.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +13 -4
@@ -3130,14 +3130,13 @@ static int nr_irqs_gsi = NR_IRQS_LEGACY;/* * Dynamic irq allocate and deallocation */ -unsigned int create_irq_nr (unsigned int irq_want) +unsigned int create_irq_nr (unsigned int irq_want,int node) {/* Allocate an unused irq */ unsigned int irq;unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3155,6 +3154,13 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; + +#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif +if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;break ;
@@ -3172,11 +3178,12 @@ unsigned int create_irq_nr(unsigned intint create_irq (void ) { +int node =cpu_to_node (boot_cpu_id);unsigned int irq_want;int irq; irq_want = nr_irqs_gsi; - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 ) irq =-1 ;
@@ -3434,15 +3441,17 @@ int arch_setup_msi_irqs(struct pci_dev *unsigned int irq_want;struct intel_iommu *iommu =NULL ;int index =0 ; +int node;/* x86 doesn't support multiple MSI yet */ if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; + node =dev_to_node (&dev->dev); irq_want = nr_irqs_gsi; sub_handle =0 ;list_for_each_entry (msidesc, &dev->msi_list, list) { - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 )return -1 ; irq_want = irq +1 ;
include/linux/irq.h +1 -1
@@ -376,7 +376,7 @@ extern void set_irq_noprobe(unsigned intextern void set_irq_probe (unsigned int irq);/* Handle dynamic irq creation and destruction */ -extern unsigned int create_irq_nr (unsigned int irq_want); +extern unsigned int create_irq_nr (unsigned int irq_want,int node);extern int create_irq (void );extern void destroy_irq (unsigned int irq);
Re: [PATCH 8/9] x86/irq: make MSI irq_desc numa aware -v3
arch/x86/kernel/apic/io_apic.c unsigned int create_irq_nr(unsigned int · line 3162
Quoted 5 lines · Yinghai Lu
arch/x86/kernel/apic/io_apic.c +5
-0+#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif
this should have been CONFIG_NUMA_MIGRATE_IRQ_DESC. But even with that fixed, CONFIG_NUMA_MIGRATE_IRQ_DESC is _removed_ in the #2 patch in your series and never reintroduced!
I've fixed these two bugs in the series and i'm thinking about applying them, but this really makes me think how much testing you've put into this code.
You really should check that the feature actually does what you think, that it can be enabled and you should also check the before/after layout of irq descriptors on a NUMA box.
Ingo
Re: [PATCH 8/9] x86/irq: make MSI irq_desc numa aware -v3
Quoted 11 lines · Ingo Molnar
arch/x86/kernel/apic/io_apic.c unsigned int create_irq_nr(unsigned int · line 3162
Quoted 5 lines · Yinghai Lu
arch/x86/kernel/apic/io_apic.c +5
-0+#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif this should have been
CONFIG_NUMA_MIGRATE_IRQ_DESC. But even with that fixed,CONFIG_NUMA_MIGRATE_IRQ_DESCis _removed_ in the #2 patch in your series and never reintroduced!
should change that to CONFIG_SPARSE_IRQ
YH
Re: [PATCH 8/9] x86/irq: make MSI irq_desc numa aware -v3
Quoted 13 lines · Yinghai Lu
Quoted 11 lines · Ingo Molnar
arch/x86/kernel/apic/io_apic.c unsigned int create_irq_nr(unsigned int · line 3162
Quoted 5 lines · Yinghai Lu
arch/x86/kernel/apic/io_apic.c +5
-0+#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif this should have been
CONFIG_NUMA_MIGRATE_IRQ_DESC. But even with that fixed,CONFIG_NUMA_MIGRATE_IRQ_DESCis _removed_ in the #2 patch in your series and never reintroduced!
Quoted 1 line
should change that to
CONFIG_SPARSE_IRQ
That's sensible too.
Ingo
Re: [PATCH 8/9] x86/irq: make MSI irq_desc numa aware -v3
Quoted 13 lines · Ingo Molnar
Quoted 11 lines · Yinghai Lu
Quoted 10 lines · Ingo Molnar
arch/x86/kernel/apic/io_apic.c unsigned int create_irq_nr(unsigned int · line 3162
Quoted 5 lines · Yinghai Lu
arch/x86/kernel/apic/io_apic.c +5
-0+#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif this should have been
CONFIG_NUMA_MIGRATE_IRQ_DESC. But even with that fixed,CONFIG_NUMA_MIGRATE_IRQ_DESCis _removed_ in the #2 patch in your series and never reintroduced!
Quoted 4 lines
Quoted 1 line
should change that to
CONFIG_SPARSE_IRQThat's sensible too.
do you mean add back CONFIG_NUMA_IRQ_DESC?
YH
Re: [PATCH 8/9] x86/irq: make MSI irq_desc numa aware -v3
Quoted 14 lines · Yinghai Lu
Quoted 13 lines · Ingo Molnar
Quoted 11 lines · Yinghai Lu
Quoted 10 lines · Ingo Molnar
arch/x86/kernel/apic/io_apic.c unsigned int create_irq_nr(unsigned int · line 3162
Quoted 5 lines · Yinghai Lu
arch/x86/kernel/apic/io_apic.c +5
-0+#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif this should have been
CONFIG_NUMA_MIGRATE_IRQ_DESC. But even with that fixed,CONFIG_NUMA_MIGRATE_IRQ_DESCis _removed_ in the #2 patch in your series and never reintroduced!
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
should change that to
CONFIG_SPARSE_IRQThat's sensible too.
do you mean add back
CONFIG_NUMA_IRQ_DESC?
No, what i thought to be sensible is to make this behavior part of CONFIG_SPARSE_IRQ=y. We dont want a zillion of config options.
Ingo
PATCH 1/1 x86/irq: using move_irq_desc
move_irq_desc will try to move irq_desc to node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)
[ Impact: make irq_desc go with device on node ]
--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -5
@@ -3155,11 +3155,7 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; -#ifdef CONFIG_NUMA_IRQ_DESC -/* different node ?*/ -if (desc_new->node != node) - desc =move_irq_desc (desc, node); -#endif + desc_new =move_irq_desc (desc_new, node);if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;
include/linux/irq.h +4 -0
@@ -206,6 +206,10 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; +static inline struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) +{ +return desc; +}#else /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node);#endif /* CONFIG_SPARSE_IRQ */
Ingo Molnar
AppliedRe: [PATCH] x86/irq: using move_irq_desc
Quoted 5 lines · Yinghai Lu
move_irq_descwill try to moveirq_descto node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)
Quoted 8 lines
[ Impact: make
irq_descgo with device on node ]Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)
applied, thanks. I'll look into merging it into the irq tree tomorrow and testing it.
Ingo
Re: [PATCH] x86/irq: using move_irq_desc
Quoted 12 lines · Ingo Molnar
Quoted 9 lines · Yinghai Lu
move_irq_descwill try to moveirq_descto node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)[ Impact: make
irq_descgo with device on node ]Signed-off-by Yinghai Lu <[email protected]>
Quoted 7 lines
Quoted 4 lines
--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)applied, thanks. I'll look into merging it into the irq tree tomorrow and testing it.
gave it a brief try and got:
kernel/irq/numa_migrate.c: In function ‘init_copy_one_irq_desc’:kernel/irq/numa_migrate.c:46: error: ‘struct irq_desc’ has no member named ‘node’ kernel/irq/numa_migrate.c: In function ‘move_irq_desc’:kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’ kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’ kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’
Ingo
Re: [PATCH] x86/irq: using move_irq_desc
Quoted 19 lines · Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 6 lines · Yinghai Lu
move_irq_descwill try to moveirq_descto node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)[ Impact: make
irq_descgo with device on node ]Quoted 8 lines
Quoted 6 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)applied, thanks. I'll look into merging it into the irq tree tomorrow and testing it.
Quoted 9 lines
gave it a brief try and got:
kernel/irq/numa_migrate.c: In function ‘init_copy_one_irq_desc’:kernel/irq/numa_migrate.c:46: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c: In function ‘move_irq_desc’:kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’
.config?
YH
Re: [PATCH] x86/irq: using move_irq_desc
In reply to Ingo MolnarQuoted 19 lines · Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 6 lines · Yinghai Lu
move_irq_descwill try to moveirq_descto node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)[ Impact: make
irq_descgo with device on node ]Quoted 8 lines
Quoted 6 lines
Signed-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-)applied, thanks. I'll look into merging it into the irq tree tomorrow and testing it.
Quoted 8 lines
gave it a brief try and got:
kernel/irq/numa_migrate.c: In function ‘init_copy_one_irq_desc’:kernel/irq/numa_migrate.c:46: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c: In function ‘move_irq_desc’:kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’kernel/irq/numa_migrate.c:114: error: ‘struct irq_desc’ has no member named ‘node’
[PATCH] x86/irq: using move_irq_desc -v2
move_irq_desc will try to move irq_desc to node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)
v2: fix non smp compiling
[ Impact: make irq_desc go with device on node ]
--- arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 11 +++++++++-- kernel/irq/Makefile | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -5
@@ -3155,11 +3155,7 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; -#ifdef CONFIG_NUMA_IRQ_DESC -/* different node ?*/ -if (desc_new->node != node) - desc =move_irq_desc (desc, node); -#endif + desc_new =move_irq_desc (desc_new, node);if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;
include/linux/irq.h +9 -2
@@ -206,9 +206,16 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ +#endif + +#if defined(CONFIG_SPARSE_IRQ ) && defined(CONFIG_SMP )extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node); -#endif /* CONFIG_SPARSE_IRQ */ +#else +static inline struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) +{ +return desc; +} +#endif extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);
kernel/irq/Makefile +2 -0
@@ -3,5 +3,7 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o +ifdef CONFIG_SMP obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o +endif obj-$(CONFIG_PM_SLEEP) += pm.o
Re: [PATCH] x86/irq: using move_irq_desc
kernel/irq/Makefile obj-y := handle.o manage.o spurious.o re · line 8
Quoted 5 lines · Yinghai Lu
kernel/irq/Makefile +3
-0+#if defined(CONFIG_SPARSE_IRQ) && defined(CONFIG_SMP) +ifdef CONFIG_SMP obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o +endif
hm, seeing such complicatons calls for the reintroduction CONFIG_NUMA_IRQ_DESC - but plese make it a non-interactive helper kconfig symbol, ok?
I.e. something like this:
config NUMA_IRQ_DESC
def_bool y
depends on SPARSE_IRQ && NUMAthis way we dont have yet another .config variant - and still have nicer looking #ifdefs and makefile rules.
Ingo
PATCH 1/1 x86/irq: using move_irq_desc -v3
move_irq_desc will try to move irq_desc to node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, drivers are loaded and unloaded randomly)
v2: fix no smp compiling
v3: add NUMA_IRQ_DESC to make MACRO simple
[ Impact: make irq_desc go with device on node ]
--- arch/x86/Kconfig | 4 ++++ arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 11 +++++++++-- kernel/irq/Makefile | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -5
@@ -3155,11 +3155,7 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; -#ifdef CONFIG_NUMA_IRQ_DESC -/* different node ?*/ -if (desc_new->node != node) - desc =move_irq_desc (desc, node); -#endif + desc_new =move_irq_desc (desc_new, node);if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;
include/linux/irq.h +9 -2
@@ -206,9 +206,16 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ +#endif + +#ifdef CONFIG_NUMA_IRQ_DESC extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node); -#endif /* CONFIG_SPARSE_IRQ */ +#else +static inline struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) +{ +return desc; +} +#endif extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);
kernel/irq/Makefile +1 -1
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o +obj-$(CONFIG_NUMA_IRQ_DESC) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
arch/x86/Kconfig +4 -0
@@ -280,6 +280,10 @@ config SPARSE_IRQ If you don't know what to do here, say N. +config NUMA_IRQ_DESC + def_bool y + depends on SPARSE_IRQ && NUMA + config X86_MPPARSE bool "Enable MPS table" if ACPI default y
[tip:irq/numa] x86/irq: use move_irq_desc() in create_irq_nr()
Commit-ID: 15e957d08dd4a841359cfec59ecb74041e0097aa Gitweb: http://git.kernel.org/tip/15e957d08dd4a841359cfec59ecb74041e0097aa Author: Yinghai Lu <[email protected]> AuthorDate: Thu, 30 Apr 2009 01:17:50 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 1 May 2009 19:01:12 +0200
x86/irq: use move_irq_desc() in create_irq_nr()
move_irq_desc() will try to move irq_desc to the home node if the allocated one is not correct, in create_irq_nr().
( This can happen on devices that are on different nodes that
are using MSI, when drivers are loaded and unloaded randomly. )
v2: fix non-smp build
v3: add NUMA_IRQ_DESC to eliminate #ifdefs
[ Impact: improve irq descriptor locality on NUMA systems ]
LKML-Reference: <[email protected]>
--- arch/x86/Kconfig | 4 ++++ arch/x86/kernel/apic/io_apic.c | 6 +----- include/linux/irq.h | 11 +++++++++-- kernel/irq/Makefile | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-)
arch/x86/Kconfig +4 -0
@@ -274,6 +274,10 @@ config SPARSE_IRQ If you don't know what to do here, say N. +config NUMA_IRQ_DESC + def_bool y + depends on SPARSE_IRQ && NUMA + config X86_MPPARSE bool "Enable MPS table" if ACPI default y
arch/x86/kernel/apic/io_apic.c +1 -5
@@ -3197,11 +3197,7 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)if (cfg_new->vector !=0 )continue ; -#ifdef CONFIG_NUMA_IRQ_DESC -/* different node ?*/ -if (desc_new->node != node) - desc =move_irq_desc (desc, node); -#endif + desc_new =move_irq_desc (desc_new, node);if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;
include/linux/irq.h +9 -2
@@ -206,9 +206,16 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ +#endif + +#ifdef CONFIG_NUMA_IRQ_DESC extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node); -#endif /* CONFIG_SPARSE_IRQ */ +#else +static inline struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) +{ +return desc; +} +#endif extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);
kernel/irq/Makefile +1 -1
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o resend.o chip.o devres.o obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o +obj-$(CONFIG_NUMA_IRQ_DESC) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
PATCH 1/1 x86/irq: use move_irq_desc only when CONFIG_NUMA_IRQ_DESC is set
In reply to Ingo Molnaradd config NUMA_IRQ_DESC, and create_irq_nr(), it will call move_irq_desc.
move_irq_desc will try to move irq_desc to node wanted if allocated one is not correct. (happen on device on different nodes that are using MSI, driver are loaded and unloaded randomly)
[ Impact: make irq_desc go with device on node ]
--- arch/x86/Kconfig | 9 +++++++++ arch/x86/kernel/apic/io_apic.c | 18 +++++++++++------- include/linux/irq.h | 11 +++++++++-- kernel/irq/Makefile | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-)
arch/x86/Kconfig +9 -0
@@ -280,6 +280,15 @@ config SPARSE_IRQ If you don't know what to do here, say N. +config NUMA_IRQ_DESC + bool "put irq desc on numa node memory" + depends on SPARSE_IRQ && NUMA + default n + ---help--- + This enables irq_desc to cpu/node that that device is connected. + + If you don't know what to do here, say N. + config X86_MPPARSE bool "Enable MPS table" if ACPI default y
arch/x86/kernel/apic/io_apic.c +11 -7
@@ -246,7 +246,7 @@ int arch_init_chip_data(struct irq_descreturn 0 ; } -/* for move_irq_desc */ +#ifdef CONFIG_NUMA_IRQ_DESC static void init_copy_irq_2_pin (struct irq_cfg *old_cfg,struct irq_cfg *cfg,int node) {
@@ -347,7 +347,7 @@ void arch_free_chip_data(struct irq_desc old_desc->chip_data = NULL; } } -/* end for move_irq_desc */ +#endif #else static struct irq_cfg *irq_cfg (unsigned int irq)
@@ -3143,6 +3143,10 @@ unsigned int create_irq_nr(unsigned intif (irq_want < nr_irqs_gsi) irq_want = nr_irqs_gsi; +#ifndef CONFIG_NUMA_IRQ_DESC + node =cpu_to_node (boot_cpu_id); +#endif +spin_lock_irqsave (&vector_lock, flags);for (new = irq_want; new < nr_irqs; new++) { desc_new =irq_to_desc_alloc_node (new, node);
@@ -3155,11 +3159,7 @@ unsigned int create_irq_nr(unsigned intif (cfg_new->vector !=0 )continue ; -#ifdef CONFIG_NUMA_IRQ_DESC -/* different node ?*/ -if (desc_new->node != node) - desc =move_irq_desc (desc, node); -#endif + desc_new =move_irq_desc (desc_new, node);if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;
@@ -3938,10 +3938,14 @@ int io_apic_set_pci_routing(struct devicreturn -EINVAL ; } +#ifdef CONFIG_NUMA_IRQ_DESC if (dev) node =dev_to_node (dev);else node =cpu_to_node (boot_cpu_id); +#else + node =cpu_to_node (boot_cpu_id); +#endif desc =irq_to_desc_alloc_node (irq, node);if (!desc) {
include/linux/irq.h +9 -2
@@ -206,10 +206,17 @@ extern void arch_free_chip_data(struct i#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS ]; -#else /* CONFIG_SPARSE_IRQ */ -extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node);#endif /* CONFIG_SPARSE_IRQ */ +#ifdef CONFIG_NUMA_IRQ_DESC +extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int node); +#else +static inline struct irq_desc *move_irq_desc (struct irq_desc *desc,int node) +{ +return desc; +} +#endif +extern struct irq_desc *irq_to_desc_alloc_node (unsigned int irq,int node);/*
kernel/irq/Makefile +1 -1
@@ -3,5 +3,5 @@ obj-y := handle.o manage.o spurious.o re obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o -obj-$(CONFIG_SPARSE_IRQ) += numa_migrate.o +obj-$(CONFIG_NUMA_IRQ_DESC) += numa_migrate.o obj-$(CONFIG_PM_SLEEP) += pm.o
[tip:irq/numa] x86/irq: change MSI irq_desc to be more numa aware
In reply to Yinghai LuCommit-ID: d047f53a2ecce37e3bdf79eac5a326fbaadb3628 Gitweb: http://git.kernel.org/tip/d047f53a2ecce37e3bdf79eac5a326fbaadb3628 Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 18:02:23 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:18 +0200
x86/irq: change MSI irq_desc to be more numa aware
Try to get irq_desc on the home node in create_irq_nr().
v2: don't check if we can move it when sparse_irq is not used
v3: use move_irq_des, if that node is not what we want
[ Impact: optimization, make MSI IRQ descriptors more NUMA aware ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/io_apic.c | 17 +++++++++++++---- include/linux/irq.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +13 -4
@@ -3172,14 +3172,13 @@ static int nr_irqs_gsi = NR_IRQS_LEGACY;/* * Dynamic irq allocate and deallocation */ -unsigned int create_irq_nr (unsigned int irq_want) +unsigned int create_irq_nr (unsigned int irq_want,int node) {/* Allocate an unused irq */ unsigned int irq;unsigned int new;unsigned long flags;struct irq_cfg *cfg_new =NULL ; -int node =cpu_to_node (boot_cpu_id);struct irq_desc *desc_new =NULL ; irq =0 ;
@@ -3197,6 +3196,13 @@ unsigned int create_irq_nr(unsigned int irq_want)if (cfg_new->vector !=0 )continue ; + +#ifdef CONFIG_NUMA_IRQ_DESC +/* different node ?*/ +if (desc_new->node != node) + desc =move_irq_desc (desc, node); +#endif +if (__assign_irq_vector (new, cfg_new, apic->target_cpus ()) ==0 ) irq = new;break ;
@@ -3214,11 +3220,12 @@ unsigned int create_irq_nr(unsigned int irq_want)int create_irq (void ) { +int node =cpu_to_node (boot_cpu_id);unsigned int irq_want;int irq; irq_want = nr_irqs_gsi; - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 ) irq =-1 ;
@@ -3476,15 +3483,17 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)unsigned int irq_want;struct intel_iommu *iommu =NULL ;int index =0 ; +int node;/* x86 doesn't support multiple MSI yet */ if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; + node =dev_to_node (&dev->dev); irq_want = nr_irqs_gsi; sub_handle =0 ;list_for_each_entry (msidesc, &dev->msi_list, list) { - irq =create_irq_nr (irq_want); + irq =create_irq_nr (irq_want, node);if (irq ==0 )return -1 ; irq_want = irq +1 ;
include/linux/irq.h +1 -1
@@ -376,7 +376,7 @@ extern void set_irq_noprobe(unsigned int irq);extern void set_irq_probe (unsigned int irq);/* Handle dynamic irq creation and destruction */ -extern unsigned int create_irq_nr (unsigned int irq_want); +extern unsigned int create_irq_nr (unsigned int irq_want,int node);extern int create_irq (void );extern void destroy_irq (unsigned int irq);
Re: [PATCH 1/9] x86/irq: remove NUMA_MIGRATE_IRQ_DESC
In reply to Yinghai LuOK, this series looks very nice now.
Suresh, Eric, does it look good to you too? (please send Acks if so)
Ingo
PATCH 9/9 irq: make ht irq_desc numa aware
In reply to Yinghai LuImpact: use create_irq_nr
try to get irq_desc on the node with create_irq_nr
--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/htirq.c +3 -1
@@ -98,6 +98,7 @@ int __ht_create_irq(struct pci_dev *dev,int max_irq;int pos;int irq; +int node; pos =pci_find_ht_capability (dev,HT_CAPTYPE_IRQ );if (!pos)
@@ -125,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, cfg->msg.address_lo =0xffffffff ; cfg->msg.address_hi =0xffffffff ; - irq =create_irq (); + node =dev_to_node (&dev->dev); + irq =create_irq_nr (0 , node);if (irq <=0 ) {kfree (cfg);
PATCH 9/9 irq: make ht irq_desc numa aware
Impact: use create_irq_nr
try to get irq_desc on the node with create_irq_nr
--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/htirq.c +3 -1
@@ -98,6 +98,7 @@ int __ht_create_irq(struct pci_dev *dev,int max_irq;int pos;int irq; +int node; pos =pci_find_ht_capability (dev,HT_CAPTYPE_IRQ );if (!pos)
@@ -125,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, cfg->msg.address_lo =0xffffffff ; cfg->msg.address_hi =0xffffffff ; - irq =create_irq (); + node =dev_to_node (&dev->dev); + irq =create_irq_nr (0 , node);if (irq <=0 ) {kfree (cfg);
Re: [PATCH 9/9] irq: make ht irq_desc numa aware
Quoted 8 lines · Yinghai Lu
Try to get
irq_descon the same node ascreate_irq_nr().[ Impact: optimization, make HT IRQs more NUMA-aware ]
Signed-off-by Yinghai Lu <[email protected]>--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Looks good - but this really needs an Ack from Jesse (Cc:-ed) before we can pick it up into the irq tree.
Ingo
Re: [PATCH 9/9] irq: make ht irq_desc numa aware
Quoted 7 lines · On Tue, 28 Apr 2009 12:19:17 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 4 lines · Yinghai Lu
Try to get
irq_descon the same node ascreate_irq_nr().[ Impact: optimization, make HT IRQs more NUMA-aware ]
Quoted 7 lines
Quoted 4 lines
Signed-off-by Yinghai Lu <[email protected]>--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Looks good - but this really needs an Ack from Jesse (Cc:-ed) before we can pick it up into the irq tree.
Looks fine. I had to look up what the first arg of create_irq_nr meant (maybe we should have an IRQ_NR_ANY #define for that?), but otherwise it looks fine.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Jesse Barnes
Acked-byRe: [PATCH 9/9] irq: make ht irq_desc numa aware
In reply to Ingo MolnarQuoted 7 lines · On Tue, 28 Apr 2009 12:19:17 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 4 lines · Yinghai Lu
Try to get
irq_descon the same node ascreate_irq_nr().[ Impact: optimization, make HT IRQs more NUMA-aware ]
Quoted 7 lines
Quoted 4 lines
Signed-off-by Yinghai Lu <[email protected]>--- drivers/pci/htirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Looks good - but this really needs an Ack from Jesse (Cc:-ed) before we can pick it up into the irq tree.
Oh sorry meant to add:
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
[tip:irq/numa] irq: make ht irq_desc more numa aware
In reply to Yinghai LuCommit-ID: 56b581ea9591b5767b1e0204c6a06c7d0c49396e Gitweb: http://git.kernel.org/tip/56b581ea9591b5767b1e0204c6a06c7d0c49396e Author: Yinghai Lu <[email protected]> AuthorDate: Mon, 27 Apr 2009 18:02:46 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 28 Apr 2009 12:21:19 +0200
irq: make ht irq_desc more numa aware
Try to get irq_desc on the same node as create_irq_nr().
[ Impact: optimization, make HT IRQs more NUMA-aware ]
LKML-Reference: <[email protected]>
--- drivers/pci/htirq.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/pci/htirq.c +3 -1
@@ -98,6 +98,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)int max_irq;int pos;int irq; +int node; pos =pci_find_ht_capability (dev,HT_CAPTYPE_IRQ );if (!pos)
@@ -125,7 +126,8 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update) cfg->msg.address_lo =0xffffffff ; cfg->msg.address_hi =0xffffffff ; - irq =create_irq (); + node =dev_to_node (&dev->dev); + irq =create_irq_nr (0 , node);if (irq <=0 ) {kfree (cfg);
[tip:irq/urgent] x86/irq: mark NUMA_MIGRATIE_IRQ_DESC broken
In reply to Yinghai LuCommit-ID: c822f79d3a5a7e53763e5a5c2dadc27cdd240504 Gitweb: http://git.kernel.org/tip/c822f79d3a5a7e53763e5a5c2dadc27cdd240504 Author: Yinghai Lu <[email protected]> AuthorDate: Wed, 15 Apr 2009 18:39:13 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 17 Apr 2009 02:56:52 +0200
x86/irq: mark NUMA_MIGRATIE_IRQ_DESC broken
It causes crash on system with lots of cards with MSI-X when irq_balancer enabled...
The patches fixing it were both complex and fragile, according to Eric they were also doing quite dangerous things to the hardware.
Instead we now have patches that solve this problem via static NUMA node mappings - not dynamic allocation and balancing.
The patches are much simpler than this method but are still too large outside of the merge window, so we mark the dynamic balancer as broken for now, and queue up the new approach for v2.6.31.
[ Impact: deactivate broken kernel feature ]
LKML-Reference: <[email protected]>
--- arch/x86/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/Kconfig +1 -0
@@ -277,6 +277,7 @@ config SPARSE_IRQ config NUMA_MIGRATE_IRQ_DESC bool "Move irq desc when changing irq smp_affinity" depends on SPARSE_IRQ && NUMA + depends on BROKEN default n ---help--- This enables moving irq_desc to cpu/node that irq will use handled.
[tip:irq/urgent] x86/irq: mark NUMA_MIGRATE_IRQ_DESC broken
In reply to Yinghai LuCommit-ID: ca713c2ab0eea3458962983e4a7e13430ea479b8 Gitweb: http://git.kernel.org/tip/ca713c2ab0eea3458962983e4a7e13430ea479b8 Author: Yinghai Lu <[email protected]> AuthorDate: Wed, 15 Apr 2009 18:39:13 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 17 Apr 2009 03:20:01 +0200
x86/irq: mark NUMA_MIGRATE_IRQ_DESC broken
It causes crash on system with lots of cards with MSI-X when irq_balancer enabled...
The patches fixing it were both complex and fragile, according to Eric they were also doing quite dangerous things to the hardware.
Instead we now have patches that solve this problem via static NUMA node mappings - not dynamic allocation and balancing.
The patches are much simpler than this method but are still too large outside of the merge window, so we mark the dynamic balancer as broken for now, and queue up the new approach for v2.6.31.
[ Impact: deactivate broken kernel feature ]
LKML-Reference: <[email protected]>
--- arch/x86/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/Kconfig +1 -0
@@ -277,6 +277,7 @@ config SPARSE_IRQ config NUMA_MIGRATE_IRQ_DESC bool "Move irq desc when changing irq smp_affinity" depends on SPARSE_IRQ && NUMA + depends on BROKEN default n ---help--- This enables moving irq_desc to cpu/node that irq will use handled.