From: Alexei Lozovsky <me@ilammy.net>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Christoph Lameter <cl@linux.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 00/12] proc/stat: Maintain monotonicity of "intr" and "softirq"
Date: Thu, 16 Sep 2021 02:58:36 +0900 [thread overview]
Message-ID: <20210915175848.162260-1-me@ilammy.net> (raw)
In-Reply-To: <20210911034808.24252-1-me@ilammy.net>
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
next prev parent reply other threads:[~2021-09-15 17:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 8:53 /proc/stat interrupt counter wrap-around Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 0/7] proc/stat: Maintain monotonicity of "intr" and "softirq" Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 1/7] genirq: Use unsigned int for irqs_sum Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 2/7] powerpc/irq: arch_irq_stat_cpu() returns unsigned int Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 3/7] x86/irq: " Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 4/7] x86/irq: arch_irq_stat() " Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 5/7] proc/stat: Use unsigned int for "intr" sum Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 6/7] proc/stat: Use unsigned int for "softirq" sum Alexei Lozovsky
2021-09-11 3:48 ` [PATCH 7/7] docs: proc.rst: stat: Note the interrupt counter wrap-around Alexei Lozovsky
2021-09-11 3:59 ` Randy Dunlap
2021-09-12 9:30 ` [PATCH 0/7] proc/stat: Maintain monotonicity of "intr" and "softirq" Alexey Dobriyan
2021-09-12 12:37 ` Alexei Lozovsky
2021-09-14 14:11 ` Thomas Gleixner
2021-09-15 4:24 ` Alexei Lozovsky
2021-09-15 17:58 ` Alexei Lozovsky [this message]
2021-09-15 17:58 ` [PATCH v2 01/12] genirq: Use READ_ONCE for IRQ counter reads Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 02/12] genirq: Use unsigned long for IRQ counters Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 03/12] powerpc/irq: Use READ_ONCE for IRQ counter reads Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 04/12] powerpc/irq: Use unsigned long for IRQ counters Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 05/12] powerpc/irq: Use unsigned long for IRQ counter sum Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 06/12] x86/irq: Use READ_ONCE for IRQ counter reads Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 07/12] x86/irq: Use unsigned long for IRQ counters Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 08/12] x86/irq: Use unsigned long for IRQ counters more Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 09/12] x86/irq: Use unsigned long for IRQ counter sum Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 10/12] proc/stat: Use unsigned long for "intr" sum Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 11/12] proc/stat: Use unsigned long for "softirq" sum Alexei Lozovsky
2021-09-15 17:58 ` [PATCH v2 12/12] docs: proc.rst: stat: Note the interrupt counter wrap-around Alexei Lozovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210915175848.162260-1-me@ilammy.net \
--to=me@ilammy.net \
--cc=adobriyan@gmail.com \
--cc=cl@linux.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).