diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-08-19 23:50:20 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:52:51 -0400 |
commit | 52b17329d6d0a4824b89206803a430915031ff23 (patch) | |
tree | 714884d90d67a771eef01863a677d502b2d758fc | |
parent | a2f9f43858db64cb8b45c4f6746d7a52b80d4dcb (diff) |
x86_64: make /proc/interrupts work with dyn irq_desc
loop with irq_desc list
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/irq_64.c | 31 | ||||
-rw-r--r-- | fs/proc/proc_misc.c | 28 |
2 files changed, 48 insertions, 11 deletions
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index 5d5976e0311a..7bd841a9c640 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
@@ -70,9 +70,27 @@ static inline void stack_overflow_check(struct pt_regs *regs) | |||
70 | 70 | ||
71 | int show_interrupts(struct seq_file *p, void *v) | 71 | int show_interrupts(struct seq_file *p, void *v) |
72 | { | 72 | { |
73 | int i = *(loff_t *) v, j; | 73 | int i, j; |
74 | struct irqaction * action; | 74 | struct irqaction * action; |
75 | unsigned long flags; | 75 | unsigned long flags; |
76 | unsigned int entries; | ||
77 | struct irq_desc *desc; | ||
78 | int tail = 0; | ||
79 | |||
80 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
81 | desc = (struct irq_desc *)v; | ||
82 | entries = -1U; | ||
83 | i = desc->irq; | ||
84 | if (!desc->next) | ||
85 | tail = 1; | ||
86 | #else | ||
87 | entries = nr_irqs - 1; | ||
88 | i = *(loff_t *) v; | ||
89 | if (i == nr_irqs) | ||
90 | tail = 1; | ||
91 | else | ||
92 | desc = irq_to_desc(i); | ||
93 | #endif | ||
76 | 94 | ||
77 | if (i == 0) { | 95 | if (i == 0) { |
78 | seq_printf(p, " "); | 96 | seq_printf(p, " "); |
@@ -81,12 +99,8 @@ int show_interrupts(struct seq_file *p, void *v) | |||
81 | seq_putc(p, '\n'); | 99 | seq_putc(p, '\n'); |
82 | } | 100 | } |
83 | 101 | ||
84 | if (i < nr_irqs) { | 102 | if (i <= entries) { |
85 | unsigned any_count = 0; | 103 | unsigned any_count = 0; |
86 | struct irq_desc *desc = irq_to_desc(i); | ||
87 | |||
88 | if (!desc) | ||
89 | return 0; | ||
90 | 104 | ||
91 | spin_lock_irqsave(&desc->lock, flags); | 105 | spin_lock_irqsave(&desc->lock, flags); |
92 | #ifndef CONFIG_SMP | 106 | #ifndef CONFIG_SMP |
@@ -116,7 +130,9 @@ int show_interrupts(struct seq_file *p, void *v) | |||
116 | seq_putc(p, '\n'); | 130 | seq_putc(p, '\n'); |
117 | skip: | 131 | skip: |
118 | spin_unlock_irqrestore(&desc->lock, flags); | 132 | spin_unlock_irqrestore(&desc->lock, flags); |
119 | } else if (i == nr_irqs) { | 133 | } |
134 | |||
135 | if (tail) { | ||
120 | seq_printf(p, "NMI: "); | 136 | seq_printf(p, "NMI: "); |
121 | for_each_online_cpu(j) | 137 | for_each_online_cpu(j) |
122 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); | 138 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); |
@@ -155,6 +171,7 @@ skip: | |||
155 | seq_printf(p, " Spurious interrupts\n"); | 171 | seq_printf(p, " Spurious interrupts\n"); |
156 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | 172 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); |
157 | } | 173 | } |
174 | |||
158 | return 0; | 175 | return 0; |
159 | } | 176 | } |
160 | 177 | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index c3cbabe8b38e..72dd739a7f8a 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -645,15 +645,36 @@ static const struct file_operations proc_stat_operations = { | |||
645 | */ | 645 | */ |
646 | static void *int_seq_start(struct seq_file *f, loff_t *pos) | 646 | static void *int_seq_start(struct seq_file *f, loff_t *pos) |
647 | { | 647 | { |
648 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
649 | struct irq_desc *desc; | ||
650 | int irq; | ||
651 | int count = *pos; | ||
652 | |||
653 | for_each_irq_desc(irq, desc) { | ||
654 | if (count-- == 0) | ||
655 | return desc; | ||
656 | } | ||
657 | |||
658 | return NULL; | ||
659 | #else | ||
648 | return (*pos <= nr_irqs) ? pos : NULL; | 660 | return (*pos <= nr_irqs) ? pos : NULL; |
661 | #endif | ||
649 | } | 662 | } |
650 | 663 | ||
664 | |||
651 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) | 665 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) |
652 | { | 666 | { |
667 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
668 | struct irq_desc *desc; | ||
669 | |||
670 | desc = ((struct irq_desc *)v)->next; | ||
653 | (*pos)++; | 671 | (*pos)++; |
654 | if (*pos > nr_irqs) | 672 | |
655 | return NULL; | 673 | return desc; |
656 | return pos; | 674 | #else |
675 | (*pos)++; | ||
676 | return (*pos <= nr_irqs) ? pos : NULL; | ||
677 | #endif | ||
657 | } | 678 | } |
658 | 679 | ||
659 | static void int_seq_stop(struct seq_file *f, void *v) | 680 | static void int_seq_stop(struct seq_file *f, void *v) |
@@ -661,7 +682,6 @@ static void int_seq_stop(struct seq_file *f, void *v) | |||
661 | /* Nothing to do */ | 682 | /* Nothing to do */ |
662 | } | 683 | } |
663 | 684 | ||
664 | |||
665 | static const struct seq_operations int_seq_ops = { | 685 | static const struct seq_operations int_seq_ops = { |
666 | .start = int_seq_start, | 686 | .start = int_seq_start, |
667 | .next = int_seq_next, | 687 | .next = int_seq_next, |