proc/stat: Maintain monotonicity of "intr" and "softirq"
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest12 patches 0 repliesNew
- v17 patches 5 repliesSuperseded
Changes in v2 from the cover letter
- 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
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | genirq: Use READ_ONCE for IRQ counter readsinclude/ | +2 | 0 replies | |
| 2/12 | genirq: Use unsigned long for IRQ countersfs/ fs/ include/ +2 more | +8 | 0 replies | |
| 3/12 | powerpc/irq: Use READ_ONCE for IRQ counter readsarch/ | +20 | 0 replies | |
| 4/12 | powerpc/irq: Use unsigned long for IRQ countersarch/ arch/ arch/ | +20 | 0 replies | |
| 5/12 | powerpc/irq: Use unsigned long for IRQ counter sumarch/ arch/ | +3 | 0 replies | |
| 6/12 | x86/irq: Use READ_ONCE for IRQ counter readsarch/ | +35 | 0 replies | |
| 7/12 | x86/irq: Use unsigned long for IRQ countersarch/ arch/ arch/ +1 more | +28 | 0 replies | |
| 8/12 | x86/irq: Use unsigned long for IRQ counters morearch/ arch/ arch/ +2 more | +10 | 0 replies | |
| 9/12 | x86/irq: Use unsigned long for IRQ counter sumarch/ arch/ | +6 | 0 replies | |
| 10/12 | proc/stat: Use unsigned long for "intr" sumfs/ | +2 | 0 replies | |
| 11/12 | proc/stat: Use unsigned long for "softirq" sumfs/ | +3 | 0 replies | |
| 12/12 | docs: proc.rst: stat: Note the interrupt counter wrap-aroundDocumentation/ | +8 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 00/12] proc/stat: Maintain monotonicity of "intr" and "softirq"
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(-)
Signature · 1 line
2.25.1