[PATCH v2 00/12] proc/stat: Maintain monotonicity of "intr" and "softirq"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's a patch set that makes /proc/stat report total interrupt counts
as monotonically increasing values, just like individual counters for
interrupt types and CPUs are.

The total counters are not actually maintained but computed from
individual counters. These counters must all have the same width
for their sum to wrap around in correct and expected manner.

This patch set unifies all counters that are displayed by /proc/stat
and /proc/interrupts to use "unsigned long" (instead of "unsigned int"
values that get summed into u64, which causes problems for userspace
monitoring tools when the individual counters wrap around).

v1 -> v2:

  - Added READ_ONCE to all reads of per-CPU counters
  - Widened and unified all counters to "unsigned long"
    instead of clamping them all to "unsigned int"
  - Fixed typos in documentation

Since the scope of changes has expanded, I think these patches will
need to be seen and vetted by more people (get-maintainer.pl agrees)
but for now I'll keep the same CC list as for v1.

Unresolved questions:

  - Does READ_ONCE addition has any merit without WRITE_ONCE?

  - Some counters turned out to be unaccounted for in the total sum.
    Should they be included there? Or are they omitted on purpose?

  - I haven't tested this on PowerPC since I don't have the hardware

Alexei Lozovsky (12):
  genirq: Use READ_ONCE for IRQ counter reads
  genirq: Use unsigned long for IRQ counters
  powerpc/irq: Use READ_ONCE for IRQ counter reads
  powerpc/irq: Use unsigned long for IRQ counters
  powerpc/irq: Use unsigned long for IRQ counter sum
  x86/irq: Use READ_ONCE for IRQ counter reads
  x86/irq: Use unsigned long for IRQ counters
  x86/irq: Use unsigned long for IRQ counters more
  x86/irq: Use unsigned long for IRQ counter sum
  proc/stat: Use unsigned long for "intr" sum
  proc/stat: Use unsigned long for "softirq" sum
  docs: proc.rst: stat: Note the interrupt counter wrap-around

 Documentation/filesystems/proc.rst |  8 +++
 arch/powerpc/include/asm/hardirq.h | 20 ++++----
 arch/powerpc/include/asm/paca.h    |  2 +-
 arch/powerpc/kernel/irq.c          | 42 +++++++--------
 arch/x86/include/asm/hardirq.h     | 26 +++++-----
 arch/x86/include/asm/hw_irq.h      |  4 +-
 arch/x86/include/asm/mce.h         |  4 +-
 arch/x86/kernel/apic/apic.c        |  2 +-
 arch/x86/kernel/apic/io_apic.c     |  4 +-
 arch/x86/kernel/cpu/mce/core.c     |  4 +-
 arch/x86/kernel/i8259.c            |  2 +-
 arch/x86/kernel/irq.c              | 82 +++++++++++++++---------------
 fs/proc/softirqs.c                 |  2 +-
 fs/proc/stat.c                     | 12 ++---
 include/linux/kernel_stat.h        | 10 ++--
 kernel/rcu/tree.h                  |  2 +-
 kernel/rcu/tree_stall.h            |  4 +-
 17 files changed, 119 insertions(+), 111 deletions(-)

-- 
2.25.1



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux