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 DECLARE_EVENT_CLASS(iocost_iocg_state,
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)
32 __field(u64, hweight_active)
33 __field(u64, hweight_inuse)
37 __assign_str(devname, ioc_name(iocg->ioc));
38 __assign_str(cgroup, path);
39 __entry->now = now->now;
40 __entry->vnow = now->vnow;
41 __entry->vrate = now->vrate;
42 __entry->last_period = last_period;
43 __entry->cur_period = cur_period;
44 __entry->vtime = vtime;
45 __entry->weight = iocg->weight;
46 __entry->inuse = iocg->inuse;
47 __entry->hweight_active = iocg->hweight_active;
48 __entry->hweight_inuse = iocg->hweight_inuse;
51 TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
52 "period=%llu->%llu vtime=%llu "
53 "weight=%u/%u hweight=%llu/%llu",
54 __get_str(devname), __get_str(cgroup),
55 __entry->now, __entry->vnow, __entry->vrate,
56 __entry->last_period, __entry->cur_period,
57 __entry->vtime, __entry->inuse, __entry->weight,
58 __entry->hweight_inuse, __entry->hweight_active
62 DEFINE_EVENT(iocost_iocg_state, iocost_iocg_activate,
63 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
64 u64 last_period, u64 cur_period, u64 vtime),
66 TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
69 DEFINE_EVENT(iocost_iocg_state, iocost_iocg_idle,
70 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
71 u64 last_period, u64 cur_period, u64 vtime),
73 TP_ARGS(iocg, path, now, last_period, cur_period, vtime)
76 DECLARE_EVENT_CLASS(iocg_inuse_update,
78 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
79 u32 old_inuse, u32 new_inuse,
80 u64 old_hw_inuse, u64 new_hw_inuse),
82 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
83 old_hw_inuse, new_hw_inuse),
86 __string(devname, ioc_name(iocg->ioc))
87 __string(cgroup, path)
89 __field(u32, old_inuse)
90 __field(u32, new_inuse)
91 __field(u64, old_hweight_inuse)
92 __field(u64, new_hweight_inuse)
96 __assign_str(devname, ioc_name(iocg->ioc));
97 __assign_str(cgroup, path);
98 __entry->now = now->now;
99 __entry->old_inuse = old_inuse;
100 __entry->new_inuse = new_inuse;
101 __entry->old_hweight_inuse = old_hw_inuse;
102 __entry->new_hweight_inuse = new_hw_inuse;
105 TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
106 __get_str(devname), __get_str(cgroup), __entry->now,
107 __entry->old_inuse, __entry->new_inuse,
108 __entry->old_hweight_inuse, __entry->new_hweight_inuse
112 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
114 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
115 u32 old_inuse, u32 new_inuse,
116 u64 old_hw_inuse, u64 new_hw_inuse),
118 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
119 old_hw_inuse, new_hw_inuse)
122 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
124 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
125 u32 old_inuse, u32 new_inuse,
126 u64 old_hw_inuse, u64 new_hw_inuse),
128 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
129 old_hw_inuse, new_hw_inuse)
132 DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
134 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
135 u32 old_inuse, u32 new_inuse,
136 u64 old_hw_inuse, u64 new_hw_inuse),
138 TP_ARGS(iocg, path, now, old_inuse, new_inuse,
139 old_hw_inuse, new_hw_inuse)
142 TRACE_EVENT(iocost_ioc_vrate_adj,
144 TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
145 u32 rq_wait_pct, int nr_lagging, int nr_shortages),
147 TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
150 __string(devname, ioc_name(ioc))
151 __field(u64, old_vrate)
152 __field(u64, new_vrate)
153 __field(int, busy_level)
154 __field(u32, read_missed_ppm)
155 __field(u32, write_missed_ppm)
156 __field(u32, rq_wait_pct)
157 __field(int, nr_lagging)
158 __field(int, nr_shortages)
162 __assign_str(devname, ioc_name(ioc));
163 __entry->old_vrate = atomic64_read(&ioc->vtime_rate);;
164 __entry->new_vrate = new_vrate;
165 __entry->busy_level = ioc->busy_level;
166 __entry->read_missed_ppm = missed_ppm[READ];
167 __entry->write_missed_ppm = missed_ppm[WRITE];
168 __entry->rq_wait_pct = rq_wait_pct;
169 __entry->nr_lagging = nr_lagging;
170 __entry->nr_shortages = nr_shortages;
173 TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d",
174 __get_str(devname), __entry->old_vrate, __entry->new_vrate,
176 __entry->read_missed_ppm, __entry->write_missed_ppm,
177 __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
181 TRACE_EVENT(iocost_iocg_forgive_debt,
183 TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
184 u32 usage_pct, u64 old_debt, u64 new_debt,
185 u64 old_delay, u64 new_delay),
187 TP_ARGS(iocg, path, now, usage_pct,
188 old_debt, new_debt, old_delay, new_delay),
191 __string(devname, ioc_name(iocg->ioc))
192 __string(cgroup, path)
195 __field(u32, usage_pct)
196 __field(u64, old_debt)
197 __field(u64, new_debt)
198 __field(u64, old_delay)
199 __field(u64, new_delay)
203 __assign_str(devname, ioc_name(iocg->ioc));
204 __assign_str(cgroup, path);
205 __entry->now = now->now;
206 __entry->vnow = now->vnow;
207 __entry->usage_pct = usage_pct;
208 __entry->old_debt = old_debt;
209 __entry->new_debt = new_debt;
210 __entry->old_delay = old_delay;
211 __entry->new_delay = new_delay;
214 TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
215 __get_str(devname), __get_str(cgroup),
216 __entry->now, __entry->vnow, __entry->usage_pct,
217 __entry->old_debt, __entry->new_debt,
218 __entry->old_delay, __entry->new_delay
222 #endif /* _TRACE_BLK_IOCOST_H */
224 /* This part must be outside protection */
225 #include <trace/define_trace.h>