1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM iocost
9 #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_BLK_IOCOST_H
12 #include <linux/tracepoint.h>
14 TRACE_EVENT(iocost_iocg_activate
,
16 TP_PROTO(struct ioc_gq
*iocg
, const char *path
, struct ioc_now
*now
,
17 u64 last_period
, u64 cur_period
, u64 vtime
),
19 TP_ARGS(iocg
, path
, now
, last_period
, cur_period
, vtime
),
22 __string(devname
, ioc_name(iocg
->ioc
))
23 __string(cgroup
, path
)
27 __field(u64
, last_period
)
28 __field(u64
, cur_period
)
29 __field(u64
, last_vtime
)
33 __field(u64
, hweight_active
)
34 __field(u64
, hweight_inuse
)
38 __assign_str(devname
, ioc_name(iocg
->ioc
));
39 __assign_str(cgroup
, path
);
40 __entry
->now
= now
->now
;
41 __entry
->vnow
= now
->vnow
;
42 __entry
->vrate
= now
->vrate
;
43 __entry
->last_period
= last_period
;
44 __entry
->cur_period
= cur_period
;
45 __entry
->last_vtime
= iocg
->last_vtime
;
46 __entry
->vtime
= vtime
;
47 __entry
->weight
= iocg
->weight
;
48 __entry
->inuse
= iocg
->inuse
;
49 __entry
->hweight_active
= iocg
->hweight_active
;
50 __entry
->hweight_inuse
= iocg
->hweight_inuse
;
53 TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
54 "period=%llu->%llu vtime=%llu->%llu "
55 "weight=%u/%u hweight=%llu/%llu",
56 __get_str(devname
), __get_str(cgroup
),
57 __entry
->now
, __entry
->vnow
, __entry
->vrate
,
58 __entry
->last_period
, __entry
->cur_period
,
59 __entry
->last_vtime
, __entry
->vtime
,
60 __entry
->inuse
, __entry
->weight
,
61 __entry
->hweight_inuse
, __entry
->hweight_active
65 DECLARE_EVENT_CLASS(iocg_inuse_update
,
67 TP_PROTO(struct ioc_gq
*iocg
, const char *path
, struct ioc_now
*now
,
68 u32 old_inuse
, u32 new_inuse
,
69 u64 old_hw_inuse
, u64 new_hw_inuse
),
71 TP_ARGS(iocg
, path
, now
, old_inuse
, new_inuse
,
72 old_hw_inuse
, new_hw_inuse
),
75 __string(devname
, ioc_name(iocg
->ioc
))
76 __string(cgroup
, path
)
78 __field(u32
, old_inuse
)
79 __field(u32
, new_inuse
)
80 __field(u64
, old_hweight_inuse
)
81 __field(u64
, new_hweight_inuse
)
85 __assign_str(devname
, ioc_name(iocg
->ioc
));
86 __assign_str(cgroup
, path
);
87 __entry
->now
= now
->now
;
88 __entry
->old_inuse
= old_inuse
;
89 __entry
->new_inuse
= new_inuse
;
90 __entry
->old_hweight_inuse
= old_hw_inuse
;
91 __entry
->new_hweight_inuse
= new_hw_inuse
;
94 TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
95 __get_str(devname
), __get_str(cgroup
), __entry
->now
,
96 __entry
->old_inuse
, __entry
->new_inuse
,
97 __entry
->old_hweight_inuse
, __entry
->new_hweight_inuse
101 DEFINE_EVENT(iocg_inuse_update
, iocost_inuse_takeback
,
103 TP_PROTO(struct ioc_gq
*iocg
, const char *path
, struct ioc_now
*now
,
104 u32 old_inuse
, u32 new_inuse
,
105 u64 old_hw_inuse
, u64 new_hw_inuse
),
107 TP_ARGS(iocg
, path
, now
, old_inuse
, new_inuse
,
108 old_hw_inuse
, new_hw_inuse
)
111 DEFINE_EVENT(iocg_inuse_update
, iocost_inuse_giveaway
,
113 TP_PROTO(struct ioc_gq
*iocg
, const char *path
, struct ioc_now
*now
,
114 u32 old_inuse
, u32 new_inuse
,
115 u64 old_hw_inuse
, u64 new_hw_inuse
),
117 TP_ARGS(iocg
, path
, now
, old_inuse
, new_inuse
,
118 old_hw_inuse
, new_hw_inuse
)
121 DEFINE_EVENT(iocg_inuse_update
, iocost_inuse_reset
,
123 TP_PROTO(struct ioc_gq
*iocg
, const char *path
, struct ioc_now
*now
,
124 u32 old_inuse
, u32 new_inuse
,
125 u64 old_hw_inuse
, u64 new_hw_inuse
),
127 TP_ARGS(iocg
, path
, now
, old_inuse
, new_inuse
,
128 old_hw_inuse
, new_hw_inuse
)
131 TRACE_EVENT(iocost_ioc_vrate_adj
,
133 TP_PROTO(struct ioc
*ioc
, u64 new_vrate
, u32
*missed_ppm
,
134 u32 rq_wait_pct
, int nr_lagging
, int nr_shortages
,
137 TP_ARGS(ioc
, new_vrate
, missed_ppm
, rq_wait_pct
, nr_lagging
, nr_shortages
,
141 __string(devname
, ioc_name(ioc
))
142 __field(u64
, old_vrate
)
143 __field(u64
, new_vrate
)
144 __field(int, busy_level
)
145 __field(u32
, read_missed_ppm
)
146 __field(u32
, write_missed_ppm
)
147 __field(u32
, rq_wait_pct
)
148 __field(int, nr_lagging
)
149 __field(int, nr_shortages
)
150 __field(int, nr_surpluses
)
154 __assign_str(devname
, ioc_name(ioc
));
155 __entry
->old_vrate
= atomic64_read(&ioc
->vtime_rate
);;
156 __entry
->new_vrate
= new_vrate
;
157 __entry
->busy_level
= ioc
->busy_level
;
158 __entry
->read_missed_ppm
= missed_ppm
[READ
];
159 __entry
->write_missed_ppm
= missed_ppm
[WRITE
];
160 __entry
->rq_wait_pct
= rq_wait_pct
;
161 __entry
->nr_lagging
= nr_lagging
;
162 __entry
->nr_shortages
= nr_shortages
;
163 __entry
->nr_surpluses
= nr_surpluses
;
166 TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d surpluses=%d",
167 __get_str(devname
), __entry
->old_vrate
, __entry
->new_vrate
,
169 __entry
->read_missed_ppm
, __entry
->write_missed_ppm
,
170 __entry
->rq_wait_pct
, __entry
->nr_lagging
, __entry
->nr_shortages
,
171 __entry
->nr_surpluses
175 #endif /* _TRACE_BLK_IOCOST_H */
177 /* This part must be outside protection */
178 #include <trace/define_trace.h>