diff mbox series

[v2,05/10] MIPS: smp: Implement IPI stats

Message ID 20240705-b4-mips-ipi-improvements-v2-5-2d50b56268e8@flygoat.com (mailing list archive)
State New
Headers show
Series MIPS: IPI Improvements | expand

Commit Message

Jiaxun Yang July 5, 2024, 2:16 p.m. UTC
Show IPI statistics in arch_show_interrupts to help users
analysis IPI performance.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/include/asm/ipi.h |  9 +++++++++
 arch/mips/kernel/irq.c      |  4 ++++
 arch/mips/kernel/smp.c      | 13 +++++++++++++
 3 files changed, 26 insertions(+)

Comments

kernel test robot July 6, 2024, 9:46 p.m. UTC | #1
Hi Jiaxun,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0b58e108042b0ed28a71cd7edf5175999955b233]

url:    https://github.com/intel-lab-lkp/linux/commits/Jiaxun-Yang/MIPS-smp-Make-IPI-interrupts-scalable/20240706-040839
base:   0b58e108042b0ed28a71cd7edf5175999955b233
patch link:    https://lore.kernel.org/r/20240705-b4-mips-ipi-improvements-v2-5-2d50b56268e8%40flygoat.com
patch subject: [PATCH v2 05/10] MIPS: smp: Implement IPI stats
config: mips-rb532_defconfig (https://download.01.org/0day-ci/archive/20240707/202407070535.1mCAxzdO-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project a0c6b8aef853eedaa0980f07c0a502a5a8a9740e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240707/202407070535.1mCAxzdO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407070535.1mCAxzdO-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/mips/kernel/irq.c:17:
   In file included from include/linux/mm.h:2229:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from arch/mips/kernel/irq.c:29:
>> arch/mips/include/asm/ipi.h:54:6: warning: no previous prototype for function 'mips_smp_ipi_set_virq_range' [-Wmissing-prototypes]
      54 | void mips_smp_ipi_set_virq_range(int virq, int nr)
         |      ^
   arch/mips/include/asm/ipi.h:54:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
      54 | void mips_smp_ipi_set_virq_range(int virq, int nr)
         | ^
         | static 
>> arch/mips/include/asm/ipi.h:58:6: warning: no previous prototype for function 'mips_smp_ipi_set_irqdomain' [-Wmissing-prototypes]
      58 | void mips_smp_ipi_set_irqdomain(struct irq_domain *d)
         |      ^
   arch/mips/include/asm/ipi.h:58:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
      58 | void mips_smp_ipi_set_irqdomain(struct irq_domain *d)
         | ^
         | static 
   3 warnings generated.


vim +/mips_smp_ipi_set_virq_range +54 arch/mips/include/asm/ipi.h

42d789a89e6b90 Jiaxun Yang 2024-07-05  48  
42d789a89e6b90 Jiaxun Yang 2024-07-05  49  static inline void mips_smp_show_ipi_stats(struct seq_file *p, int prec)
42d789a89e6b90 Jiaxun Yang 2024-07-05  50  {
42d789a89e6b90 Jiaxun Yang 2024-07-05  51  }
b7a65e07e35cdf Jiaxun Yang 2024-07-05  52  #endif /* CONFIG_GENERIC_IRQ_IPI */
877ae81debcbb0 Jiaxun Yang 2024-07-05  53  #else
877ae81debcbb0 Jiaxun Yang 2024-07-05 @54  void mips_smp_ipi_set_virq_range(int virq, int nr)
877ae81debcbb0 Jiaxun Yang 2024-07-05  55  {
877ae81debcbb0 Jiaxun Yang 2024-07-05  56  }
877ae81debcbb0 Jiaxun Yang 2024-07-05  57  
877ae81debcbb0 Jiaxun Yang 2024-07-05 @58  void mips_smp_ipi_set_irqdomain(struct irq_domain *d)
877ae81debcbb0 Jiaxun Yang 2024-07-05  59  {
877ae81debcbb0 Jiaxun Yang 2024-07-05  60  }
877ae81debcbb0 Jiaxun Yang 2024-07-05  61
kernel test robot July 6, 2024, 9:46 p.m. UTC | #2
Hi Jiaxun,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0b58e108042b0ed28a71cd7edf5175999955b233]

url:    https://github.com/intel-lab-lkp/linux/commits/Jiaxun-Yang/MIPS-smp-Make-IPI-interrupts-scalable/20240706-040839
base:   0b58e108042b0ed28a71cd7edf5175999955b233
patch link:    https://lore.kernel.org/r/20240705-b4-mips-ipi-improvements-v2-5-2d50b56268e8%40flygoat.com
patch subject: [PATCH v2 05/10] MIPS: smp: Implement IPI stats
config: mips-allnoconfig (https://download.01.org/0day-ci/archive/20240707/202407070524.LKSlICvH-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240707/202407070524.LKSlICvH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407070524.LKSlICvH-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/mips/kernel/irq.c:29:
>> arch/mips/include/asm/ipi.h:54:6: warning: no previous prototype for 'mips_smp_ipi_set_virq_range' [-Wmissing-prototypes]
      54 | void mips_smp_ipi_set_virq_range(int virq, int nr)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/mips/include/asm/ipi.h:58:6: warning: no previous prototype for 'mips_smp_ipi_set_irqdomain' [-Wmissing-prototypes]
      58 | void mips_smp_ipi_set_irqdomain(struct irq_domain *d)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/mips_smp_ipi_set_virq_range +54 arch/mips/include/asm/ipi.h

42d789a89e6b90 Jiaxun Yang 2024-07-05  48  
42d789a89e6b90 Jiaxun Yang 2024-07-05  49  static inline void mips_smp_show_ipi_stats(struct seq_file *p, int prec)
42d789a89e6b90 Jiaxun Yang 2024-07-05  50  {
42d789a89e6b90 Jiaxun Yang 2024-07-05  51  }
b7a65e07e35cdf Jiaxun Yang 2024-07-05  52  #endif /* CONFIG_GENERIC_IRQ_IPI */
877ae81debcbb0 Jiaxun Yang 2024-07-05  53  #else
877ae81debcbb0 Jiaxun Yang 2024-07-05 @54  void mips_smp_ipi_set_virq_range(int virq, int nr)
877ae81debcbb0 Jiaxun Yang 2024-07-05  55  {
877ae81debcbb0 Jiaxun Yang 2024-07-05  56  }
877ae81debcbb0 Jiaxun Yang 2024-07-05  57  
877ae81debcbb0 Jiaxun Yang 2024-07-05 @58  void mips_smp_ipi_set_irqdomain(struct irq_domain *d)
877ae81debcbb0 Jiaxun Yang 2024-07-05  59  {
877ae81debcbb0 Jiaxun Yang 2024-07-05  60  }
877ae81debcbb0 Jiaxun Yang 2024-07-05  61
diff mbox series

Patch

diff --git a/arch/mips/include/asm/ipi.h b/arch/mips/include/asm/ipi.h
index 0fc8c31c6a52..96c6e76d72c9 100644
--- a/arch/mips/include/asm/ipi.h
+++ b/arch/mips/include/asm/ipi.h
@@ -36,6 +36,7 @@  void mips_smp_ipi_disable(void);
 extern bool mips_smp_ipi_have_virq_range(void);
 void mips_smp_ipi_set_irqdomain(struct irq_domain *d);
 extern void mips_smp_ipi_set_virq_range(int virq, int nr);
+extern void mips_smp_show_ipi_stats(struct seq_file *p, int prec);
 #else
 static inline void mips_smp_ipi_enable(void)
 {
@@ -44,6 +45,10 @@  static inline void mips_smp_ipi_enable(void)
 static inline void mips_smp_ipi_disable(void)
 {
 }
+
+static inline void mips_smp_show_ipi_stats(struct seq_file *p, int prec)
+{
+}
 #endif /* CONFIG_GENERIC_IRQ_IPI */
 #else
 void mips_smp_ipi_set_virq_range(int virq, int nr)
@@ -58,5 +63,9 @@  static inline bool mips_smp_ipi_have_virq_range(void)
 {
 	return false;
 }
+
+static inline void mips_smp_show_ipi_stats(struct seq_file *p, int prec)
+{
+}
 #endif /* CONFIG_SMP */
 #endif
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 5e11582fe308..c3ea8d80e0cb 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -26,6 +26,8 @@ 
 #include <linux/atomic.h>
 #include <linux/uaccess.h>
 
+#include <asm/ipi.h>
+
 void *irq_stack[NR_CPUS];
 
 /*
@@ -42,6 +44,8 @@  atomic_t irq_err_count;
 int arch_show_interrupts(struct seq_file *p, int prec)
 {
 	seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
+	mips_smp_show_ipi_stats(p, prec);
+
 	return 0;
 }
 
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index f29259d16a37..49be86e15b49 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -243,6 +243,19 @@  void mips_smp_ipi_disable(void)
 		disable_percpu_irq(ipi_virqs[i]);
 }
 
+void mips_smp_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 ? " " : "");
+		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]);
+	}
+}
+
 static void smp_ipi_init_one(unsigned int virq, const char *name,
 			     irq_handler_t handler)
 {