lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 14 Jan 2012 00:01:01 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Glauber Costa <glommer@...allels.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>
Cc:	linux-kernel@...r.kernel.org
Subject: [BUG] 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 <glommer@...allels.com>
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.

    Signed-off-by: Glauber Costa <glommer@...allels.com>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
    Cc: Linus Torvalds <torvalds@...ux-foundation.org>
    Cc: Andrew Morton <akpm@...ux-foundation.org>
    Cc: Paul Tuner <pjt@...gle.com>
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
    Link: http://lkml.kernel.org/r/1322498719-2255-2-git-send-email-glommer@parallels.com
    Signed-off-by: Ingo Molnar <mingo@...e.hu>

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 <rmk+kernel@....linux.org.uk>
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.

Signed-off-by: Russell King <rmk+kernel@....linux.org.uk>
Tested-by: Russell King <rmk+kernel@....linux.org.uk> [on ARM]
---
 fs/proc/stat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index d76ca6a..121f77c 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ