^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define TRACE_SYSTEM iocost
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) struct ioc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) struct ioc_now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) struct ioc_gq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #if !defined(_TRACE_BLK_IOCOST_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _TRACE_BLK_IOCOST_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) TRACE_EVENT(iocost_iocg_activate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) u64 last_period, u64 cur_period, u64 vtime),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) TP_ARGS(iocg, path, now, last_period, cur_period, vtime),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) TP_STRUCT__entry (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) __string(devname, ioc_name(iocg->ioc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) __string(cgroup, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) __field(u64, now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __field(u64, vnow)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __field(u64, vrate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) __field(u64, last_period)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) __field(u64, cur_period)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) __field(u64, vtime)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __field(u32, weight)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __field(u32, inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __field(u64, hweight_active)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) __field(u64, hweight_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) __assign_str(devname, ioc_name(iocg->ioc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __assign_str(cgroup, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __entry->now = now->now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __entry->vnow = now->vnow;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) __entry->vrate = now->vrate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) __entry->last_period = last_period;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __entry->cur_period = cur_period;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __entry->vtime = vtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __entry->weight = iocg->weight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __entry->inuse = iocg->inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) __entry->hweight_active = iocg->hweight_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __entry->hweight_inuse = iocg->hweight_inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) TP_printk("[%s:%s] now=%llu:%llu vrate=%llu "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) "period=%llu->%llu vtime=%llu "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) "weight=%u/%u hweight=%llu/%llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __get_str(devname), __get_str(cgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __entry->now, __entry->vnow, __entry->vrate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __entry->last_period, __entry->cur_period,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) __entry->vtime, __entry->inuse, __entry->weight,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) __entry->hweight_inuse, __entry->hweight_active
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) DECLARE_EVENT_CLASS(iocg_inuse_update,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) u32 old_inuse, u32 new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) u64 old_hw_inuse, u64 new_hw_inuse),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TP_ARGS(iocg, path, now, old_inuse, new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) old_hw_inuse, new_hw_inuse),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) TP_STRUCT__entry (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) __string(devname, ioc_name(iocg->ioc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) __string(cgroup, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) __field(u64, now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __field(u32, old_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) __field(u32, new_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) __field(u64, old_hweight_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __field(u64, new_hweight_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) __assign_str(devname, ioc_name(iocg->ioc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __assign_str(cgroup, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) __entry->now = now->now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) __entry->old_inuse = old_inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) __entry->new_inuse = new_inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __entry->old_hweight_inuse = old_hw_inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) __entry->new_hweight_inuse = new_hw_inuse;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) TP_printk("[%s:%s] now=%llu inuse=%u->%u hw_inuse=%llu->%llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) __get_str(devname), __get_str(cgroup), __entry->now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) __entry->old_inuse, __entry->new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) __entry->old_hweight_inuse, __entry->new_hweight_inuse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) DEFINE_EVENT(iocg_inuse_update, iocost_inuse_shortage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) u32 old_inuse, u32 new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) u64 old_hw_inuse, u64 new_hw_inuse),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) TP_ARGS(iocg, path, now, old_inuse, new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) old_hw_inuse, new_hw_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) DEFINE_EVENT(iocg_inuse_update, iocost_inuse_transfer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) u32 old_inuse, u32 new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) u64 old_hw_inuse, u64 new_hw_inuse),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) TP_ARGS(iocg, path, now, old_inuse, new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) old_hw_inuse, new_hw_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) DEFINE_EVENT(iocg_inuse_update, iocost_inuse_adjust,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u32 old_inuse, u32 new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) u64 old_hw_inuse, u64 new_hw_inuse),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) TP_ARGS(iocg, path, now, old_inuse, new_inuse,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) old_hw_inuse, new_hw_inuse)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) TRACE_EVENT(iocost_ioc_vrate_adj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) u32 rq_wait_pct, int nr_lagging, int nr_shortages),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) TP_ARGS(ioc, new_vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) TP_STRUCT__entry (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) __string(devname, ioc_name(ioc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) __field(u64, old_vrate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) __field(u64, new_vrate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) __field(int, busy_level)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) __field(u32, read_missed_ppm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) __field(u32, write_missed_ppm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) __field(u32, rq_wait_pct)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) __field(int, nr_lagging)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) __field(int, nr_shortages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) __assign_str(devname, ioc_name(ioc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) __entry->old_vrate = atomic64_read(&ioc->vtime_rate);;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) __entry->new_vrate = new_vrate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) __entry->busy_level = ioc->busy_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) __entry->read_missed_ppm = missed_ppm[READ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) __entry->write_missed_ppm = missed_ppm[WRITE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __entry->rq_wait_pct = rq_wait_pct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) __entry->nr_lagging = nr_lagging;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) __entry->nr_shortages = nr_shortages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) TP_printk("[%s] vrate=%llu->%llu busy=%d missed_ppm=%u:%u rq_wait_pct=%u lagging=%d shortages=%d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) __get_str(devname), __entry->old_vrate, __entry->new_vrate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) __entry->busy_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) __entry->read_missed_ppm, __entry->write_missed_ppm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) __entry->rq_wait_pct, __entry->nr_lagging, __entry->nr_shortages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) TRACE_EVENT(iocost_iocg_forgive_debt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) TP_PROTO(struct ioc_gq *iocg, const char *path, struct ioc_now *now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) u32 usage_pct, u64 old_debt, u64 new_debt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) u64 old_delay, u64 new_delay),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) TP_ARGS(iocg, path, now, usage_pct,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) old_debt, new_debt, old_delay, new_delay),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) TP_STRUCT__entry (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) __string(devname, ioc_name(iocg->ioc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) __string(cgroup, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) __field(u64, now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) __field(u64, vnow)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __field(u32, usage_pct)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) __field(u64, old_debt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) __field(u64, new_debt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) __field(u64, old_delay)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) __field(u64, new_delay)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) __assign_str(devname, ioc_name(iocg->ioc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __assign_str(cgroup, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) __entry->now = now->now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __entry->vnow = now->vnow;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) __entry->usage_pct = usage_pct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __entry->old_debt = old_debt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) __entry->new_debt = new_debt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) __entry->old_delay = old_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) __entry->new_delay = new_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) TP_printk("[%s:%s] now=%llu:%llu usage=%u debt=%llu->%llu delay=%llu->%llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) __get_str(devname), __get_str(cgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) __entry->now, __entry->vnow, __entry->usage_pct,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) __entry->old_debt, __entry->new_debt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) __entry->old_delay, __entry->new_delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) #endif /* _TRACE_BLK_IOCOST_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) #include <trace/define_trace.h>