Skip to content

Commit c46ab9d

Browse files
author
Georgi Djakov
committed
interconnect: Add basic tracepoints
The tracepoints can help with understanding the system behavior of a given interconnect path when the consumer drivers change their bandwidth demands. This might be interesting when we want to monitor the requested interconnect bandwidth for each client driver. The paths may share the same nodes and this will help to understand "who and when is requesting what". All this is useful for subsystem drivers developers and may also provide hints when optimizing the power and performance profile of the system. Reviewed-by: Steven Rostedt (VMware) <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Georgi Djakov <[email protected]>
1 parent 0530983 commit c46ab9d

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

drivers/interconnect/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3+
CFLAGS_core.o := -I$(src)
34
icc-core-objs := core.o
45

56
obj-$(CONFIG_INTERCONNECT) += icc-core.o

drivers/interconnect/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
#include "internal.h"
2323

24+
#define CREATE_TRACE_POINTS
25+
#include "trace.h"
26+
2427
static DEFINE_IDR(icc_idr);
2528
static LIST_HEAD(icc_providers);
2629
static DEFINE_MUTEX(icc_lock);
@@ -435,6 +438,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
435438

436439
/* aggregate requests for this node */
437440
aggregate_requests(node);
441+
442+
trace_icc_set_bw(path, node, i, avg_bw, peak_bw);
438443
}
439444

440445
ret = apply_constraints(path);
@@ -453,6 +458,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
453458

454459
mutex_unlock(&icc_lock);
455460

461+
trace_icc_set_bw_end(path, ret);
462+
456463
return ret;
457464
}
458465
EXPORT_SYMBOL_GPL(icc_set_bw);

drivers/interconnect/trace.h

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Interconnect framework tracepoints
4+
* Copyright (c) 2019, Linaro Ltd.
5+
* Author: Georgi Djakov <[email protected]>
6+
*/
7+
8+
#undef TRACE_SYSTEM
9+
#define TRACE_SYSTEM interconnect
10+
11+
#if !defined(_TRACE_INTERCONNECT_H) || defined(TRACE_HEADER_MULTI_READ)
12+
#define _TRACE_INTERCONNECT_H
13+
14+
#include <linux/interconnect.h>
15+
#include <linux/tracepoint.h>
16+
17+
TRACE_EVENT(icc_set_bw,
18+
19+
TP_PROTO(struct icc_path *p, struct icc_node *n, int i,
20+
u32 avg_bw, u32 peak_bw),
21+
22+
TP_ARGS(p, n, i, avg_bw, peak_bw),
23+
24+
TP_STRUCT__entry(
25+
__string(path_name, p->name)
26+
__string(dev, dev_name(p->reqs[i].dev))
27+
__string(node_name, n->name)
28+
__field(u32, avg_bw)
29+
__field(u32, peak_bw)
30+
__field(u32, node_avg_bw)
31+
__field(u32, node_peak_bw)
32+
),
33+
34+
TP_fast_assign(
35+
__assign_str(path_name, p->name);
36+
__assign_str(dev, dev_name(p->reqs[i].dev));
37+
__assign_str(node_name, n->name);
38+
__entry->avg_bw = avg_bw;
39+
__entry->peak_bw = peak_bw;
40+
__entry->node_avg_bw = n->avg_bw;
41+
__entry->node_peak_bw = n->peak_bw;
42+
),
43+
44+
TP_printk("path=%s dev=%s node=%s avg_bw=%u peak_bw=%u agg_avg=%u agg_peak=%u",
45+
__get_str(path_name),
46+
__get_str(dev),
47+
__get_str(node_name),
48+
__entry->avg_bw,
49+
__entry->peak_bw,
50+
__entry->node_avg_bw,
51+
__entry->node_peak_bw)
52+
);
53+
54+
TRACE_EVENT(icc_set_bw_end,
55+
56+
TP_PROTO(struct icc_path *p, int ret),
57+
58+
TP_ARGS(p, ret),
59+
60+
TP_STRUCT__entry(
61+
__string(path_name, p->name)
62+
__string(dev, dev_name(p->reqs[0].dev))
63+
__field(int, ret)
64+
),
65+
66+
TP_fast_assign(
67+
__assign_str(path_name, p->name);
68+
__assign_str(dev, dev_name(p->reqs[0].dev));
69+
__entry->ret = ret;
70+
),
71+
72+
TP_printk("path=%s dev=%s ret=%d",
73+
__get_str(path_name),
74+
__get_str(dev),
75+
__entry->ret)
76+
);
77+
78+
#endif /* _TRACE_INTERCONNECT_H */
79+
80+
/* This part must be outside protection */
81+
82+
#undef TRACE_INCLUDE_PATH
83+
#define TRACE_INCLUDE_PATH .
84+
85+
#undef TRACE_INCLUDE_FILE
86+
#define TRACE_INCLUDE_FILE trace
87+
88+
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)