sparseirq / irq updates for v2.6.29
Subsystems (7)
Linus,
Please pull the latest irq-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-core-for-linus
Most of the changes here are related to enable and implement sparseirq support on x86.
This feature changes the 'struct irq_desc irq_desc[NR_IRQS]' array into 'struct irq_desc *irq_desc[NR_IRQS]' array, with full compatibility to architectures that have not implemented sparse IRQ support yet, or do not need (or want) this IRQ array layout.
This is done to allow distributions to set CONFIG_NR_CPUS to 4096 in their generic x86 kernels, without having the overhead of multi-megabyte static [NR_IRQS] dimensioned arrays in the kernel.
There's also performance advantage on NUMA (irq_desc / irq_cfg array entries are better separated between CPUs), and a bit of RAM savings on embedded systems. (which can now save a few bytes by not having an irq_desc allocated for IRQs that are not present)
Because NR_IRQS can now go up to a ridiculous upper limit, a weakness of MSI virtual IRQ numbering has become more pronounced and had to be fixed:
the previous way of counting down from NR_IRQS downwards was confusing and ugly as well - resulting in very high IRQ numbers.
The new numbering scheme is more static and more human-compatible: it counts up from the end of the GSI IRQ range (which is at around ~256, slightly dependent on static factors such as the maximum # of IO-APICs supported). High IRQ numbers will only be seen in really large systems that have that many IRQ sources.
Jesse saw those changes to drivers/pci/ and tentatively agreed with them.
(This tree merges without conflicts with the x86 and tracing trees - in any ordering.)
Thanks,
Ingo
------------------>
David Brownell (1):
genirq: record IRQ_LEVEL in irq_desc[]
Ingo Molnar (5):
sparseirq: fix typo in !CONFIG_IO_APIC case sparse irqs: handle !GENIRQ platforms sparse irqs: add irqnr.h to the user headers list
x86: turn CONFIG_SPARSE_IRQ off by default x86, sparseirq: clean up Kconfig entry
Jeremy Fitzhardinge (1):
sparseirq, xen: make sure irq_desc is allocated for interrupts
KOSAKI Motohiro (2):
proc: enclose desc variable of show_stat() in CONFIG_SPARSE_IRQ locking, irq: enclose irq_desc_lock_class in CONFIG_LOCKDEP
Richard Kennedy (1):
irq.h: remove padding from irq_desc on 64bits
Yinghai Lu (10):
sparse irq_desc[] array: core kernel and x86 changes
x86: use NR_IRQS_LEGACY
x86: MSI start irq numbering from nr_irqs_gsi
x86, MSI: pass irq_cfg and irq_desc
sparseirq: fix Alpha build failure
sparseirq: fix !SMP && !PCI_MSI && !HT_IRQ build
x86, sparseirq: move irq_desc according to smp_affinity, v7
sparseirq: fix !SMP building, #2
sparseirq: add kernel-doc notation for new member in irq_desc, -v2
sparseirq: fix numa_migrate_irq_desc dependency and comments
arch/x86/Kconfig | 22 + arch/x86/include/asm/io_apic.h | 9 +- arch/x86/include/asm/irq_vectors.h | 11 + arch/x86/kernel/io_apic.c | 761 ++++++++++++++++++++++++------------ arch/x86/kernel/irq.c | 3 + arch/x86/kernel/irq_32.c | 2 + arch/x86/kernel/irq_64.c | 2 + arch/x86/kernel/irqinit_32.c | 3 +- arch/x86/kernel/irqinit_64.c | 3 +- arch/x86/kernel/setup.c | 2 +- drivers/char/random.c | 22 +- drivers/pci/intr_remapping.c | 77 ++++- drivers/pci/msi.c | 55 ++- drivers/xen/events.c | 17 +- fs/proc/stat.c | 16 +- include/linux/Kbuild | 1 + include/linux/interrupt.h | 2 + include/linux/irq.h | 62 +++- include/linux/irqnr.h | 26 +- include/linux/kernel_stat.h | 14 +- include/linux/lockdep.h | 2 +- include/linux/msi.h | 3 + include/linux/random.h | 51 +++ init/main.c | 11 + kernel/irq/Makefile | 1 + kernel/irq/autoprobe.c | 15 + kernel/irq/chip.c | 16 +- kernel/irq/handle.c | 189 +++++++++- kernel/irq/internals.h | 5 + kernel/irq/manage.c | 15 +- kernel/irq/numa_migrate.c | 122 ++++++ kernel/irq/proc.c | 6 +- kernel/irq/spurious.c | 5 + 33 files changed, 1221 insertions(+), 330 deletions(-) create mode 100644 kernel/irq/numa_migrate.c
arch/x86/Kconfig +22 -0
@@ -238,6 +238,28 @@ config X86_HAS_BOOT_CPU_ID def_bool y depends on X86_VOYAGER +config SPARSE_IRQ + bool "Support sparse irq numbering" + depends on PCI_MSI || HT_IRQ + help + This enables support for sparse irqs. This is useful for distro + kernels that want to define a high CONFIG_NR_CPUS value but still + want to have low kernel memory footprint on smaller machines. + + ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread + out the irq_desc[] array in a more NUMA-friendly way. ) + + 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_FIND_SMP_CONFIG def_bool y depends on X86_MPPARSE || X86_VOYAGER
arch/x86/include/asm/io_apic.h +3 -6
@@ -188,17 +188,14 @@ extern void restore_IO_APIC_setup(void);extern void reinit_intr_remapped_IO_APIC (int );#endif -extern int probe_nr_irqs (void ); +extern void probe_nr_irqs_gsi (void );#else /* !CONFIG_X86_IO_APIC */ #define io_apic_assign_pci_irqs 0static const int timer_through_8259 =0 ; -static inline void ioapic_init_mappings (void ) { } +static inline void ioapic_init_mappings (void ) { } -static inline int probe_nr_irqs (void ) -{ -return NR_IRQS ; -} +static inline void probe_nr_irqs_gsi (void ) { }#endif #endif /* _ASM_X86_IO_APIC_H */
arch/x86/include/asm/irq_vectors.h +11 -0
@@ -101,12 +101,23 @@#define LAST_VM86_IRQ 15#define invalid_vm86_irq (irq) ((irq) < 3 || (irq) > 15) +#define NR_IRQS_LEGACY 16 +#if defined(CONFIG_X86_IO_APIC ) && !defined(CONFIG_X86_VOYAGER ) + +#ifndef CONFIG_SPARSE_IRQ # if NR_CPUS <MAX_IO_APICS # define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))# else # define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))# endif +#else +# if (8 *NR_CPUS ) > (32 *MAX_IO_APICS ) +# define NR_IRQS (NR_VECTORS + (8 * NR_CPUS)) +# else +# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS)) +# endif +#endif #elif defined(CONFIG_X86_VOYAGER )
arch/x86/kernel/io_apic.c +517 -244
1,545 lines not on this page · raw message
arch/x86/kernel/irq.c +3 -0
@@ -118,6 +118,9 @@ int show_interrupts(struct seq_file *p, void *v) } desc =irq_to_desc (i); +if (!desc) +return 0 ; +spin_lock_irqsave (&desc->lock, flags);#ifndef CONFIG_SMP any_count =kstat_irqs (i);
arch/x86/kernel/irq_32.c +2 -0
@@ -242,6 +242,8 @@ void fixup_irqs(cpumask_t map)for_each_irq_desc (irq, desc) {cpumask_t mask; +if (!desc) +continue ;if (irq ==2 )continue ;
arch/x86/kernel/irq_64.c +2 -0
@@ -94,6 +94,8 @@ void fixup_irqs(cpumask_t map)int break_affinity =0 ;int set_affinity =1 ; +if (!desc) +continue ;if (irq ==2 )continue ;
arch/x86/kernel/irqinit_32.c +1 -2
@@ -68,8 +68,7 @@ void __init init_ISA_irqs (void)/* * 16 old-style INTA-cycle interrupts: */ -for (i =0 ; i <16 ; i++) { -/* first time call this irq_desc */ +for (i =0 ; i <NR_IRQS_LEGACY ; i++) {struct irq_desc *desc =irq_to_desc (i); desc->status =IRQ_DISABLED ;
arch/x86/kernel/irqinit_64.c +1 -2
@@ -142,8 +142,7 @@ void __init init_ISA_irqs(void)init_bsp_APIC ();init_8259A (0 ); -for (i =0 ; i <16 ; i++) { -/* first time call this irq_desc */ +for (i =0 ; i <NR_IRQS_LEGACY ; i++) {struct irq_desc *desc =irq_to_desc (i); desc->status =IRQ_DISABLED ;
arch/x86/kernel/setup.c +1 -1
@@ -1080,7 +1080,7 @@ void __init setup_arch(char **cmdline_p)ioapic_init_mappings ();/* need to wait for io_apic is mapped */ - nr_irqs =probe_nr_irqs (); +probe_nr_irqs_gsi ();kvm_guest_init ();
drivers/char/random.c +5 -17
@@ -558,23 +558,9 @@ struct timer_rand_state { unsigned dont_count_entropy:1; }; -static struct timer_rand_state *irq_timer_state[NR_IRQS ]; - -static struct timer_rand_state *get_timer_rand_state (unsigned int irq) -{ -if (irq >= nr_irqs) -return NULL ; - -return irq_timer_state[irq]; -} - -static void set_timer_rand_state (unsigned int irq,struct timer_rand_state *state) -{ -if (irq >= nr_irqs) -return ; - - irq_timer_state[irq] = state; -} +#ifndef CONFIG_SPARSE_IRQ +struct timer_rand_state *irq_timer_state[NR_IRQS ]; +#endif static struct timer_rand_state input_timer_state;
@@ -933,8 +919,10 @@ void rand_initialize_irq(int irq) {struct timer_rand_state *state; +#ifndef CONFIG_SPARSE_IRQ if (irq >= nr_irqs)return ; +#endif state =get_timer_rand_state (irq);
drivers/pci/intr_remapping.c +75 -2
119 lines not on this page · raw message
drivers/pci/msi.c +38 -17
123 lines not on this page · raw message
drivers/xen/events.c +13 -4
@@ -141,8 +141,12 @@ static void init_evtchn_cpu_bindings(void)int i;/* By default all event channels notify CPU#0. */ -for_each_irq_desc (i, desc) +for_each_irq_desc (i, desc) { +if (!desc) +continue ; + desc->affinity =cpumask_of_cpu (0 ); + }#endif memset (cpu_evtchn,0 ,sizeof (cpu_evtchn));
@@ -229,15 +233,20 @@ static void unmask_evtchn(int port)static int find_unbound_irq (void ) {int irq; +struct irq_desc *desc;/* Only allocate from dynirq range */ -for_each_irq_nr (irq) +for (irq =0 ; irq < nr_irqs; irq++)if (irq_bindcount[irq] ==0 )break ;if (irq == nr_irqs)panic ("No available IRQ to bind to: increase nr_irqs!\n" ); + desc =irq_to_desc_alloc_cpu (irq,0 ); +if (WARN_ON (desc ==NULL )) +return -1 ; +return irq; }
@@ -792,7 +801,7 @@ void xen_irq_resume(void)mask_evtchn (evtchn);/* No IRQ <-> event-channel mappings. */ -for_each_irq_nr (irq) +for (irq =0 ; irq < nr_irqs; irq++) irq_info[irq].evtchn =0 ;/* zap event-channel binding */ for (evtchn =0 ; evtchn <NR_EVENT_CHANNELS ; evtchn++)
@@ -824,7 +833,7 @@ void __init xen_init_IRQ(void)mask_evtchn (i);/* Dynamic IRQ space is currently unbound. Zero the refcnts. */ -for_each_irq_nr (i) +for (i =0 ; i < nr_irqs; i++) irq_bindcount[i] =0 ;irq_ctx_init (smp_processor_id ());
fs/proc/stat.c +12 -4
@@ -44,10 +44,13 @@ static int show_stat(struct seq_file *p, void *v) softirq =cputime64_add (softirq,kstat_cpu (i).cpustat.softirq); steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest); - -for_each_irq_nr (j) +for_each_irq_nr (j) { +#ifdef CONFIG_SPARSE_IRQ +if (!irq_to_desc (j)) +continue ; +#endif sum +=kstat_irqs_cpu (j, i); - + } sum +=arch_irq_stat_cpu (i); } sum +=arch_irq_stat ();
@@ -92,7 +95,12 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? */ for_each_irq_nr (j) { per_irq_sum =0 ; - +#ifdef CONFIG_SPARSE_IRQ +if (!irq_to_desc (j)) { +seq_printf (p," %u" , per_irq_sum); +continue ; + } +#endif for_each_possible_cpu (i) per_irq_sum +=kstat_irqs_cpu (j, i);
include/linux/Kbuild +1 -0
@@ -313,6 +313,7 @@ unifdef-y += ptrace.h unifdef-y += qnx4_fs.h unifdef-y += quota.h unifdef-y += random.h +unifdef-y += irqnr.h unifdef-y += reboot.h unifdef-y += reiserfs_fs.h unifdef-y += reiserfs_xattr.h
include/linux/interrupt.h +2 -0
@@ -14,6 +14,8 @@#include <linux/irqflags.h> #include <linux/smp.h> #include <linux/percpu.h> +#include <linux/irqnr.h> +#include <asm/atomic.h> #include <asm/ptrace.h> #include <asm/system.h>
include/linux/irq.h +59 -3
108 lines not on this page · raw message
include/linux/irqnr.h +20 -6
@@ -1,24 +1,38 @@#ifndef _LINUX_IRQNR_H#define _LINUX_IRQNR_H +/* +* Generic irq_desc iterators: +*/ +#ifdef __KERNEL__ +#ifndef CONFIG_GENERIC_HARDIRQS #include <asm/irq.h> # define nr_irqs NR_IRQS# define for_each_irq_desc (irq, desc) \ for (irq = 0; irq < nr_irqs; irq++) + +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1; irq >= 0; irq--)#else +extern int nr_irqs; +#ifndef CONFIG_SPARSE_IRQ + +struct irq_desc ;# define for_each_irq_desc (irq, desc) \ for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) - -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ - irq >= 0; irq--, desc--) +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ + irq >= 0; irq--, desc--) +#endif #endif -#define for_each_irq_nr (irq) \ - for (irq = 0; irq < nr_irqs; irq++) +#define for_each_irq_nr (irq) \ + for (irq = 0; irq < nr_irqs; irq++) + +#endif /* __KERNEL__ */ #endif
include/linux/kernel_stat.h +13 -1
@@ -28,7 +28,9 @@ struct cpu_usage_stat {struct kernel_stat {struct cpu_usage_stat cpustat; -unsigned int irqs[NR_IRQS ]; +#ifndef CONFIG_SPARSE_IRQ +unsigned int irqs[NR_IRQS ]; +#endif }; DECLARE_PER_CPU(struct kernel_stat, kstat);
@@ -39,6 +41,10 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);extern unsigned long long nr_context_switches (void ); +#ifndef CONFIG_SPARSE_IRQ +#define kstat_irqs_this_cpu (irq) \ + (kstat_this_cpu.irqs[irq]) +struct irq_desc ; static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
@@ -46,11 +52,17 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, { kstat_this_cpu.irqs[irq]++; } +#endif + +#ifndef CONFIG_SPARSE_IRQ static inline unsigned int kstat_irqs_cpu (unsigned int irq,int cpu) {return kstat_cpu (cpu).irqs[irq]; } +#else +extern unsigned int kstat_irqs_cpu (unsigned int irq,int cpu); +#endif /* * Number of interrupts per specific IRQ source, since bootup
include/linux/lockdep.h +1 -1
@@ -377,7 +377,7 @@ do { \#endif /* CONFIG_LOCK_STAT */ -#if defined(CONFIG_TRACE_IRQFLAGS ) && defined(CONFIG_GENERIC_HARDIRQS ) +#ifdef CONFIG_GENERIC_HARDIRQS extern void early_init_irq_lock_class (void );#else static inline void early_init_irq_lock_class (void )
include/linux/msi.h +3 -0
@@ -10,8 +10,11 @@ struct msi_msg { };/* Helper functions */ +struct irq_desc ;extern void mask_msi_irq (unsigned int irq);extern void unmask_msi_irq (unsigned int irq); +extern void read_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg); +extern void write_msi_msg_desc (struct irq_desc *desc,struct msi_msg *msg);extern void read_msi_msg (unsigned int irq,struct msi_msg *msg);extern void write_msi_msg (unsigned int irq,struct msi_msg *msg);
include/linux/random.h +51 -0
63 lines not on this page · raw message
init/main.c +11 -0
@@ -539,6 +539,15 @@ void __init __weak thread_info_cache_init(void) { } +void __init __weak arch_early_irq_init (void ) +{ +} + +void __init __weak early_irq_init (void ) +{ +arch_early_irq_init (); +} + asmlinkage void __init start_kernel(void) {char * command_line;
@@ -603,6 +612,8 @@ asmlinkage void __init start_kernel(void)sort_main_extable ();trap_init ();rcu_init (); +/* init some links before init_ISA_irqs() */ +early_irq_init ();init_IRQ ();pidhash_init ();init_timers ();
kernel/irq/Makefile +1 -0
@@ -3,3 +3,4 @@ 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
kernel/irq/autoprobe.c +15 -0
@@ -40,6 +40,9 @@ unsigned long probe_irq_on(void)* flush such a longstanding irq before considering it as spurious. */ for_each_irq_desc_reverse (i, desc) { +if (!desc) +continue ; +spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) {/*
@@ -68,6 +71,9 @@ unsigned long probe_irq_on(void)* happened in the previous stage, it may have masked itself) */ for_each_irq_desc_reverse (i, desc) { +if (!desc) +continue ; +spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) { desc->status |=IRQ_AUTODETECT |IRQ_WAITING ;
@@ -86,6 +92,9 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ for_each_irq_desc (i, desc) { +if (!desc) +continue ; +spin_lock_irq (&desc->lock); status = desc->status;
@@ -124,6 +133,9 @@ unsigned int probe_irq_mask(unsigned long val)int i;for_each_irq_desc (i, desc) { +if (!desc) +continue ; +spin_lock_irq (&desc->lock); status = desc->status;
@@ -166,6 +178,9 @@ int probe_irq_off(unsigned long val)unsigned int status;for_each_irq_desc (i, desc) { +if (!desc) +continue ; +spin_lock_irq (&desc->lock); status = desc->status;
kernel/irq/chip.c +13 -3
@@ -24,9 +24,10 @@*/ void dynamic_irq_init (unsigned int irq) { -struct irq_desc *desc =irq_to_desc (irq); +struct irq_desc *desc;unsigned long flags; + desc =irq_to_desc (irq);if (!desc) {WARN (1 ,KERN_ERR "Trying to initialize invalid IRQ%d\n" , irq);return ;
@@ -124,6 +125,7 @@ int set_irq_type(unsigned int irq, unsigned int type)return -ENODEV ; } + type &=IRQ_TYPE_SENSE_MASK ;if (type ==IRQ_TYPE_NONE )return 0 ;
@@ -352,6 +354,7 @@ 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;
@@ -429,6 +432,7 @@ 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); }
@@ -465,12 +469,14 @@ 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);/* Start handling the irq */ desc->chip->ack (irq); + desc =irq_remap_to_desc (irq, desc);/* Mark the IRQ currently in progress.*/ desc->status |=IRQ_INPROGRESS ;
@@ -531,8 +537,10 @@ 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
@@ -567,8 +575,10 @@ __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 +179 -10
235 lines not on this page · raw message
kernel/irq/internals.h +5 -0
@@ -13,6 +13,11 @@ extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);extern int __irq_set_trigger (struct irq_desc *desc,unsigned int irq,unsigned long flags); +extern struct lock_class_key irq_desc_lock_class; +extern void init_kstat_irqs (struct irq_desc *desc,int cpu,int nr); +extern spinlock_t sparse_irq_lock; +extern struct irq_desc *irq_desc_ptrs[NR_IRQS ]; +#ifdef CONFIG_PROC_FS extern void register_irq_proc (unsigned int irq,struct irq_desc *desc);extern void register_handler_proc (unsigned int irq,struct irqaction *action);
kernel/irq/manage.c +9 -6
@@ -370,16 +370,18 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,return 0 ; } - ret = chip->set_type (irq, flags &IRQF_TRIGGER_MASK ); +/* caller masked out all except trigger mode flags */ + ret = chip->set_type (irq, flags);if (ret)pr_err ("setting trigger mode %d for irq %u failed (%pF)\n" , - (int )(flags &IRQF_TRIGGER_MASK ), - irq, chip->set_type); + (int )flags, irq, chip->set_type);else { +if (flags & (IRQ_TYPE_LEVEL_LOW |IRQ_TYPE_LEVEL_HIGH )) + flags |=IRQ_LEVEL ;/* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */ - desc->status &= ~IRQ_TYPE_SENSE_MASK ; - desc->status |= flags &IRQ_TYPE_SENSE_MASK ; + desc->status &= ~(IRQ_LEVEL |IRQ_TYPE_SENSE_MASK ); + desc->status |= flags; }return ret;
@@ -459,7 +461,8 @@ __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new)/* Setup the type (level, edge polarity) if configured: */ if (new->flags &IRQF_TRIGGER_MASK ) { - ret =__irq_set_trigger (desc, irq, new->flags); + ret =__irq_set_trigger (desc, irq, + new->flags &IRQF_TRIGGER_MASK );if (ret) {spin_unlock_irqrestore (&desc->lock, flags);
kernel/irq/numa_migrate.c new file +122 -0
122 lines not on this page · raw message
kernel/irq/proc.c +5 -1
@@ -243,7 +243,11 @@ void init_irq_proc(void)/* * Create entries for all existing IRQs. */ -for_each_irq_desc (irq, desc) +for_each_irq_desc (irq, desc) { +if (!desc) +continue ; +register_irq_proc (irq, desc); + } }
kernel/irq/spurious.c +5 -0
@@ -91,6 +91,9 @@ static int misrouted_irq(int irq)int i, ok =0 ;for_each_irq_desc (i, desc) { +if (!desc) +continue ; +if (!i)continue ;
@@ -112,6 +115,8 @@ static void poll_spurious_irqs(unsigned long dummy)for_each_irq_desc (i, desc) {unsigned int status; +if (!desc) +continue ;if (!i)continue ;
Quoted 8 lines · Ingo Molnar
Linus,
Please pull the latest irq-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitirq-core-for-linusMost of the changes here are related to enable and implement sparseirq support on x86.
here is an append-only delta update to this pull request (in a different branch), with fixes and cleanups that got queued up in the last 2 days:
Please pull the latest irq-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus
[ shortlog/diffstat is relative to the irq-core-for-linus tree. The two
branches can be pulled in any order. ]
Thanks,
Ingo
------------------>
Ingo Molnar (2):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fix desc->lock init
KOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq: for_each_irq_desc() move to irqnr.h
proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
irq: simplify for_each_irq_desc() usage
Yinghai Lu (4):
sparseirq: remove duplicated arch_early_irq_init()
sparseirq: work around compiler optimizing away __weak functions
sparseirq: fix hang with !SPARSE_IRQ
sparseirq: set lock_class for legacy irq when sparse_irq is selected
arch/x86/kernel/io_apic.c | 18 +++++----------- drivers/xen/events.c | 3 -- fs/proc/stat.c | 11 +--------- include/linux/irq.h | 30 ++++++---------------------- include/linux/irqnr.h | 23 ++++++++++++--------- init/main.c | 8 +----- kernel/hrtimer.c | 1 - kernel/irq/autoprobe.c | 15 -------------- kernel/irq/handle.c | 47 ++++++++++++++++++++++++++++++++------------ kernel/irq/numa_migrate.c | 7 +---- kernel/irq/spurious.c | 5 ---- 11 files changed, 65 insertions(+), 103 deletions(-)
arch/x86/kernel/io_apic.c +6 -12
@@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = { [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, }; -void __init arch_early_irq_init (void ) +int __init arch_early_irq_init (void ) {struct irq_cfg *cfg;struct irq_desc *desc;
@@ -184,6 +184,8 @@ void __init arch_early_irq_init(void) desc =irq_to_desc (i); desc->chip_data = &cfg[i]; } + +return 0 ; }#ifdef CONFIG_SPARSE_IRQ
@@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)return cfg; } -void arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int cpu) {struct irq_cfg *cfg;
@@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)BUG_ON (1 ); } } + +return 0 ; }#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)/* Mark the inuse vectors */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; cfg = desc->chip_data;if (!cpu_isset (cpu, cfg->domain))continue ;
@@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)for_each_irq_desc (irq, desc) {struct irq_pin_list *entry; -if (!desc) -continue ; cfg = desc->chip_data; entry = cfg->irq_2_pin;if (!entry)
@@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)struct irq_desc *desc;for_each_irq_desc (irq, desc) { -if (!desc) -continue ; -if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
@@ -2671,9 +2668,6 @@ static inline void init_IO_APIC_traps(void)* 0x80, because int 0x80 is hm, kind of importantish. ;) */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; - cfg = desc->chip_data;if (IO_APIC_IRQ (irq) && cfg && !cfg->vector) {/*
drivers/xen/events.c +0 -3
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)/* By default all event channels notify CPU#0. */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; - desc->affinity =cpumask_of_cpu (0 ); }#endif
fs/proc/stat.c +1 -10
@@ -9,6 +9,7 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/irqnr.h> #include <asm/cputime.h> #ifndef arch_irq_stat_cpu
@@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v) steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest);for_each_irq_nr (j) { -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) -continue ; -#endif sum +=kstat_irqs_cpu (j, i); } sum +=arch_irq_stat_cpu (i);
@@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? */ for_each_irq_nr (j) { per_irq_sum =0 ; -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) { -seq_printf (p," %u" , per_irq_sum); -continue ; - } -#endif for_each_possible_cpu (i) per_irq_sum +=kstat_irqs_cpu (j, i);
include/linux/irq.h +7 -23
@@ -193,42 +193,26 @@ struct irq_desc {const char *name; }____cacheline_internodealigned_in_smp ; -extern void early_irq_init (void ); -extern void arch_early_irq_init (void ); -extern void arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int early_irq_init (void ); +extern int arch_early_irq_init (void ); +extern int arch_init_chip_data (struct irq_desc *desc,int cpu);extern void arch_init_copy_chip_data (struct irq_desc *old_desc,struct irq_desc *desc,int cpu);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 ]; - -static inline struct irq_desc *irq_to_desc (unsigned int irq) -{ -return (irq <NR_IRQS ) ? irq_desc + irq :NULL ; -} -static inline struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) -{ -return irq_to_desc (irq); -} - -#else - -extern struct irq_desc *irq_to_desc (unsigned int irq); -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +#else /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) -#define kstat_irqs_this_cpu (DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()])#define kstat_incr_irqs_this_cpu (irqno,DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()]++) -#endif +#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)
include/linux/irqnr.h +13 -10
@@ -15,20 +15,23 @@# define for_each_irq_desc_reverse (irq, desc) \ for (irq = nr_irqs - 1; irq >= 0; irq--) -#else +#else /* CONFIG_GENERIC_HARDIRQS */ extern int nr_irqs; +extern struct irq_desc *irq_to_desc (unsigned int irq); -#ifndef CONFIG_SPARSE_IRQ +# define for_each_irq_desc (irq, desc) \ + for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ + irq++, desc = irq_to_desc(irq)) \ + if (desc) -struct irq_desc ; -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ - irq >= 0; irq--, desc--) -#endif -#endif + +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ + irq--, desc = irq_to_desc(irq)) \ + if (desc) + +#endif /* CONFIG_GENERIC_HARDIRQS */ #define for_each_irq_nr (irq) \ for (irq = 0; irq < nr_irqs; irq++)
init/main.c +2 -6
@@ -539,13 +539,9 @@ void __init __weak thread_info_cache_init(void) { } -void __init __weak arch_early_irq_init (void ) +int __init __weak early_irq_init (void ) { -} - -void __init __weak early_irq_init (void ) -{ -arch_early_irq_init (); +return arch_early_irq_init (); } asmlinkage void __init start_kernel(void)
kernel/hrtimer.c +0 -1
@@ -32,7 +32,6 @@*/ #include <linux/cpu.h> -#include <linux/irq.h> #include <linux/module.h> #include <linux/percpu.h> #include <linux/hrtimer.h>
kernel/irq/autoprobe.c +0 -15
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)* flush such a longstanding irq before considering it as spurious. */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) {/*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)* happened in the previous stage, it may have masked itself) */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) { desc->status |=IRQ_AUTODETECT |IRQ_WAITING ;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)int i;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)unsigned int status;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
kernel/irq/handle.c +34 -13
107 lines not on this page · raw message
kernel/irq/numa_migrate.c +2 -5
@@ -42,6 +42,7 @@ static void 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)); +spin_lock_init (&desc->lock); desc->cpu = cpu;lockdep_set_class (&desc->lock, &irq_desc_lock_class);init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids);
@@ -74,10 +75,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " move irq_desc for %d to cpu %d node %d\n" , - irq, cpu, node);if (!desc) { -printk (KERN_ERR "can not get new irq_desc for moving\n" ); +printk (KERN_ERR "irq %d: can not get new irq_desc for migration.\n" , irq);/* still use old one */ desc = old_desc; goto out_unlock;
@@ -106,8 +105,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)return desc; old_cpu = desc->cpu; -printk (KERN_DEBUG -"try to move irq_desc from cpu %d to %d\n" , old_cpu, cpu);if (old_cpu != cpu) { node =cpu_to_node (cpu); old_node =cpu_to_node (old_cpu);
kernel/irq/spurious.c +0 -5
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)int i, ok =0 ;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -if (!i)continue ;
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)for_each_irq_desc (i, desc) {unsigned int status; -if (!desc) -continue ;if (!i)continue ;
Quoted 11 lines
------------------>
Ingo Molnar (2):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fixdesc->lockinitKOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq:for_each_irq_desc()move toirqnr.h
proc: remove ifdefCONFIG_SPARSE_IRQfromstat.c
irq: simplifyfor_each_irq_desc()usage
Quoted 3 lines
Yinghai Lu (4):
sparseirq: remove duplicatedarch_early_irq_init()
sparseirq: work around compiler optimizing away__weakfunctions
Unfortunately, this workaround doesn't workaround. Kamalesh reported kernel still crashes.
So, I suggest to pending this pull request awhile. Nobody want to merge pseudo fix.
Quoted 2 lines
sparseirq: fix hang with !SPARSE_IRQ
sparseirq: setlock_classfor legacy irq whensparse_irqis selected
Quoted 11 lines · KOSAKI Motohiro
Quoted 11 lines
------------------>
Ingo Molnar (2):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fixdesc->lockinitKOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq:for_each_irq_desc()move toirqnr.h
proc: remove ifdefCONFIG_SPARSE_IRQfromstat.c
irq: simplifyfor_each_irq_desc()usage
Quoted 6 lines
Quoted 3 lines
Yinghai Lu (4):
sparseirq: remove duplicatedarch_early_irq_init()
sparseirq: work around compiler optimizing away__weakfunctionsUnfortunately, this workaround doesn't workaround. Kamalesh reported kernel still crashes.
well, it's a regression that is being worked on: certain buggy GCC versions (unclear yet what scope but quite rare it appears) optimize out __weak function calls incorrectly.
Ingo
Quoted 4 lines · Ingo Molnar
well, it's a regression that is being worked on: certain buggy GCC versions (unclear yet what scope but quite rare it appears) optimize out
__weakfunction calls incorrectly.
We've hit that kind of bug before, haven't we? I think the solution last time was to make sure that the __weak function is never in the same compilation unit as a call to it.
Linus
Quoted 11 lines · Linus Torvalds
Quoted 4 lines · Ingo Molnar
well, it's a regression that is being worked on: certain buggy GCC versions (unclear yet what scope but quite rare it appears) optimize out
__weakfunction calls incorrectly.We've hit that kind of bug before, haven't we? I think the solution last time was to make sure that the
__weakfunction is never in the same compilation unit as a call to it.
good, will try have another one for test.
YH
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Ingo Molnar
well, it's a regression that is being worked on: certain buggy GCC versions (unclear yet what scope but quite rare it appears) optimize out
__weakfunction calls incorrectly.We've hit that kind of bug before, haven't we? I think the solution last time was to make sure that the
__weakfunction is never in the same compilation unit as a call to it.
ok, agreed. I was hoping for some more generic workaround but nothing seemed to keep gcc from inlining such functions.
Here's the irq-fixes-for-linus-3 that has this fixed, via:
b2e2fe9: sparseirq: work around __weak alias bug
which moves the weak arch_init_chip_data() alias from handle.c to manage.c. Please pull the fix from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus-3
[ the shortlog is relative to irq-core-for-linus. The other URIs i sent
are also valid and can be pulled in arbitrary order. ]
Thanks,
Ingo
------------------>
Ingo Molnar (3):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fix desc->lock init
sparseirq: work around __weak alias bug
KOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq: for_each_irq_desc() move to irqnr.h
proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
irq: simplify for_each_irq_desc() usage
Yinghai Lu (4):
sparseirq: remove duplicated arch_early_irq_init()
sparseirq: work around compiler optimizing away __weak functions
sparseirq: set lock_class for legacy irq when sparse_irq is selected
sparseirq: fix hang with !SPARSE_IRQ
arch/x86/kernel/io_apic.c | 18 +++++----------- drivers/xen/events.c | 3 -- fs/proc/stat.c | 11 +--------- include/linux/irq.h | 30 ++++++--------------------- include/linux/irqnr.h | 23 ++++++++++++--------- init/main.c | 7 +++-- kernel/hrtimer.c | 1 - kernel/irq/autoprobe.c | 15 -------------- kernel/irq/handle.c | 48 ++++++++++++++++++++++++++++++--------------- kernel/irq/manage.c | 9 ++++++++ kernel/irq/numa_migrate.c | 7 +---- kernel/irq/spurious.c | 5 ---- 12 files changed, 74 insertions(+), 103 deletions(-)
arch/x86/kernel/io_apic.c +6 -12
@@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = { [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, }; -void __init arch_early_irq_init (void ) +int __init arch_early_irq_init (void ) {struct irq_cfg *cfg;struct irq_desc *desc;
@@ -184,6 +184,8 @@ void __init arch_early_irq_init(void) desc =irq_to_desc (i); desc->chip_data = &cfg[i]; } + +return 0 ; }#ifdef CONFIG_SPARSE_IRQ
@@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)return cfg; } -void arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int cpu) {struct irq_cfg *cfg;
@@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)BUG_ON (1 ); } } + +return 0 ; }#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)/* Mark the inuse vectors */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; cfg = desc->chip_data;if (!cpu_isset (cpu, cfg->domain))continue ;
@@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)for_each_irq_desc (irq, desc) {struct irq_pin_list *entry; -if (!desc) -continue ; cfg = desc->chip_data; entry = cfg->irq_2_pin;if (!entry)
@@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)struct irq_desc *desc;for_each_irq_desc (irq, desc) { -if (!desc) -continue ; -if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
@@ -2671,9 +2668,6 @@ static inline void init_IO_APIC_traps(void)* 0x80, because int 0x80 is hm, kind of importantish. ;) */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; - cfg = desc->chip_data;if (IO_APIC_IRQ (irq) && cfg && !cfg->vector) {/*
drivers/xen/events.c +0 -3
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)/* By default all event channels notify CPU#0. */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; - desc->affinity =cpumask_of_cpu (0 ); }#endif
fs/proc/stat.c +1 -10
@@ -9,6 +9,7 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/irqnr.h> #include <asm/cputime.h> #ifndef arch_irq_stat_cpu
@@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v) steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest);for_each_irq_nr (j) { -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) -continue ; -#endif sum +=kstat_irqs_cpu (j, i); } sum +=arch_irq_stat_cpu (i);
@@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? */ for_each_irq_nr (j) { per_irq_sum =0 ; -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) { -seq_printf (p," %u" , per_irq_sum); -continue ; - } -#endif for_each_possible_cpu (i) per_irq_sum +=kstat_irqs_cpu (j, i);
include/linux/irq.h +7 -23
@@ -193,42 +193,26 @@ struct irq_desc {const char *name; }____cacheline_internodealigned_in_smp ; -extern void early_irq_init (void ); -extern void arch_early_irq_init (void ); -extern void arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int early_irq_init (void ); +extern int arch_early_irq_init (void ); +extern int arch_init_chip_data (struct irq_desc *desc,int cpu);extern void arch_init_copy_chip_data (struct irq_desc *old_desc,struct irq_desc *desc,int cpu);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 ]; - -static inline struct irq_desc *irq_to_desc (unsigned int irq) -{ -return (irq <NR_IRQS ) ? irq_desc + irq :NULL ; -} -static inline struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) -{ -return irq_to_desc (irq); -} - -#else - -extern struct irq_desc *irq_to_desc (unsigned int irq); -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +#else /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) -#define kstat_irqs_this_cpu (DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()])#define kstat_incr_irqs_this_cpu (irqno,DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()]++) -#endif +#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)
include/linux/irqnr.h +13 -10
@@ -15,20 +15,23 @@# define for_each_irq_desc_reverse (irq, desc) \ for (irq = nr_irqs - 1; irq >= 0; irq--) -#else +#else /* CONFIG_GENERIC_HARDIRQS */ extern int nr_irqs; +extern struct irq_desc *irq_to_desc (unsigned int irq); -#ifndef CONFIG_SPARSE_IRQ +# define for_each_irq_desc (irq, desc) \ + for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ + irq++, desc = irq_to_desc(irq)) \ + if (desc) -struct irq_desc ; -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ - irq >= 0; irq--, desc--) -#endif -#endif + +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ + irq--, desc = irq_to_desc(irq)) \ + if (desc) + +#endif /* CONFIG_GENERIC_HARDIRQS */ #define for_each_irq_nr (irq) \ for (irq = 0; irq < nr_irqs; irq++)
init/main.c +4 -3
@@ -539,13 +539,14 @@ void __init __weak thread_info_cache_init(void) { } -void __init __weak arch_early_irq_init (void ) +int __init __weak arch_early_irq_init (void ) { +return 0 ; } -void __init __weak early_irq_init (void ) +int __init __weak early_irq_init (void ) { -arch_early_irq_init (); +return arch_early_irq_init (); } asmlinkage void __init start_kernel(void)
kernel/hrtimer.c +0 -1
@@ -32,7 +32,6 @@*/ #include <linux/cpu.h> -#include <linux/irq.h> #include <linux/module.h> #include <linux/percpu.h> #include <linux/hrtimer.h>
kernel/irq/autoprobe.c +0 -15
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)* flush such a longstanding irq before considering it as spurious. */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) {/*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)* happened in the previous stage, it may have masked itself) */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) { desc->status |=IRQ_AUTODETECT |IRQ_WAITING ;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)int i;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)unsigned int status;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
kernel/irq/handle.c +32 -16
105 lines not on this page · raw message
kernel/irq/manage.c +9 -0
@@ -261,6 +261,15 @@ void enable_irq(unsigned int irq) }EXPORT_SYMBOL (enable_irq); +/* +* [ Not in kernel/irq/handle.c, so that GCC does not +* inline the __weak alias: ] +*/ +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +static int set_irq_wake_real (unsigned int irq,unsigned int on) {struct irq_desc *desc =irq_to_desc (irq);
kernel/irq/numa_migrate.c +2 -5
@@ -42,6 +42,7 @@ static void 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)); +spin_lock_init (&desc->lock); desc->cpu = cpu;lockdep_set_class (&desc->lock, &irq_desc_lock_class);init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids);
@@ -74,10 +75,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " move irq_desc for %d to cpu %d node %d\n" , - irq, cpu, node);if (!desc) { -printk (KERN_ERR "can not get new irq_desc for moving\n" ); +printk (KERN_ERR "irq %d: can not get new irq_desc for migration.\n" , irq);/* still use old one */ desc = old_desc; goto out_unlock;
@@ -106,8 +105,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)return desc; old_cpu = desc->cpu; -printk (KERN_DEBUG -"try to move irq_desc from cpu %d to %d\n" , old_cpu, cpu);if (old_cpu != cpu) { node =cpu_to_node (cpu); old_node =cpu_to_node (old_cpu);
kernel/irq/spurious.c +0 -5
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)int i, ok =0 ;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -if (!i)continue ;
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)for_each_irq_desc (i, desc) {unsigned int status; -if (!desc) -continue ;if (!i)continue ;
Quoted 1 line · Ingo Molnar
b2e2fe9: sparseirq: work around
__weakalias bug
here's that fix, standalone too. Kamalesh, i think this should finally fix the crash you are seeing.
Ingo
---------------->
Quoted 1 line
From
b2e2fe99628c4f944c3075258e536197b5a4f3f8Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Mon, 29 Dec 2008 00:16:45 +0100
Subject: [PATCH] sparseirq: work around __weak alias bug
Impact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with __weak alias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.
This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flat
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP [...]
So move the arch_init_chip_data() function from handle.c to manage.c.
--- kernel/irq/handle.c | 5 ----- kernel/irq/manage.c | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-)
kernel/irq/handle.c +0 -5
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) desc->kstat_irqs = (unsigned int *)ptr; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));
kernel/irq/manage.c +9 -0
@@ -261,6 +261,15 @@ void enable_irq(unsigned int irq) }EXPORT_SYMBOL (enable_irq); +/* +* [ Not in kernel/irq/handle.c, so that GCC does not +* inline the __weak alias: ] +*/ +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +static int set_irq_wake_real (unsigned int irq,unsigned int on) {struct irq_desc *desc =irq_to_desc (irq);
Quoted 34 lines · Ingo Molnar
Quoted 1 line · Ingo Molnar
b2e2fe9: sparseirq: work around
__weakalias bughere's that fix, standalone too. Kamalesh, i think this should finally fix the crash you are seeing.
Ingo
---------------->
Fromb2e2fe99628c4f944c3075258e536197b5a4f3f8Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Mon, 29 Dec 2008 00:16:45 +0100
Subject: [PATCH] sparseirq: work around__weakalias bugImpact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with
__weakalias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flatBUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP [...]
Quoted 9 lines
So move the
arch_init_chip_data()function fromhandle.ctomanage.c.Reported-by Kamalesh Babulal <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- kernel/irq/handle.c | 5 ----- kernel/irq/manage.c | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-)
that is not enough.
please check
need one printk, and move two functions into chip.c
YH
[PATCH] sparseirq: mvoe two weak functions to chip.c
Impact: fix panic
some gcc compiler will remove the weak global blank function Linus noted that we could move those function to other unit to workaround it.
try to workaround it:
1. one time path: add printk
2. multi time path: move to chip.c
init/main.c +3 -6
@@ -542,14 +542,11 @@ void __init __weak thread_info_cache_init(void) { } -int __init __weak arch_early_irq_init (void ) -{ -return 0 ; -} -int __init __weak early_irq_init (void ) { -return arch_early_irq_init (); +printk (KERN_DEBUG "calling __weak early_irq_init()\n" ); + +return 0 ; } asmlinkage void __init start_kernel(void)
kernel/irq/chip.c +10 -0
@@ -18,6 +18,16 @@#include "internals.h" +int __init __weak arch_early_irq_init (void ) +{ +return 0 ; +} + +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +/** * dynamic_irq_init - initialize a dynamically allocated irq * @irq: irq number to initialize
kernel/irq/handle.c +0 -5
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) desc->kstat_irqs = (unsigned int *)ptr; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));
Quoted 10 lines
Quoted 4 lines
kernel/irq/handle.c | 5 ----- kernel/irq/manage.c | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-)that is not enough.
please check
need one printk, and move two functions into
chip.c
I'm sad ;-)
Why you use printk?
if develper use non-x86 machine, they will see perfectly worthless debug messages...
although something function calling is needed, we can avoid tty output imho.
Quoted 7 lines · KOSAKI Motohiro
Quoted 7 lines
Quoted 4 lines
kernel/irq/handle.c | 5 ----- kernel/irq/manage.c | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-)that is not enough.
Quoted 8 lines
Quoted 3 lines
please check
need one printk, and move two functions into
chip.cI'm sad ;-)
Why you use printk? if develper use non-x86 machine, they will see perfectly worthless debug messages...
yes. If you can reproduce the problem then please check the version in tip/master:
http://people.redhat.com/mingo/tip.git/README
it doesnt include any needless printks.
Ingo
Quoted 7 lines
Quoted 4 lines
I'm sad ;-)
Why you use printk? if develper use non-x86 machine, they will see perfectly worthless debug messages...
yes. If you can reproduce the problem then please check the version in tip/master:
Unfortunately, No I can't.
Quoted 11 lines
http://people.redhat.com/mingo/tip.git/README
it doesnt include any needless printks.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 26 lines · Ingo Molnar
Quoted 1 line · Ingo Molnar
b2e2fe9: sparseirq: work around
__weakalias bughere's that fix, standalone too. Kamalesh, i think this should finally fix the crash you are seeing.
Ingo
---------------->
Quoted 1 line
From
b2e2fe99628c4f944c3075258e536197b5a4f3f8Mon Sep 17 00:00:00 2001From: Ingo Molnar <[email protected]>
Date: Mon, 29 Dec 2008 00:16:45 +0100
Subject: [PATCH] sparseirq: work around__weakalias bugImpact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with
__weakalias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flat
Quoted 8 lines
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP [...]So move the
arch_init_chip_data()function fromhandle.ctomanage.c.
that is not enough.
need
[PATCH] sparseirq: mvoe two weak functions to chip.c
Impact: fix panic
some gcc compiler will remove the weak global blank function Linus noted that we could move those function to other unit to workaround it.
try to workaround it:
1. one time path: add printk
2. multi time path: move to chip.c
--- init/main.c | 9 +++------ kernel/irq/chip.c | 10 ++++++++++ kernel/irq/handle.c | 5 ----- 3 files changed, 13 insertions(+), 11 deletions(-)
init/main.c +3 -6
@@ -542,14 +542,11 @@ void __init __weak thread_info_cache_ini { } -int __init __weak arch_early_irq_init (void ) -{ -return 0 ; -} -int __init __weak early_irq_init (void ) { -return arch_early_irq_init (); +printk (KERN_DEBUG "calling __weak early_irq_init()\n" ); + +return 0 ; } asmlinkage void __init start_kernel(void)
kernel/irq/chip.c +10 -0
@@ -18,6 +18,16 @@#include "internals.h" +int __init __weak arch_early_irq_init (void ) +{ +return 0 ; +} + +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +/** * dynamic_irq_init - initialize a dynamically allocated irq * @irq: irq number to initialize
kernel/irq/handle.c +0 -5
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *de desc->kstat_irqs = (unsigned int *)ptr; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));
Quoted 33 lines · Yinghai Lu
Quoted 32 lines · Ingo Molnar
Quoted 1 line · Ingo Molnar
b2e2fe9: sparseirq: work around
__weakalias bughere's that fix, standalone too. Kamalesh, i think this should finally fix the crash you are seeing.
Ingo
---------------->
Quoted 1 line
From
b2e2fe99628c4f944c3075258e536197b5a4f3f8Mon Sep 17 00:00:00 2001From: Ingo Molnar <[email protected]>
Date: Mon, 29 Dec 2008 00:16:45 +0100
Subject: [PATCH] sparseirq: work around__weakalias bugImpact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with
__weakalias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flatBUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP [...]
Quoted 7 lines
Quoted 1 line
So move the
arch_init_chip_data()function fromhandle.ctomanage.c.that is not enough.
need
or this one
[PATCH] sparseirq: move weak function to chip.c v2
Impact: fix panic
some gcc compiler will remove the weak global blank function Linus noted that we could move those function to other unit to workaround it.
try to workaround it:
1. one time path: add printk
2. multi time path: move to chip.c
--- init/main.c | 4 ++++ kernel/irq/chip.c | 5 +++++ kernel/irq/handle.c | 5 ----- 3 files changed, 9 insertions(+), 5 deletions(-)
init/main.c +4 -0
@@ -544,11 +544,15 @@ void __init __weak thread_info_cache_iniint __init __weak arch_early_irq_init (void ) { +printk (KERN_DEBUG "calling __weak arch_early_irq_init()\n" ); +return 0 ; }int __init __weak early_irq_init (void ) { +printk (KERN_DEBUG "calling __weak early_irq_init()\n" ); +return arch_early_irq_init (); }
kernel/irq/chip.c +5 -0
@@ -18,6 +18,11 @@#include "internals.h" +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +/** * dynamic_irq_init - initialize a dynamically allocated irq * @irq: irq number to initialize
kernel/irq/handle.c +0 -5
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *de desc->kstat_irqs = (unsigned int *)ptr; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));
init/main.c void __init __weak thread_info_cache_ini · line 547
Quoted 3 lines · Yinghai Lu
int
__init__weakarch_early_irq_init(void)
{init/main.c +1
-0+printk (KERN_DEBUG "calling __weak arch_early_irq_init()\n" );
Hm, where do you get the idea that sprinkling functions with printks will in any way improve the situation and result in clean code? Yes, it works around the bug, but so will an infinite number of other things.
By far the best solution is to move them into a different compilation unit
- i.e. your first patch - i'll apply that one.
Ingo
Quoted 2 lines · Ingo Molnar
By far the best solution is to move them into a different compilation unit - i.e. your first patch - i'll apply that one.
your patch didnt apply, and it also missed the following detail:kernel/irq/ is only included on genirq architectures - not on some others. So i ended up with the refactored patch below.
Ingo
---------------->
Quoted 1 line
From
18aa3101b32c90738182dba89d43f7c984e90e82Mon Sep 17 00:00:00 2001
From: Yinghai Lu <[email protected]>
Date: Sun, 28 Dec 2008 16:01:13 -0800
Subject: [PATCH] sparseirq: move __weak symbols into separate compilation unit
GCC has a bug with __weak alias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.
So move all the IRQ handling related __weak symbols to kernel/irq/chip.c.
--- init/main.c | 10 ---------- kernel/irq/manage.c | 9 --------- kernel/softirq.c | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 19 deletions(-)
init/main.c +0 -10
@@ -539,16 +539,6 @@ void __init __weak thread_info_cache_init(void) { } -int __init __weak arch_early_irq_init (void ) -{ -return 0 ; -} - -int __init __weak early_irq_init (void ) -{ -return arch_early_irq_init (); -} - asmlinkage void __init start_kernel(void) {char * command_line;
kernel/irq/manage.c +0 -9
@@ -261,15 +261,6 @@ void enable_irq(unsigned int irq) }EXPORT_SYMBOL (enable_irq); -/* -* [ Not in kernel/irq/handle.c, so that GCC does not -* inline the __weak alias: ] -*/ -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static int set_irq_wake_real (unsigned int irq,unsigned int on) {struct irq_desc *desc =irq_to_desc (irq);
kernel/softirq.c +20 -0
@@ -797,3 +797,23 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait) }EXPORT_SYMBOL (on_each_cpu);#endif + +/* +* [ These __weak aliases are kept in a separate compilation unit, so that +* GCC does not inline them incorrectly. ] +*/ + +int __init __weak early_irq_init (void ) +{ +return 0 ; +} + +int __init __weak arch_early_irq_init (void ) +{ +return 0 ; +} + +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +}
Quoted 69 lines · Ingo Molnar
Quoted 1 line · Ingo Molnar
b2e2fe9: sparseirq: work around
__weakalias bughere's that fix, standalone too. Kamalesh, i think this should finally fix the crash you are seeing.
Ingo
---------------->
Fromb2e2fe99628c4f944c3075258e536197b5a4f3f8Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Mon, 29 Dec 2008 00:16:45 +0100
Subject: [PATCH] sparseirq: work around__weakalias bugImpact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with
__weakalias functions: if the functions are in the same compilation unit as their call site, GCC can decide to inline them - and thus rob the linker of the opportunity to override the weak alias with the real thing.This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flatBUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP [...]So move the
arch_init_chip_data()function fromhandle.ctomanage.c.Reported-by Kamalesh Babulal <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- kernel/irq/handle.c | 5 ----- kernel/irq/manage.c | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-)kernel/irq/handle.c +0
-5@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) desc->kstat_irqs = (unsigned int *)ptr; } -int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) -{ -return 0 ; -} -static void init_one_irq_desc (int irq,struct irq_desc *desc,int cpu) {memcpy (desc, &irq_desc_init,sizeof (struct irq_desc ));kernel/irq/manage.c +2
-0@@ -261,6 +261,15 @@ void enable_irq(unsigned int irq) }EXPORT_SYMBOL (enable_irq); +/* +* [ Not in kernel/irq/handle.c, so that GCC does not
kernel/irq/manage.c void enable_irq(unsigned int irq) · line 275
Quoted 10 lines
kernel/irq/manage.c +7
-0+* inline the __weak alias: ] +*/ +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +} +static int set_irq_wake_real (unsigned int irq,unsigned int on) {struct irq_desc *desc =irq_to_desc (irq);
Hi Ingo,
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48
Setting APIC routing to flat
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 PGD 0 Oops: 0000 [#1] SMP last sysfs file: CPU 0 Modules linked in: Pid: 1, comm: swapper Not tainted 2.6.28-autotest-tip #1 RIP: 0010:[<ffffffff8021f9a8>] [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 RSP: 0018:ffff88003f9d7e40 EFLAGS: 00010282 RAX: ffffffff8073c300 RBX: 0000000000000001 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000018 R09: 0000000000000002 R10: 000000000000000f R11: ffffffff8021e8aa R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000002 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffffffff80855480(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 0000000000000000 CR3: 0000000000201000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper (pid: 1, threadinfo ffff88003f9d6000, task ffff88003f9d8000) Stack: 0000000000000000 0000000000000001 ffffffff8073c300 0000000000000001 0000000000000001 ffffffff80874282 0000000000000286 0000000000000286 0000000000010000 0000000000000206 0000000000000002 0000000000000002 Call Trace: [<ffffffff80874282>] setup_IO_APIC+0x12f/0x720 [<ffffffff80525711>] _spin_lock_irqsave+0x9/0xe [<ffffffff8022221b>] get_apic_id+0x0/0x9 [<ffffffff8087116f>] native_smp_prepare_cpus+0x256/0x2f1 [<ffffffff808637ca>] kernel_init+0x50/0x1eb [<ffffffff8020ce9a>] child_rip+0xa/0x20 [<ffffffff8086377a>] kernel_init+0x0/0x1eb [<ffffffff8020ce90>] child_rip+0x0/0x20 Code: 48 c7 c7 8d 3c 5f 80 31 c0 e8 08 8d 01 00 5b 4c 89 e0 41 5c 41 5d c3 41 55 49 89 fd 89 f7 41 54 41 89 cc 55 89 d5 53 48 83 ec 08 <49> 8b 5d 00 48 85 db 75 36 e8 88 ff ff ff 48 85 c0 75 19 41 5b RIP [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 RSP <ffff88003f9d7e40> CR2: 0000000000000000 ---[ end trace 4eaa2a86a8e2da22 ]--- Kernel panic - not syncing: Attempted to kill init! Pid: 1, comm: swapper Tainted: G D 2.6.28-autotest-tip #1 Call Trace: [<ffffffff80237b4d>] panic+0x86/0x144 [<ffffffff802373f4>] mm_release+0x3f/0xd3 [<ffffffff802393b2>] exit_fs+0x35/0x46 [<ffffffff8023a842>] do_exit+0x75/0x787 [<ffffffff805262ce>] oops_end+0xa8/0xad [<ffffffff80527b1d>] do_page_fault+0x756/0x80f [<ffffffff805258df>] page_fault+0x1f/0x30 [<ffffffff8021e8aa>] native_apic_mem_write+0x0/0x9 [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74 [<ffffffff80874282>] setup_IO_APIC+0x12f/0x720 [<ffffffff80525711>] _spin_lock_irqsave+0x9/0xe [<ffffffff8022221b>] get_apic_id+0x0/0x9 [<ffffffff8087116f>] native_smp_prepare_cpus+0x256/0x2f1 [<ffffffff808637ca>] kernel_init+0x50/0x1eb [<ffffffff8020ce9a>] child_rip+0xa/0x20 [<ffffffff8086377a>] kernel_init+0x0/0x1eb [<ffffffff8020ce90>] child_rip+0x0/0x20
Signature · 4 lines
Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL.
Quoted 4 lines · Kamalesh Babulal
Hi Ingo,
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48
yes - Yinghai observed this too. Could you check tip/master that has all the fixlets merged up, to make sure it's finally solved? Thanks,
also, what is the gcc -v output of your compiler?
Ingo
Quoted 8 lines · Ingo Molnar
Quoted 4 lines · Kamalesh Babulal
Hi Ingo,
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48
Quoted 6 lines
yes - Yinghai observed this too. Could you check tip/master that has all the fixlets merged up, to make sure it's finally solved? Thanks,
also, what is the gcc -v output of your compiler?
Ingo
Hi Ingo/Yinghai,
Thanks for getting it resolved, the latest tip/master boot's up fine :)
$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
Signature · 4 lines
Thanks & Regards, Kamalesh Babulal, Linux Technology Center, IBM, ISTL.
Quoted 13 lines · Kamalesh Babulal
Quoted 11 lines · Ingo Molnar
Quoted 4 lines · Kamalesh Babulal
Hi Ingo,
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48yes - Yinghai observed this too. Could you check tip/master that has all the fixlets merged up, to make sure it's finally solved? Thanks,
Quoted 7 lines
Quoted 3 lines
also, what is the gcc -v output of your compiler?
Ingo
Hi Ingo/Yinghai,
Thanks for getting it resolved, the latest tip/master boot's up fine :)
thanks for testing it :-)
Linus - this means irq-core-for-linus + irq-fixes-for-linus-4 (or just plain irq-fixes-for-linus-4) should be golden.
Ingo
Quoted 27 lines
Quoted 9 lines
Quoted 2 lines
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48yes - Yinghai observed this too. Could you check tip/master that has all the fixlets merged up, to make sure it's finally solved? Thanks,
also, what is the gcc -v output of your compiler?
Ingo
Hi Ingo/Yinghai,
Thanks for getting it resolved, the latest tip/master boot's up fine :)
$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile
Quoted 8 lines
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
note, my following compiler doesn't have this problem.
% LANG=C gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=po\
six --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile -\
-enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/\lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
Quoted 36 lines · KOSAKI Motohiro
Quoted 27 lines
Quoted 9 lines
Quoted 2 lines
kernel crashes after applying the patch, I will retest with
the patch posted at http://lkml.org/lkml/2008/12/29/48yes - Yinghai observed this too. Could you check tip/master that has all the fixlets merged up, to make sure it's finally solved? Thanks,
also, what is the gcc -v output of your compiler?
Ingo
Hi Ingo/Yinghai,
Thanks for getting it resolved, the latest tip/master boot's up fine :)
$ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifileQuoted 8 lines
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux Thread model: posix gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
Quoted 1 line
note, my following compiler doesn't have this problem.
as i said it earlier on, it's a rather rare problem - in a 2.5 years old compiler. The commit has been around for some time and nobody was hit by the regression.
Ingo
H. Peter Anvin
reviewerQuoted 4 lines · Ingo Molnar
ok, agreed. I was hoping for some more generic workaround but nothing seemed to keep gcc from inlining such functions.
Other than blacklisting those gcc versions. It's pretty easy to understand how a bug like that could creep in, since one of the main improvements of the early gcc4 series was better inlining as an optimization.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 10 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
ok, agreed. I was hoping for some more generic workaround but nothing seemed to keep gcc from inlining such functions.
Other than blacklisting those gcc versions. It's pretty easy to understand how a bug like that could creep in, since one of the main improvements of the early gcc4 series was better inlining as an optimization.
1. one time path add one dummy printk
2. multi path, could move it to another file. could add one like kernel/weak.c to collect those ...
Quoted 4 lines
--
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
good to know.
YH
H. Peter Anvin
reviewerQuoted 5 lines · Yinghai Lu
1. one time path add one dummy printk
2. multi path, could move it to another file. could add one likekernel/weak.cto collect those ...
I had a silly thought about scanning the source code for some kind of magic declarator that would then be collected into a master weak symbol dummy function kind of file. It really seems more trouble than it's worth; we don't have *that* many weaks in the kernel, not all of them are trivial, and that way it's better to keep them as close as we can to the point of usage.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 7 lines · Yinghai Lu
Quoted 6 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
ok, agreed. I was hoping for some more generic workaround but nothing seemed to keep gcc from inlining such functions.
Quoted 6 lines
Quoted 4 lines
Other than blacklisting those gcc versions. It's pretty easy to understand how a bug like that could creep in, since one of the main improvements of the early gcc4 series was better inlining as an optimization.
1. one time path add one dummy printk
dummy printks are not a good idea at all. Often the weak versions are the ones that get used and it would be very annoying if there was a per boot (or even per syscall!) 'dummy printk'.
Quoted 2 lines
2. multi path, could move it to another file. could add one like
kernel/weak.cto collect those ...
that pretty much removes the advantages of __weak symbols: to provide default implementations for various functionality, without having to do #ifdefs. The default implementation will often want to be near the usage site - so these bugs will reoccur again and again.
Ingo
[git pull] sparseirq / irq fixes
In reply to Ingo MolnarLinus,
Please pull the latest irq-fixes-for-linus-2 git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus-2
these are the latest updates/fixes for the irq-core-for-linus tree.
Thanks,
Ingo
------------------>
Ingo Molnar (2):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fix desc->lock init
KOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq: for_each_irq_desc() move to irqnr.h
proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
irq: simplify for_each_irq_desc() usage
Yinghai Lu (4):
sparseirq: remove duplicated arch_early_irq_init()
sparseirq: work around compiler optimizing away __weak functions
sparseirq: set lock_class for legacy irq when sparse_irq is selected
sparseirq: fix hang with !SPARSE_IRQ
arch/x86/kernel/io_apic.c | 18 +++++----------- drivers/xen/events.c | 3 -- fs/proc/stat.c | 11 +--------- include/linux/irq.h | 30 ++++++---------------------- include/linux/irqnr.h | 23 ++++++++++++--------- init/main.c | 7 +++-- kernel/hrtimer.c | 1 - kernel/irq/autoprobe.c | 15 -------------- kernel/irq/handle.c | 47 ++++++++++++++++++++++++++++++++------------ kernel/irq/numa_migrate.c | 7 +---- kernel/irq/spurious.c | 5 ---- 11 files changed, 67 insertions(+), 100 deletions(-)
arch/x86/kernel/io_apic.c +6 -12
@@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = { [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, }; -void __init arch_early_irq_init (void ) +int __init arch_early_irq_init (void ) {struct irq_cfg *cfg;struct irq_desc *desc;
@@ -184,6 +184,8 @@ void __init arch_early_irq_init(void) desc =irq_to_desc (i); desc->chip_data = &cfg[i]; } + +return 0 ; }#ifdef CONFIG_SPARSE_IRQ
@@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)return cfg; } -void arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int cpu) {struct irq_cfg *cfg;
@@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)BUG_ON (1 ); } } + +return 0 ; }#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)/* Mark the inuse vectors */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; cfg = desc->chip_data;if (!cpu_isset (cpu, cfg->domain))continue ;
@@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)for_each_irq_desc (irq, desc) {struct irq_pin_list *entry; -if (!desc) -continue ; cfg = desc->chip_data; entry = cfg->irq_2_pin;if (!entry)
@@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)struct irq_desc *desc;for_each_irq_desc (irq, desc) { -if (!desc) -continue ; -if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
@@ -2671,9 +2668,6 @@ static inline void init_IO_APIC_traps(void)* 0x80, because int 0x80 is hm, kind of importantish. ;) */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; - cfg = desc->chip_data;if (IO_APIC_IRQ (irq) && cfg && !cfg->vector) {/*
drivers/xen/events.c +0 -3
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)/* By default all event channels notify CPU#0. */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; - desc->affinity =cpumask_of_cpu (0 ); }#endif
fs/proc/stat.c +1 -10
@@ -9,6 +9,7 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/irqnr.h> #include <asm/cputime.h> #ifndef arch_irq_stat_cpu
@@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v) steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest);for_each_irq_nr (j) { -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) -continue ; -#endif sum +=kstat_irqs_cpu (j, i); } sum +=arch_irq_stat_cpu (i);
@@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? */ for_each_irq_nr (j) { per_irq_sum =0 ; -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) { -seq_printf (p," %u" , per_irq_sum); -continue ; - } -#endif for_each_possible_cpu (i) per_irq_sum +=kstat_irqs_cpu (j, i);
include/linux/irq.h +7 -23
@@ -193,42 +193,26 @@ struct irq_desc {const char *name; }____cacheline_internodealigned_in_smp ; -extern void early_irq_init (void ); -extern void arch_early_irq_init (void ); -extern void arch_init_chip_data (struct irq_desc *desc,int cpu); +extern int early_irq_init (void ); +extern int arch_early_irq_init (void ); +extern int arch_init_chip_data (struct irq_desc *desc,int cpu);extern void arch_init_copy_chip_data (struct irq_desc *old_desc,struct irq_desc *desc,int cpu);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 ]; - -static inline struct irq_desc *irq_to_desc (unsigned int irq) -{ -return (irq <NR_IRQS ) ? irq_desc + irq :NULL ; -} -static inline struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) -{ -return irq_to_desc (irq); -} - -#else - -extern struct irq_desc *irq_to_desc (unsigned int irq); -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +#else /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) -#define kstat_irqs_this_cpu (DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()])#define kstat_incr_irqs_this_cpu (irqno,DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()]++) -#endif +#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)
include/linux/irqnr.h +13 -10
@@ -15,20 +15,23 @@# define for_each_irq_desc_reverse (irq, desc) \ for (irq = nr_irqs - 1; irq >= 0; irq--) -#else +#else /* CONFIG_GENERIC_HARDIRQS */ extern int nr_irqs; +extern struct irq_desc *irq_to_desc (unsigned int irq); -#ifndef CONFIG_SPARSE_IRQ +# define for_each_irq_desc (irq, desc) \ + for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ + irq++, desc = irq_to_desc(irq)) \ + if (desc) -struct irq_desc ; -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ - irq >= 0; irq--, desc--) -#endif -#endif + +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ + irq--, desc = irq_to_desc(irq)) \ + if (desc) + +#endif /* CONFIG_GENERIC_HARDIRQS */ #define for_each_irq_nr (irq) \ for (irq = 0; irq < nr_irqs; irq++)
init/main.c +4 -3
@@ -539,13 +539,14 @@ void __init __weak thread_info_cache_init(void) { } -void __init __weak arch_early_irq_init (void ) +int __init __weak arch_early_irq_init (void ) { +return 0 ; } -void __init __weak early_irq_init (void ) +int __init __weak early_irq_init (void ) { -arch_early_irq_init (); +return arch_early_irq_init (); } asmlinkage void __init start_kernel(void)
kernel/hrtimer.c +0 -1
@@ -32,7 +32,6 @@*/ #include <linux/cpu.h> -#include <linux/irq.h> #include <linux/module.h> #include <linux/percpu.h> #include <linux/hrtimer.h>
kernel/irq/autoprobe.c +0 -15
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)* flush such a longstanding irq before considering it as spurious. */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) {/*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)* happened in the previous stage, it may have masked itself) */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) { desc->status |=IRQ_AUTODETECT |IRQ_WAITING ;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)int i;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)unsigned int status;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
kernel/irq/handle.c +34 -13
107 lines not on this page · raw message
kernel/irq/numa_migrate.c +2 -5
@@ -42,6 +42,7 @@ static void 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)); +spin_lock_init (&desc->lock); desc->cpu = cpu;lockdep_set_class (&desc->lock, &irq_desc_lock_class);init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids);
@@ -74,10 +75,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " move irq_desc for %d to cpu %d node %d\n" , - irq, cpu, node);if (!desc) { -printk (KERN_ERR "can not get new irq_desc for moving\n" ); +printk (KERN_ERR "irq %d: can not get new irq_desc for migration.\n" , irq);/* still use old one */ desc = old_desc; goto out_unlock;
@@ -106,8 +105,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)return desc; old_cpu = desc->cpu; -printk (KERN_DEBUG -"try to move irq_desc from cpu %d to %d\n" , old_cpu, cpu);if (old_cpu != cpu) { node =cpu_to_node (cpu); old_node =cpu_to_node (old_cpu);
kernel/irq/spurious.c +0 -5
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)int i, ok =0 ;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -if (!i)continue ;
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)for_each_irq_desc (i, desc) {unsigned int status; -if (!desc) -continue ;if (!i)continue ;
[git pull] sparseirq / irq fixes
Linus,
Please pull the latest irq-fixes-for-linus-4 git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus-4
[ shortlog is relative to irq-core-for-linus - can be pulled in any order. ]
This contains the __weak alias bug fixes.
Thanks,
Ingo
------------------>
Ingo Molnar (3):
sparseirq: do not printk when migrating IRQ descriptors
sparseirq: fix desc->lock init
sparseirq: work around __weak alias bug
KOSAKI Motohiro (4):
hrtimer: remove #include <linux/irq.h>
irq: for_each_irq_desc() move to irqnr.h
proc: remove ifdef CONFIG_SPARSE_IRQ from stat.c
irq: simplify for_each_irq_desc() usage
Yinghai Lu (5):
sparseirq: remove duplicated arch_early_irq_init()
sparseirq: work around compiler optimizing away __weak functions
sparseirq: set lock_class for legacy irq when sparse_irq is selected
sparseirq: fix hang with !SPARSE_IRQ
sparseirq: move __weak symbols into separate compilation unit
arch/x86/kernel/io_apic.c | 18 +++++----------- drivers/xen/events.c | 3 -- fs/proc/stat.c | 11 +--------- include/linux/interrupt.h | 6 +++++ include/linux/irq.h | 27 +++--------------------- include/linux/irqnr.h | 23 ++++++++++++--------- init/main.c | 9 -------- kernel/hrtimer.c | 1 - kernel/irq/autoprobe.c | 15 -------------- kernel/irq/handle.c | 48 ++++++++++++++++++++++++++++++--------------- kernel/irq/numa_migrate.c | 7 +---- kernel/irq/spurious.c | 5 ---- kernel/softirq.c | 20 ++++++++++++++++++ 13 files changed, 84 insertions(+), 109 deletions(-)
arch/x86/kernel/io_apic.c +6 -12
@@ -170,7 +170,7 @@ static struct irq_cfg irq_cfgx[NR_IRQS] = { [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, }, }; -void __init arch_early_irq_init (void ) +int __init arch_early_irq_init (void ) {struct irq_cfg *cfg;struct irq_desc *desc;
@@ -184,6 +184,8 @@ void __init arch_early_irq_init(void) desc =irq_to_desc (i); desc->chip_data = &cfg[i]; } + +return 0 ; }#ifdef CONFIG_SPARSE_IRQ
@@ -212,7 +214,7 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu)return cfg; } -void arch_init_chip_data (struct irq_desc *desc,int cpu) +int arch_init_chip_data (struct irq_desc *desc,int cpu) {struct irq_cfg *cfg;
@@ -224,6 +226,8 @@ void arch_init_chip_data(struct irq_desc *desc, int cpu)BUG_ON (1 ); } } + +return 0 ; }#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
@@ -1345,8 +1349,6 @@ void __setup_vector_irq(int cpu)/* Mark the inuse vectors */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; cfg = desc->chip_data;if (!cpu_isset (cpu, cfg->domain))continue ;
@@ -1730,8 +1732,6 @@ __apicdebuginit(void) print_IO_APIC(void)for_each_irq_desc (irq, desc) {struct irq_pin_list *entry; -if (!desc) -continue ; cfg = desc->chip_data; entry = cfg->irq_2_pin;if (!entry)
@@ -2378,9 +2378,6 @@ static void ir_irq_migration(struct work_struct *work)struct irq_desc *desc;for_each_irq_desc (irq, desc) { -if (!desc) -continue ; -if (desc->status &IRQ_MOVE_PENDING ) {unsigned long flags;
@@ -2671,9 +2668,6 @@ static inline void init_IO_APIC_traps(void)* 0x80, because int 0x80 is hm, kind of importantish. ;) */ for_each_irq_desc (irq, desc) { -if (!desc) -continue ; - cfg = desc->chip_data;if (IO_APIC_IRQ (irq) && cfg && !cfg->vector) {/*
drivers/xen/events.c +0 -3
@@ -142,9 +142,6 @@ static void init_evtchn_cpu_bindings(void)/* By default all event channels notify CPU#0. */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; - desc->affinity =cpumask_of_cpu (0 ); }#endif
fs/proc/stat.c +1 -10
@@ -9,6 +9,7 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/irqnr.h> #include <asm/cputime.h> #ifndef arch_irq_stat_cpu
@@ -45,10 +46,6 @@ static int show_stat(struct seq_file *p, void *v) steal =cputime64_add (steal,kstat_cpu (i).cpustat.steal); guest =cputime64_add (guest,kstat_cpu (i).cpustat.guest);for_each_irq_nr (j) { -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) -continue ; -#endif sum +=kstat_irqs_cpu (j, i); } sum +=arch_irq_stat_cpu (i);
@@ -95,12 +92,6 @@ static int show_stat(struct seq_file *p, void *v)/* sum again ? it could be updated? */ for_each_irq_nr (j) { per_irq_sum =0 ; -#ifdef CONFIG_SPARSE_IRQ -if (!irq_to_desc (j)) { -seq_printf (p," %u" , per_irq_sum); -continue ; - } -#endif for_each_possible_cpu (i) per_irq_sum +=kstat_irqs_cpu (j, i);
include/linux/interrupt.h +6 -0
@@ -467,4 +467,10 @@ static inline void init_irq_proc(void)int show_interrupts (struct seq_file *p,void *v); +struct irq_desc ; + +extern int early_irq_init (void ); +extern int arch_early_irq_init (void ); +extern int arch_init_chip_data (struct irq_desc *desc,int cpu); +#endif
include/linux/irq.h +4 -23
@@ -193,42 +193,23 @@ struct irq_desc {const char *name; }____cacheline_internodealigned_in_smp ; -extern void early_irq_init (void ); -extern void arch_early_irq_init (void ); -extern void arch_init_chip_data (struct irq_desc *desc,int cpu);extern void arch_init_copy_chip_data (struct irq_desc *old_desc,struct irq_desc *desc,int cpu);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 ]; - -static inline struct irq_desc *irq_to_desc (unsigned int irq) -{ -return (irq <NR_IRQS ) ? irq_desc + irq :NULL ; -} -static inline struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu) -{ -return irq_to_desc (irq); -} - -#else - -extern struct irq_desc *irq_to_desc (unsigned int irq); -extern struct irq_desc *irq_to_desc_alloc_cpu (unsigned int irq,int cpu); +#else /* CONFIG_SPARSE_IRQ */ extern struct irq_desc *move_irq_desc (struct irq_desc *old_desc,int cpu); -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) -#define kstat_irqs_this_cpu (DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()])#define kstat_incr_irqs_this_cpu (irqno,DESC ) \ ((DESC)->kstat_irqs[smp_processor_id()]++) -#endif +#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)
include/linux/irqnr.h +13 -10
@@ -15,20 +15,23 @@# define for_each_irq_desc_reverse (irq, desc) \ for (irq = nr_irqs - 1; irq >= 0; irq--) -#else +#else /* CONFIG_GENERIC_HARDIRQS */ extern int nr_irqs; +extern struct irq_desc *irq_to_desc (unsigned int irq); -#ifndef CONFIG_SPARSE_IRQ +# define for_each_irq_desc (irq, desc) \ + for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ + irq++, desc = irq_to_desc(irq)) \ + if (desc) -struct irq_desc ; -# define for_each_irq_desc (irq, desc) \ - for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) -# define for_each_irq_desc_reverse (irq, desc) \ - for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ - irq >= 0; irq--, desc--) -#endif -#endif + +# define for_each_irq_desc_reverse (irq, desc) \ + for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ + irq--, desc = irq_to_desc(irq)) \ + if (desc) + +#endif /* CONFIG_GENERIC_HARDIRQS */ #define for_each_irq_nr (irq) \ for (irq = 0; irq < nr_irqs; irq++)
init/main.c +0 -9
@@ -539,15 +539,6 @@ void __init __weak thread_info_cache_init(void) { } -void __init __weak arch_early_irq_init (void ) -{ -} - -void __init __weak early_irq_init (void ) -{ -arch_early_irq_init (); -} - asmlinkage void __init start_kernel(void) {char * command_line;
kernel/hrtimer.c +0 -1
@@ -32,7 +32,6 @@*/ #include <linux/cpu.h> -#include <linux/irq.h> #include <linux/module.h> #include <linux/percpu.h> #include <linux/hrtimer.h>
kernel/irq/autoprobe.c +0 -15
@@ -40,9 +40,6 @@ unsigned long probe_irq_on(void)* flush such a longstanding irq before considering it as spurious. */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) {/*
@@ -71,9 +68,6 @@ unsigned long probe_irq_on(void)* happened in the previous stage, it may have masked itself) */ for_each_irq_desc_reverse (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock);if (!desc->action && !(desc->status &IRQ_NOPROBE )) { desc->status |=IRQ_AUTODETECT |IRQ_WAITING ;
@@ -92,9 +86,6 @@ unsigned long probe_irq_on(void)* Now filter out any obviously spurious interrupts */ for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -133,9 +124,6 @@ unsigned int probe_irq_mask(unsigned long val)int i;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
@@ -178,9 +166,6 @@ int probe_irq_off(unsigned long val)unsigned int status;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -spin_lock_irq (&desc->lock); status = desc->status;
kernel/irq/handle.c +32 -16
105 lines not on this page · raw message
kernel/irq/numa_migrate.c +2 -5
@@ -42,6 +42,7 @@ static void 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)); +spin_lock_init (&desc->lock); desc->cpu = cpu;lockdep_set_class (&desc->lock, &irq_desc_lock_class);init_copy_kstat_irqs (old_desc, desc, cpu, nr_cpu_ids);
@@ -74,10 +75,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, node =cpu_to_node (cpu); desc =kzalloc_node (sizeof (*desc),GFP_ATOMIC , node); -printk (KERN_DEBUG " move irq_desc for %d to cpu %d node %d\n" , - irq, cpu, node);if (!desc) { -printk (KERN_ERR "can not get new irq_desc for moving\n" ); +printk (KERN_ERR "irq %d: can not get new irq_desc for migration.\n" , irq);/* still use old one */ desc = old_desc; goto out_unlock;
@@ -106,8 +105,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)return desc; old_cpu = desc->cpu; -printk (KERN_DEBUG -"try to move irq_desc from cpu %d to %d\n" , old_cpu, cpu);if (old_cpu != cpu) { node =cpu_to_node (cpu); old_node =cpu_to_node (old_cpu);
kernel/irq/spurious.c +0 -5
@@ -91,9 +91,6 @@ static int misrouted_irq(int irq)int i, ok =0 ;for_each_irq_desc (i, desc) { -if (!desc) -continue ; -if (!i)continue ;
@@ -115,8 +112,6 @@ static void poll_spurious_irqs(unsigned long dummy)for_each_irq_desc (i, desc) {unsigned int status; -if (!desc) -continue ;if (!i)continue ;
kernel/softirq.c +20 -0
@@ -797,3 +797,23 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait) }EXPORT_SYMBOL (on_each_cpu);#endif + +/* +* [ These __weak aliases are kept in a separate compilation unit, so that +* GCC does not inline them incorrectly. ] +*/ + +int __init __weak early_irq_init (void ) +{ +return 0 ; +} + +int __init __weak arch_early_irq_init (void ) +{ +return 0 ; +} + +int __weak arch_init_chip_data (struct irq_desc *desc,int cpu) +{ +return 0 ; +}
Re: [git pull] sparseirq / irq fixes
Quoted 6 lines · Ingo Molnar
Please pull the latest irq-fixes-for-linus-4 git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus-4[ shortlog is relative to irq-core-for-linus - can be pulled in any order. ]
There is no branch of that name:
fatal: Couldn't find remote ref irq-fixes-for-linus-4
maybe you forgot to push it out?
Linus
Re: [git pull] sparseirq / irq fixes
Quoted 8 lines · Linus Torvalds
Quoted 5 lines · Ingo Molnar
Please pull the latest irq-fixes-for-linus-4 git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq-fixes-for-linus-4
Quoted 7 lines
Quoted 1 line
[ shortlog is relative to irq-core-for-linus - can be pulled in any order. ]
There is no branch of that name:
fatal: Couldn't find remote ref irq-fixes-for-linus-4
maybe you forgot to push it out?
yes - sorry! I have pushed it out now.
Ingo
Re: [sparseirq] remove debug printks (io_apic.c)
In reply to Ingo MolnarQuoted 8 lines · Ingo Molnar
Please pull the latest irq-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitirq-core-for-linusMost of the changes here are related to enable and implement sparseirq support on x86.
Quoted 11 lines
Yinghai Lu (10):
sparse irq_desc[] array: core kernel and x86 changes
x86: useNR_IRQS_LEGACY
x86: MSI start irq numbering fromnr_irqs_gsi
x86, MSI: passirq_cfgandirq_desc
sparseirq: fix Alpha build failure
sparseirq: fix !SMP && !PCI_MSI && !HT_IRQ build
x86, sparseirq: moveirq_descaccording tosmp_affinity, v7
sparseirq: fix !SMP building, #2
sparseirq: add kernel-doc notation for new member inirq_desc, -v2
sparseirq: fixnuma_migrate_irq_descdependency and comments
The message "alloc irq_2_pin on cpu 0 node 0" is printed way too often.
% dmesg|grep irq_2_pin|wc -l
20
Get rid of the debug printks.
--- arch/x86/kernel/io_apic.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/x86/kernel/io_apic.c +0 -2
@@ -129,7 +129,6 @@ static struct irq_pin_list *get_one_free_irq_2_pin(int cpu) node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_2_pin on cpu %d node %d\n" , cpu, node);return pin; }
@@ -207,7 +206,6 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu) node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_cfg on cpu %d node %d\n" , cpu, node);return cfg; }
Signature · 1 line
Markus
Re: [sparseirq] remove debug printks (io_apic.c)
Quoted 46 lines · Markus Trippelsdorf
Quoted 8 lines · Ingo Molnar
Please pull the latest irq-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitirq-core-for-linusMost of the changes here are related to enable and implement sparseirq support on x86.
Quoted 11 lines
Yinghai Lu (10):
sparse irq_desc[] array: core kernel and x86 changes
x86: useNR_IRQS_LEGACY
x86: MSI start irq numbering fromnr_irqs_gsi
x86, MSI: passirq_cfgandirq_desc
sparseirq: fix Alpha build failure
sparseirq: fix !SMP && !PCI_MSI && !HT_IRQ build
x86, sparseirq: moveirq_descaccording tosmp_affinity, v7
sparseirq: fix !SMP building, #2
sparseirq: add kernel-doc notation for new member inirq_desc, -v2
sparseirq: fixnuma_migrate_irq_descdependency and commentsThe message "alloc
irq_2_pinon cpu 0 node 0" is printed way too often.% dmesg|grep irq_2_pin|wc -l
20Get rid of the debug printks.
Signed-off-by Markus Trippelsdorf <[email protected]>--- arch/x86/kernel/io_apic.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)arch/x86/kernel/io_apic.c +0
-1@@ -129,7 +129,6 @@ static struct irq_pin_list *get_one_free_irq_2_pin(int cpu) node =cpu_to_node (cpu); pin =kzalloc_node (sizeof (*pin),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_2_pin on cpu %d node %d\n" , cpu, node);return pin; }
arch/x86/kernel/io_apic.c static struct irq_cfg *get_one_free_irq_cfg(int cpu) · line 210
Quoted 6 lines
arch/x86/kernel/io_apic.c +0
-1@@ -207,7 +206,6 @@ static struct irq_cfg *get_one_free_irq_cfg(int cpu) node =cpu_to_node (cpu); cfg =kzalloc_node (sizeof (*cfg),GFP_ATOMIC , node); -printk (KERN_DEBUG " alloc irq_cfg on cpu %d node %d\n" , cpu, node);return cfg;
Agreed, those are not needed - i've applied your patch to tip/x86/urgent, thanks!
Ingo