Improve /proc/interrupts further
Status from this message: The following commit has been merged into the irq/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest16 patches 14 repliesApplied
- v515 patches 8 repliesSuperseded
- v415 patches 7 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 14 patches | 4 replies | Superseded | |
| v2 | 14 patches | 31 replies | Superseded | |
| v1 | 14 patches | 9 replies | Superseded |
Changes in v6 from the cover letter
- Rebased against v7.1-rc2
- Addressed some formatting/alignment details - Radu, Michael
- Fixed some 0-day fallout vs. various Kconfig combinations
- Picked up tags where appropriate
Patches in v6 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/16 | x86/irq: Optimize interrupts decimals printingarch/ | +59 | 0 replies | |
| 2/16 | genirq/proc: Avoid formatting zero counts in /proc/interruptsinclude/ kernel/ | +39 | 1 reply | |
| 3/16 | genirq/proc: Utilize irq_desc::tot_count to avoid evaluationinclude/ kernel/ | +13 | 0 replies | |
| 4/16 | x86/irq: Make irqstats array basedarch/ arch/ arch/ +24 more | +174 | 1 reply | |
| 5/16 | x86/irq: Suppress unlikely interrupt stats by defaultarch/ arch/ arch/ +1 more | +31 | 4 replies | |
| 6/16 | x86/irq: Move IOAPIC misrouted and PIC/APIC error counts into irq_statsarch/ arch/ arch/ +4 more | +11 | 0 replies | |
| 7/16 | scripts/gdb: Update x86 interrupts to the array based storagescripts/ | +18 | 0 replies | |
| 8/16 | genirq: Expose nr_irqs in core codekernel/ kernel/ kernel/ +1 more | +18 | 1 reply | |
| 9/16 | genirq/manage: Make NMI cleanup RT safekernel/ | +21 | 0 replies | |
| 10/16 | genirq: Cache the condition for /proc/interrupts exposureinclude/ kernel/ kernel/ +3 more | +36 | 0 replies | |
| 11/16 | genirq: Calculate precision only when requiredkernel/ kernel/ kernel/ | +35 | 0 replies | |
| 12/16 | genirq/proc: Increase default interrupt number precision to fourarch/ arch/ arch/ +9 more | +29 | 0 replies | |
| 13/16 | genirq: Add rcuref count to struct irq_descinclude/ kernel/ kernel/ | +31 | 0 replies | |
| 14/16 | genirq: Expose irq_find_desc_at_or_after() in core codekernel/ kernel/ | +10 | 0 replies | |
| 15/16 | genirq/proc: Runtime size the chip namekernel/ kernel/ kernel/ +4 more | +111 | 0 replies | |
| 16/16 | genirq/proc: Speed up /proc/interrupts iterationfs/ kernel/ | +95 | 0 replies |
Reviews trailers per patch
14 of 16 patches have a Reviewed-by or Acked-by.
| Patch | Michael Kelley | Thomas Gleixner | Radu Rendec | Dmitry Ilvokhin | Florian Fainelli | Shrikanth Hegde |
|---|---|---|---|---|---|---|
| Series | T-b | T-b | ||||
| 1/16 | T-b | R-b | R-b | |||
| 2/16 | T-b | R-b | R-b | R-b | ||
| 3/16 | T-b | R-b | R-b | |||
| 4/16 | T-b | R-b | ||||
| 5/16 | T-b | R-b | ||||
| 6/16 | T-b | R-b | ||||
| 7/16 | T-b R-b | |||||
| 8/16 | T-b | R-b | R-b | R-b | ||
| 9/16 | T-b | |||||
| 10/16 | T-b | R-b | R-b | |||
| 11/16 | T-b | R-b | R-b | |||
| 12/16 | ||||||
| 13/16 | T-b | R-b | ||||
| 14/16 | T-b | R-b | ||||
| 15/16 | T-b | R-b | ||||
| 16/16 | T-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.
Cover letter [patch V6 00/16] Improve /proc/interrupts further
This is a follow up to v5 which can be found here:
https://lore.kernel.org/[email protected]
The v1 cover letter contains a full analysis, explanation and numbers:
https://lore.kernel.org/[email protected]
TLDR:
- The performance of reading of /proc/interrupts has been improved piecewise over the years, but most of the low hanging fruit has been left on the table.
Changes vs. V5:
- Rebased against v7.1-rc2
- Addressed some formatting/alignment details - Radu, Michael
- Fixed some 0-day fallout vs. various Kconfig combinations
- Picked up tags where appropriate
Delta patch against v5 is below.
The series applies on top of v7.1-rc2 and is also available via git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git irq-proc-v6
Thanks,
tglx
---
arch/alpha/kernel/irq.c +4 -4
@@ -72,16 +72,16 @@ int arch_show_interrupts(struct seq_file *p, int prec)int j;#ifdef CONFIG_SMP -seq_puts (p,"IPI: " ); +seq_puts (p," IPI: " );for_each_online_cpu (j)seq_printf (p,"%10lu " , cpu_data[j].ipi_count);seq_putc (p,'\n' );#endif -seq_puts (p,"PMI: " ); +seq_puts (p," PMI: " );for_each_online_cpu (j)seq_printf (p,"%10lu " ,per_cpu (irq_pmi_count, j)); -seq_puts (p," Performance Monitoring\n" ); -seq_printf (p,"ERR: %10lu\n" , irq_err_count); +seq_puts (p," Performance Monitoring\n" ); +seq_printf (p," ERR: %10lu\n" , irq_err_count);return 0 ; }
arch/arm/kernel/smp.c +1 -2
@@ -551,8 +551,7 @@ void show_ipi_list(struct seq_file *p, int prec)if (!ipi_desc[i])continue ; -seq_printf (p,"%*s%u:%s" , prec -1 ,"IPI" , i, - prec >=4 ?" " :"" ); +seq_printf (p,"%*s%u:" , prec -1 ,"IPI" , i);for_each_online_cpu (cpu)seq_printf (p,"%10u " ,irq_desc_kstat_cpu (ipi_desc[i], cpu));
arch/arm64/kernel/smp.c +2 -3
@@ -833,11 +833,10 @@ int arch_show_interrupts(struct seq_file *p, int prec)unsigned int cpu, i;for (i =0 ; i <MAX_IPI ; i++) { -seq_printf (p,"%*s%u:%s" , prec -1 ,"IPI" , i, - prec >=4 ?" " :"" ); +seq_printf (p,"%*s%u: " , prec -1 ,"IPI" , i);for_each_online_cpu (cpu)seq_printf (p,"%10u " ,irq_desc_kstat_cpu (get_ipi_desc (cpu, i), cpu)); -seq_printf (p," %s\n" , ipi_types[i]); +seq_printf (p," %s\n" , ipi_types[i]); }seq_printf (p,"%*s: %10lu\n" , prec,"Err" , irq_err_count);
arch/loongarch/kernel/smp.c +1 -1
@@ -88,7 +88,7 @@ void show_ipi_list(struct seq_file *p, int prec)unsigned int cpu, i;for (i =0 ; i <NR_IPI ; i++) { -seq_printf (p,"%*s%u:%s" , prec -1 ,"IPI" , i, prec >=4 ?" " :"" ); +seq_printf (p,"%*s%u:" , prec -1 ,"IPI" , i);for_each_online_cpu (cpu)seq_put_decimal_ull_width (p," " ,per_cpu (irq_stat, cpu).ipi_irqs[i],10 );seq_printf (p," LoongArch %d %s\n" , i +1 , ipi_types[i]);
arch/riscv/kernel/smp.c +1 -2
@@ -226,8 +226,7 @@ void show_ipi_stats(struct seq_file *p, int prec)unsigned int cpu, i;for (i =0 ; i <IPI_MAX ; i++) { -seq_printf (p,"%*s%u:%s" , prec -1 ,"IPI" , i, - prec >=4 ?" " :"" ); +seq_printf (p,"%*s%u:" , prec -1 ,"IPI" , i);for_each_online_cpu (cpu)seq_printf (p,"%10u " ,irq_desc_kstat_cpu (ipi_desc[i], cpu));seq_printf (p," %s\n" , ipi_names[i]);
arch/sh/kernel/irq.c +1 -1
@@ -46,7 +46,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p,"%*s:" , prec,"NMI" );for_each_online_cpu (j)seq_put_decimal_ull_width (p," " ,per_cpu (irq_stat.__nmi_count, j),10 ); -seq_printf (p," Non-maskable interrupts\n" ); +seq_printf (p," Non-maskable interrupts\n" );seq_printf (p,"%*s: %10u\n" , prec,"ERR" ,atomic_read (&irq_err_count));
arch/sparc/kernel/irq_32.c +6 -6
@@ -199,19 +199,19 @@ int arch_show_interrupts(struct seq_file *p, int prec)int j;#ifdef CONFIG_SMP -seq_printf (p,"RES:" ); +seq_printf (p,"%*s:" , prec,"RES" );for_each_online_cpu (j)seq_put_decimal_ull_width (p," " ,cpu_data (j).irq_resched_count,10 ); -seq_printf (p," IPI rescheduling interrupts\n" ); -seq_printf (p,"CAL:" ); +seq_printf (p," IPI rescheduling interrupts\n" ); +seq_printf (p,"%*s:" , prec,"CAL" );for_each_online_cpu (j)seq_put_decimal_ull_width (p," " ,cpu_data (j).irq_call_count,10 ); -seq_printf (p," IPI function call interrupts\n" ); +seq_printf (p," IPI function call interrupts\n" );#endif -seq_printf (p,"NMI:" ); +seq_printf (p,"%*s:" , prec,"NMI" );for_each_online_cpu (j)seq_put_decimal_ull_width (p," " ,cpu_data (j).counter,10 ); -seq_printf (p," Non-maskable interrupts\n" ); +seq_printf (p," Non-maskable interrupts\n" );return 0 ; }
arch/sparc/kernel/irq_64.c +2 -2
@@ -303,10 +303,10 @@ int arch_show_interrupts(struct seq_file *p, int prec) {int j; -seq_printf (p,"NMI:" ); +seq_printf (p,"%*s:" , prec,"NMI" );for_each_online_cpu (j)seq_put_decimal_ull_width (p," " ,cpu_data (j).__nmi_count,10 ); -seq_printf (p," Non-maskable interrupts\n" ); +seq_printf (p," Non-maskable interrupts\n" );return 0 ; }
arch/um/kernel/irq.c +2 -2
@@ -716,12 +716,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p,"%*s: " , prec,"RES" );for_each_online_cpu (cpu)seq_printf (p,"%10u " ,irq_stats (cpu)->irq_resched_count); -seq_puts (p," Rescheduling interrupts\n" ); +seq_puts (p," Rescheduling interrupts\n" );seq_printf (p,"%*s: " , prec,"CAL" );for_each_online_cpu (cpu)seq_printf (p,"%10u " ,irq_stats (cpu)->irq_call_count); -seq_puts (p," Function call interrupts\n" ); +seq_puts (p," Function call interrupts\n" );#endif return 0 ;
arch/x86/kernel/irq.c +25 -25
79 lines not on this page · raw message
arch/xtensa/kernel/irq.c +1 -1
@@ -59,7 +59,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p,"%*s:" , prec,"NMI" );for_each_online_cpu (cpu)seq_printf (p," %10lu" ,per_cpu (nmi_count, cpu)); -seq_puts (p," Non-maskable interrupts\n" ); +seq_puts (p," Non-maskable interrupts\n" );#endif return 0 ; }
kernel/irq/debugfs.h new file +44 -0
44 lines not on this page · raw message
kernel/irq/internals.h +1 -39
@@ -12,6 +12,7 @@#include <linux/rcuref.h> #include <linux/sched/clock.h> +#include "debugfs.h" #include "proc.h" #ifdef CONFIG_SPARSE_IRQ
@@ -394,42 +395,3 @@ static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd)return NULL ;#endif } - -#ifdef CONFIG_GENERIC_IRQ_DEBUGFS -#include <linux/debugfs.h> - -struct irq_bit_descr { -unsigned int mask; -char *name; -}; - -#define BIT_MASK_DESCR (m) { .mask = m, .name = #m } - -void irq_debug_show_bits (struct seq_file *m,int ind,unsigned int state, -const struct irq_bit_descr *sd,int size); - -void irq_add_debugfs_entry (unsigned int irq,struct irq_desc *desc); -static inline void irq_remove_debugfs_entry (struct irq_desc *desc) -{ -debugfs_remove (desc->debugfs_file); -kfree (desc->dev_name); -} -void irq_debugfs_copy_devname (int irq,struct device *dev); -# ifdef CONFIG_IRQ_DOMAIN -void irq_domain_debugfs_init (struct dentry *root); -# else -static inline void irq_domain_debugfs_init (struct dentry *root) -{ -} -# endif -#else /* CONFIG_GENERIC_IRQ_DEBUGFS */ -static inline void irq_add_debugfs_entry (unsigned int irq,struct irq_desc *d) -{ -} -static inline void irq_remove_debugfs_entry (struct irq_desc *d) -{ -} -static inline void irq_debugfs_copy_devname (int irq,struct device *dev) -{ -} -#endif /* CONFIG_GENERIC_IRQ_DEBUGFS */
kernel/irq/irqdomain.c +1 -1
@@ -2084,7 +2084,7 @@ static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ #ifdef CONFIG_GENERIC_IRQ_DEBUGFS -#include "internals.h" +#include "debugfs.h" static struct dentry *domain_dir;
kernel/irq/proc.c +3 -2
@@ -465,7 +465,7 @@ static struct irq_proc_constraints {unsigned int num_prec;unsigned int chip_width; } irq_proc_constraints __read_mostly = { - .num_prec = 3, + .num_prec = 4, .chip_width = 8, };
@@ -477,7 +477,7 @@ void irq_proc_calc_prec(void) {unsigned int prec, n; -for (prec =3 , n =1000 ; prec <10 && n <= total_nr_irqs; ++prec) +for (prec =4 , n =10000 ; prec <10 && n <= total_nr_irqs; ++prec) n *=10 ;guard (raw_spinlock_irqsave)(&irq_proc_constraints_lock);
@@ -498,6 +498,7 @@ void irq_proc_update_chip(const struct irq_chip *chip)WRITE_ONCE (irq_proc_constraints.chip_width, len); } +/* Same as seq_put_decimal_ull_width(p, " ", cnt, 10) */ #define ZSTR1 " 0"#define ZSTR1_LEN (sizeof(ZSTR1) - 1)#define ZSTR16 ZSTR1 ZSTR1 ZSTR1 ZSTR1 ZSTR1 ZSTR1 ZSTR1 ZSTR1 \
kernel/irq/proc.h +4 -0
@@ -1,4 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _KERNEL_IRQ_PROC_H +#define _KERNEL_IRQ_PROC_H#if defined(CONFIG_PROC_FS ) && defined(CONFIG_GENERIC_IRQ_SHOW )void irq_proc_calc_prec (void );
@@ -7,3 +9,5 @@ void irq_proc_update_chip(const struct irq_chip *chip);static inline void irq_proc_calc_prec (void ) { }static inline void irq_proc_update_chip (const struct irq_chip *chip) { }#endif + +#endif
scripts/gdb/linux/interrupts.py +13 -17
@@ -90,6 +90,13 @@ def show_irq_desc(prec, chip_width, irq): return text +def show_irq_err_count(prec): + cnt = utils.gdb_eval_or_none("irq_err_count") + text = "" + if cnt is not None: + text += "%*s: %10u\n" % (prec, "ERR", cnt['counter']) + return text + def x86_show_irqstat(prec, pfx, idx, desc): irq_stat = gdb.parse_and_eval("&irq_stat.counts[%d]" %idx) text = "%*s: " % (prec, pfx)
@@ -124,34 +131,23 @@ def arm_common_show_interrupts(prec): if nr_ipi is None or ipi_desc is None or ipi_types is None: return text - if prec >= 4: - sep = " " - else: - sep = "" - for ipi in range(nr_ipi): - text += "%*s%u:%s" % (prec - 1, "IPI", ipi, sep) + text += "%*s%u: " % (prec - 1, "IPI", ipi) desc = ipi_desc[ipi].cast(irq_desc_type.get_type().pointer()) if desc == 0: continue for cpu in cpus.each_online_cpu(): - text += "%10u" % (cpus.per_cpu(desc['kstat_irqs'], cpu)['cnt']) - text += " %s" % (ipi_types[ipi].string()) + text += "%10u " % (cpus.per_cpu(desc['kstat_irqs'], cpu)['cnt']) + text += "%s" % (ipi_types[ipi].string()) text += "\n" return text def aarch64_show_interrupts(prec): + # Does not work for ARM64 as "ipi_desc" is not available there text = arm_common_show_interrupts(prec) text += "%*s: %10lu\n" % (prec, "ERR", gdb.parse_and_eval("irq_err_count")) return text -def show_irq_err_count(prec): - cnt = utils.gdb_eval_or_none("irq_err_count") - text = "" - if cnt is not None: - text += "%*s: %10u\n" % (prec, "ERR", cnt['counter']) - return text - def arch_show_interrupts(prec): text = "" if utils.is_target_arch("x86"):
@@ -181,8 +177,8 @@ class LxInterruptList(gdb.Command): prec = int(constr['num_prec']) chip_width = int(constr['chip_width']) else: - prec = 3 - j = 1000 + prec = 4 + j = 10000 while prec < 10 and j <= nr_irqs: prec += 1 j *= 10