diff mbox series

soc: qcom: icc-bwmon: Add tracepoints in bwmon_intr_thread

Message ID 20240531105404.879267-1-quic_kshivnan@quicinc.com (mailing list archive)
State Superseded
Headers show
Series soc: qcom: icc-bwmon: Add tracepoints in bwmon_intr_thread | expand

Commit Message

Shivnandan Kumar May 31, 2024, 10:54 a.m. UTC
Add tracepoint for tracing the measured traffic, up_kbps
and down_kbps in bwmon. This information is valuable for
understanding what bwmon hw measures at the system cache
level and at the DDR level which is helpful in debugging
bwmon behavior.

Signed-off-by: Shivnandan Kumar <quic_kshivnan@quicinc.com>
---
 MAINTAINERS                        |  1 +
 drivers/soc/qcom/icc-bwmon.c       |  4 ++-
 drivers/soc/qcom/trace_icc-bwmon.h | 49 ++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/qcom/trace_icc-bwmon.h

--
2.25.1

Comments

kernel test robot May 31, 2024, 8:29 p.m. UTC | #1
Hi Shivnandan,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.10-rc1 next-20240531]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shivnandan-Kumar/soc-qcom-icc-bwmon-Add-tracepoints-in-bwmon_intr_thread/20240531-185658
base:   linus/master
patch link:    https://lore.kernel.org/r/20240531105404.879267-1-quic_kshivnan%40quicinc.com
patch subject: [PATCH] soc: qcom: icc-bwmon: Add tracepoints in bwmon_intr_thread
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240601/202406010409.xiR31FVt-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240601/202406010409.xiR31FVt-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/202406010409.xiR31FVt-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/trace/trace_events.h:419,
                    from include/trace/define_trace.h:102,
                    from drivers/soc/qcom/trace_icc-bwmon.h:49,
                    from drivers/soc/qcom/icc-bwmon.c:21:
>> include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:39:1: error: macro "__assign_str" passed 2 arguments, but takes just 1
      39 | );
         | ^~             
   In file included from include/trace/trace_events.h:375:
   include/trace/stages/stage6_event_callback.h:34: note: macro "__assign_str" defined here
      34 | #define __assign_str(dst)                                               \
         | 
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h: In function 'trace_event_raw_event_qcom_bwmon_update':
>> include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:28:17: error: '__assign_str' undeclared (first use in this function)
      28 |                 __assign_str(name, name);
         |                 ^~~~~~~~~~~~
   include/trace/trace_events.h:402:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
     402 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:13:1: note: in expansion of macro 'TRACE_EVENT'
      13 | TRACE_EVENT(qcom_bwmon_update,
         | ^~~~~~~~~~~
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:27:9: note: in expansion of macro 'TP_fast_assign'
      27 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:28:17: note: each undeclared identifier is reported only once for each function it appears in
      28 |                 __assign_str(name, name);
         |                 ^~~~~~~~~~~~
   include/trace/trace_events.h:402:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
     402 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:13:1: note: in expansion of macro 'TRACE_EVENT'
      13 | TRACE_EVENT(qcom_bwmon_update,
         | ^~~~~~~~~~~
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:27:9: note: in expansion of macro 'TP_fast_assign'
      27 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   In file included from include/trace/trace_events.h:469:
   include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h: At top level:
>> include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h:39:1: error: macro "__assign_str" passed 2 arguments, but takes just 1
      39 | );
         | ^~             
   include/trace/stages/stage6_event_callback.h:34: note: macro "__assign_str" defined here
      34 | #define __assign_str(dst)                                               \
         | 


vim +/__assign_str +39 include/trace/../../drivers/soc/qcom//trace_icc-bwmon.h

    14	
    15		TP_PROTO(const char *name,
    16			 unsigned int meas_kbps, unsigned int up_kbps, unsigned int down_kbps),
    17	
    18		TP_ARGS(name, meas_kbps, up_kbps, down_kbps),
    19	
    20		TP_STRUCT__entry(
    21			__string(name, name)
    22			__field(unsigned int, meas_kbps)
    23			__field(unsigned int, up_kbps)
    24			__field(unsigned int, down_kbps)
    25		),
    26	
    27		TP_fast_assign(
  > 28			__assign_str(name, name);
    29			__entry->meas_kbps = meas_kbps;
    30			__entry->up_kbps = up_kbps;
    31			__entry->down_kbps = down_kbps;
    32		),
    33	
    34		TP_printk("name=%s meas_kbps=%u up_kbps=%u down_kbps=%u",
    35			__get_str(name),
    36			__entry->meas_kbps,
    37			__entry->up_kbps,
    38			__entry->down_kbps)
  > 39	);
    40
kernel test robot June 1, 2024, 1:28 a.m. UTC | #2
Hi Shivnandan,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.10-rc1 next-20240531]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shivnandan-Kumar/soc-qcom-icc-bwmon-Add-tracepoints-in-bwmon_intr_thread/20240531-185658
base:   linus/master
patch link:    https://lore.kernel.org/r/20240531105404.879267-1-quic_kshivnan%40quicinc.com
patch subject: [PATCH] soc: qcom: icc-bwmon: Add tracepoints in bwmon_intr_thread
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240601/202406010720.b2TIAmY8-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project bafda89a0944d947fc4b3b5663185e07a397ac30)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240601/202406010720.b2TIAmY8-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/202406010720.b2TIAmY8-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/soc/qcom/icc-bwmon.c:11:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from drivers/soc/qcom/icc-bwmon.c:11:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from drivers/soc/qcom/icc-bwmon.c:11:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   In file included from drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:21:
   In file included from include/linux/trace_events.h:6:
   In file included from include/linux/ring_buffer.h:5:
   In file included from include/linux/mm.h:2253:
   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 drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:419:
>> drivers/soc/qcom/trace_icc-bwmon.h:28:22: error: too many arguments provided to function-like macro invocation
      28 |                 __assign_str(name, name);
         |                                    ^
   include/trace/stages/stage6_event_callback.h:34:9: note: macro '__assign_str' defined here
      34 | #define __assign_str(dst)                                               \
         |         ^
   In file included from drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:419:
>> drivers/soc/qcom/trace_icc-bwmon.h:28:3: error: use of undeclared identifier '__assign_str'
      28 |                 __assign_str(name, name);
         |                 ^
   In file included from drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:469:
>> drivers/soc/qcom/trace_icc-bwmon.h:28:22: error: too many arguments provided to function-like macro invocation
      28 |                 __assign_str(name, name);
         |                                    ^
   include/trace/stages/stage6_event_callback.h:34:9: note: macro '__assign_str' defined here
      34 | #define __assign_str(dst)                                               \
         |         ^
   In file included from drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:103:
   In file included from include/trace/perf.h:75:
>> drivers/soc/qcom/trace_icc-bwmon.h:28:22: error: too many arguments provided to function-like macro invocation
      28 |                 __assign_str(name, name);
         |                                    ^
   include/trace/stages/stage6_event_callback.h:34:9: note: macro '__assign_str' defined here
      34 | #define __assign_str(dst)                                               \
         |         ^
   In file included from drivers/soc/qcom/icc-bwmon.c:21:
   In file included from drivers/soc/qcom/trace_icc-bwmon.h:49:
   In file included from include/trace/define_trace.h:103:
   In file included from include/trace/perf.h:75:
>> drivers/soc/qcom/trace_icc-bwmon.h:28:3: error: use of undeclared identifier '__assign_str'
      28 |                 __assign_str(name, name);
         |                 ^
   7 warnings and 5 errors generated.


vim +28 drivers/soc/qcom/trace_icc-bwmon.h

    14	
    15		TP_PROTO(const char *name,
    16			 unsigned int meas_kbps, unsigned int up_kbps, unsigned int down_kbps),
    17	
    18		TP_ARGS(name, meas_kbps, up_kbps, down_kbps),
    19	
    20		TP_STRUCT__entry(
    21			__string(name, name)
    22			__field(unsigned int, meas_kbps)
    23			__field(unsigned int, up_kbps)
    24			__field(unsigned int, down_kbps)
    25		),
    26	
    27		TP_fast_assign(
  > 28			__assign_str(name, name);
    29			__entry->meas_kbps = meas_kbps;
    30			__entry->up_kbps = up_kbps;
    31			__entry->down_kbps = down_kbps;
    32		),
    33	
    34		TP_printk("name=%s meas_kbps=%u up_kbps=%u down_kbps=%u",
    35			__get_str(name),
    36			__entry->meas_kbps,
    37			__entry->up_kbps,
    38			__entry->down_kbps)
    39	);
    40
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 9ed4d3868539..dc864e3870b1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18135,6 +18135,7 @@  M:	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
 L:	linux-arm-msm@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/interconnect/qcom,msm8998-bwmon.yaml
+F:	drivers/soc/qcom/trace_icc-bwmon.h
 F:	drivers/soc/qcom/icc-bwmon.c

 QUALCOMM IOMMU
diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
index 656706259353..dedf0070654b 100644
--- a/drivers/soc/qcom/icc-bwmon.c
+++ b/drivers/soc/qcom/icc-bwmon.c
@@ -17,6 +17,8 @@ 
 #include <linux/pm_opp.h>
 #include <linux/regmap.h>
 #include <linux/sizes.h>
+#define CREATE_TRACE_POINTS
+#include "trace_icc-bwmon.h"

 /*
  * The BWMON samples data throughput within 'sample_ms' time. With three
@@ -681,7 +683,7 @@  static irqreturn_t bwmon_intr_thread(int irq, void *dev_id)

 	if (bwmon->target_kbps == bwmon->current_kbps)
 		goto out;
-
+	trace_qcom_bwmon_update(dev_name(bwmon->dev), bw_kbps, up_kbps, down_kbps);
 	dev_pm_opp_set_opp(bwmon->dev, target_opp);
 	bwmon->current_kbps = bwmon->target_kbps;

diff --git a/drivers/soc/qcom/trace_icc-bwmon.h b/drivers/soc/qcom/trace_icc-bwmon.h
new file mode 100644
index 000000000000..977e46ade4b8
--- /dev/null
+++ b/drivers/soc/qcom/trace_icc-bwmon.h
@@ -0,0 +1,49 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM icc_bwmon
+
+#if !defined(_TRACE_ICC_BWMON_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_ICC_BWMON_H
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(qcom_bwmon_update,
+
+	TP_PROTO(const char *name,
+		 unsigned int meas_kbps, unsigned int up_kbps, unsigned int down_kbps),
+
+	TP_ARGS(name, meas_kbps, up_kbps, down_kbps),
+
+	TP_STRUCT__entry(
+		__string(name, name)
+		__field(unsigned int, meas_kbps)
+		__field(unsigned int, up_kbps)
+		__field(unsigned int, down_kbps)
+	),
+
+	TP_fast_assign(
+		__assign_str(name, name);
+		__entry->meas_kbps = meas_kbps;
+		__entry->up_kbps = up_kbps;
+		__entry->down_kbps = down_kbps;
+	),
+
+	TP_printk("name=%s meas_kbps=%u up_kbps=%u down_kbps=%u",
+		__get_str(name),
+		__entry->meas_kbps,
+		__entry->up_kbps,
+		__entry->down_kbps)
+);
+
+#endif /* _TRACE_ICC_BWMON_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH ../../drivers/soc/qcom/
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace_icc-bwmon
+
+#include <trace/define_trace.h>