Skip to content

Commit dc8c4a8

Browse files
Shivnandan Kumarandersson
authored andcommitted
soc: qcom: icc-bwmon: Add tracepoints in bwmon_intr_thread
Add tracepoint for tracing the measured traffic in kbps, 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> Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com> Link: https://lore.kernel.org/r/20240708101734.1999795-1-quic_kshivnan@quicinc.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 99a7b37 commit dc8c4a8

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18855,6 +18855,7 @@ L: linux-arm-msm@vger.kernel.org
1885518855
S: Maintained
1885618856
F: Documentation/devicetree/bindings/interconnect/qcom,msm8998-bwmon.yaml
1885718857
F: drivers/soc/qcom/icc-bwmon.c
18858+
F: drivers/soc/qcom/trace_icc-bwmon.h
1885818859

1885918860
QUALCOMM IOMMU
1886018861
M: Rob Clark <robdclark@gmail.com>

drivers/soc/qcom/icc-bwmon.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/pm_opp.h>
1818
#include <linux/regmap.h>
1919
#include <linux/sizes.h>
20+
#define CREATE_TRACE_POINTS
21+
#include "trace_icc-bwmon.h"
2022

2123
/*
2224
* The BWMON samples data throughput within 'sample_ms' time. With three
@@ -645,9 +647,10 @@ static irqreturn_t bwmon_intr_thread(int irq, void *dev_id)
645647
struct icc_bwmon *bwmon = dev_id;
646648
unsigned int irq_enable = 0;
647649
struct dev_pm_opp *opp, *target_opp;
648-
unsigned int bw_kbps, up_kbps, down_kbps;
650+
unsigned int bw_kbps, up_kbps, down_kbps, meas_kbps;
649651

650652
bw_kbps = bwmon->target_kbps;
653+
meas_kbps = bwmon->target_kbps;
651654

652655
target_opp = dev_pm_opp_find_bw_ceil(bwmon->dev, &bw_kbps, 0);
653656
if (IS_ERR(target_opp) && PTR_ERR(target_opp) == -ERANGE)
@@ -679,6 +682,7 @@ static irqreturn_t bwmon_intr_thread(int irq, void *dev_id)
679682
bwmon_clear_irq(bwmon);
680683
bwmon_enable(bwmon, irq_enable);
681684

685+
trace_qcom_bwmon_update(dev_name(bwmon->dev), meas_kbps, up_kbps, down_kbps);
682686
if (bwmon->target_kbps == bwmon->current_kbps)
683687
goto out;
684688

drivers/soc/qcom/trace_icc-bwmon.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
4+
*/
5+
6+
#undef TRACE_SYSTEM
7+
#define TRACE_SYSTEM icc_bwmon
8+
9+
#if !defined(_TRACE_ICC_BWMON_H) || defined(TRACE_HEADER_MULTI_READ)
10+
#define _TRACE_ICC_BWMON_H
11+
#include <linux/tracepoint.h>
12+
13+
TRACE_EVENT(qcom_bwmon_update,
14+
TP_PROTO(const char *name,
15+
unsigned int meas_kbps, unsigned int up_kbps, unsigned int down_kbps),
16+
17+
TP_ARGS(name, meas_kbps, up_kbps, down_kbps),
18+
19+
TP_STRUCT__entry(
20+
__string(name, name)
21+
__field(unsigned int, meas_kbps)
22+
__field(unsigned int, up_kbps)
23+
__field(unsigned int, down_kbps)
24+
),
25+
26+
TP_fast_assign(
27+
__assign_str(name);
28+
__entry->meas_kbps = meas_kbps;
29+
__entry->up_kbps = up_kbps;
30+
__entry->down_kbps = down_kbps;
31+
),
32+
33+
TP_printk("name=%s meas_kbps=%u up_kbps=%u down_kbps=%u",
34+
__get_str(name),
35+
__entry->meas_kbps,
36+
__entry->up_kbps,
37+
__entry->down_kbps)
38+
);
39+
40+
#endif /* _TRACE_ICC_BWMON_H */
41+
42+
#undef TRACE_INCLUDE_PATH
43+
#define TRACE_INCLUDE_PATH ../../drivers/soc/qcom/
44+
45+
#undef TRACE_INCLUDE_FILE
46+
#define TRACE_INCLUDE_FILE trace_icc-bwmon
47+
48+
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)