vmstat reports no interrupts
Running a recent kernel, I'm seeing no interrupt activity being reported by vmstat on my platforms. Investigating, it seems to be caused by this patch merged during the current merge window:
commit 3292beb340c76884427faa1f5d6085719477d889
Author: Glauber Costa <[email protected]> Date: Mon Nov 28 14:45:17 2011 -0200
sched/accounting: Change cpustat fields to an array
This patch changes fields in cpustat from a structure, to an u64 array. Math gets easier, and the code is more flexible.
This patch modifies show_stat() thusly:
u64 sum = 0;
for_each_possible_cpu(i) {...
- sum += kstat_cpu_irqs_sum(i);
- sum += arch_irq_stat_cpu(i);
where 'sum' is the first value displayed on /proc/stat's intr line. However, this file still contains:
#ifndef arch_irq_stat_cpu
#define arch_irq_stat_cpu(cpu) 0
#endif
#ifndef arch_irq_stat
#define arch_irq_stat() 0
#endif
#ifndef arch_idle_time
#define arch_idle_time(cpu) 0
#endif
at the top, and otherwise doesn't reference arch_irq_stat_cpu() anymore.
Although x86 (and only x86) implements arch_irq_stat(), this doesn't return the total number of interrupts on the system. Therefore, I conclude that the same bug that I'm seeing on ARM should be visible on every other arch, including x86.
I think this commit wasn't meant to delete these. The patch below restores vmstat's original behaviour for me. Please confirm this fix and submit upstream.
8<====
From: Russell King <[email protected]>
proc: fix /proc/stat intr sum
Commit 3292beb340c7688 (sched/accounting: Change cpustat fields to an array) deleted the code which provides us with the sum of all interrupts in the system, causing vmstat to report zero interrupts occuring in the system. Fix this by restoring the code.
--- fs/proc/stat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/proc/stat.c +2 -0
@@ -77,6 +77,8 @@ static int show_stat(struct seq_file *p, void *v) steal +=kcpustat_cpu (i).cpustat[CPUTIME_STEAL ]; guest +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST ]; guest_nice +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST_NICE ]; + sum +=kstat_cpu_irqs_sum (i); + sum +=arch_irq_stat_cpu (i);for (j =0 ; j <NR_SOFTIRQS ; j++) {unsigned int softirq_stat =kstat_softirqs_cpu (j, i);
Tony Luck
Tested-byQuoted 2 lines · Russell King - ARM Linux
+ sum +=
kstat_cpu_irqs_sum(i);
+ sum +=arch_irq_stat_cpu(i);
It was broken on ia64 too - this patch fixes it.
Steven Rostedt
Tested-byQuoted 7 lines · Russell King - ARM Linux
From: Russell King <[email protected]>
proc: fix/proc/statintr sumCommit
3292beb340c7688(sched/accounting: Change cpustat fields to an array) deleted the code which provides us with the sum of all interrupts in the system, causing vmstat to report zero interrupts occuring in the system. Fix this by restoring the code.
I booted up latest Linus tree on my PPC64 and saw the same thing. I tried out this patch and it did fix the problem. I also tested v3.2 and it did not have the issue.
v3.2:
intr 44685 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1698 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 119 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5731 1535 0 0
-- Steve
Quoted 3 lines
Signed-off-by Russell King <[email protected]>
Eric Dumazet
Acked-byLe samedi 14 janvier 2012 à 00:01 +0000, Russell King - ARM Linux a écrit :
Quoted 20 lines
From: Russell King <[email protected]>
proc: fix/proc/statintr sumCommit
3292beb340c7688(sched/accounting: Change cpustat fields to an array) deleted the code which provides us with the sum of all interrupts in the system, causing vmstat to report zero interrupts occuring in the system. Fix this by restoring the code.Signed-off-by Russell King <[email protected]>--- fs/proc/stat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/proc/stat.c +0
-0
fs/proc/stat.c static int show_stat(struct seq_file *p, void *v) · line 84
Quoted 8 lines
fs/proc/stat.c +2
-0@@ -77,6 +77,8 @@ static int show_stat(struct seq_file *p, void *v) steal +=kcpustat_cpu (i).cpustat[CPUTIME_STEAL ]; guest +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST ]; guest_nice +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST_NICE ]; + sum +=kstat_cpu_irqs_sum (i); + sum +=arch_irq_stat_cpu (i);for (j =0 ; j <NR_SOFTIRQS ; j++) {unsigned int softirq_stat =kstat_softirqs_cpu (j, i);
Any news on this patch being accepted and pushed to Linus ?
Thanks
Quoted 27 lines · Eric Dumazet
Le samedi 14 janvier 2012 à 00:01 +0000, Russell King - ARM Linux a écrit :
Quoted 25 lines
From: Russell King <[email protected]>
proc: fix/proc/statintr sumCommit
3292beb340c7688(sched/accounting: Change cpustat fields to an array) deleted the code which provides us with the sum of all interrupts in the system, causing vmstat to report zero interrupts occuring in the system. Fix this by restoring the code.Signed-off-by Russell King <[email protected]>--- fs/proc/stat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/proc/stat.c +2
-0@@ -77,6 +77,8 @@ static int show_stat(struct seq_file *p, void *v) steal +=kcpustat_cpu (i).cpustat[CPUTIME_STEAL ]; guest +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST ]; guest_nice +=kcpustat_cpu (i).cpustat[CPUTIME_GUEST_NICE ]; + sum +=kstat_cpu_irqs_sum (i); + sum +=arch_irq_stat_cpu (i);
Quoted 5 lines
fs/proc/stat.c static int show_stat(struct seq_file *p, void *v) · line 84
Quoted 3 lines
fs/proc/stat.c +0
-0for (j =0 ; j <NR_SOFTIRQS ; j++) {unsigned int softirq_stat =kstat_softirqs_cpu (j, i);Any news on this patch being accepted and pushed to Linus ?
It should be in v3.3-rc1.
Thanks,
Ingo
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Eric Dumazet
Any news on this patch being accepted and pushed to Linus ?
It should be in v3.3-rc1.
Indeed it is, I saw that yesterday.
Thanks