Is Your Linux Version Hiding Interrupt CPU Usage from You?
tanelpoder.com
tanelpoder.com
on newer x86_64 the accounting code is around 100-200 cycles, so not a big deal, interrupt return and exit code is more than that (save context, load new context etc.).
The RDTSC and fence timings (Latency, Reciprocal throughput) [0]:
AMD Zen 1
SFENCE 4 ~20
LFENCE 1 0.25
MFENCE 7 ~70
RDTSC 37 36
AMD Zen 2
SFENCE 1 1
LFENCE 1 11
MFENCE 7 ~78
RDTSC 37 37
AMD Zen 3
SFENCE 1 1
LFENCE 1 10
MFENCE 6 ~60
RDTSC 44 36
Intel Haswell
LFENCE 2 4
MFENCE 3 33
SFENCE 2 5
RDTSC 15 24
Intel Broadwell
LFENCE 2 4
MFENCE 3 33
SFENCE 2 6
RDTSC 15 24
Intel Skylake
LFENCE 2 4
MFENCE 4 33
SFENCE 2 6
RDTSC 20 25
Intel Skylake-X
LFENCE 2 4
MFENCE 4 33
SFENCE 2 6
RDTSC 20 25
Intel Coffee Lake
LFENCE 2 4
MFENCE 4 33
SFENCE 2 6
RDTSC 20 25
[0] https://www.agner.org/optimize/instruction_tables.pdf CONFIG_IRQ_TIME_ACCOUNTING:
Select this option to enable fine granularity task irq time
accounting. This is done by reading a timestamp on each
transitions between softirq and hardirq state, so there can be a
small *performance impact*.
If in doubt, say N here.
So I didn't enable this option in my kernels afraid of loosing performance on my laptop.I would say that on your laptop, you probably wouldn't even notice a difference (as the "rdtsc" timestamp reading operations are pretty efficient & done entirely within a CPU). But with anything that can interact with external hardware million(s) of times per second (heavy SSD I/O in servers and moving large amounts of data over network), may see a minor (but measurable) hit.
In my experience, when large amounts of CPU gets used by interrupt routines (either hardware or software interrupts), that more likely indicates some bug or configuration issue in a device driver or even some faulty hardware issue.
edit: so, running "dmesg" and checking hardware health metrics (mceloc, EDAC) is a reasonable thing to do when interrupt storms & related CPU usage suddenly show up.
I know in some embedded usecases, there are hundreds of thousands or millions of interrupts per second, and an interrupt routine might be only tens of clock cycles long. If that's the case, an extra bunch of instructions to time how long every single interrupt takes is a substantial overhead.
Yes.
> Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each transitions between softirq and hardirq state, so there can be a small performance impact.
[0] https://cateee.net/lkddb/web-lkddb/IRQ_TIME_ACCOUNTING.html
Looking at my machine: Funny to see 2h of interrupt processing over 12d uptime. Not that this is bad (0.80% on avg), but my first computer would have taken >6 weeks to process these interrupts - and not doing anything else. And that's only going by the clocks, a 80386 has a much worse IPC/pipeline than a 6th gen i7.
629 mW 2,6 ms/s 158,2 Interrupt [0] HI_SOFTIRQ
Is this related or another story and what can I do about it?