^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 cgroup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_CGROUP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/cgroup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) DECLARE_EVENT_CLASS(cgroup_root,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) TP_PROTO(struct cgroup_root *root),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) TP_ARGS(root),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) __field( int, root )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) __field( u16, ss_mask )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) __string( name, root->name )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) __entry->root = root->hierarchy_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __entry->ss_mask = root->subsys_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __assign_str(name, root->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) TP_printk("root=%d ss_mask=%#x name=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __entry->root, __entry->ss_mask, __get_str(name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) DEFINE_EVENT(cgroup_root, cgroup_setup_root,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) TP_PROTO(struct cgroup_root *root),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) TP_ARGS(root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) DEFINE_EVENT(cgroup_root, cgroup_destroy_root,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) TP_PROTO(struct cgroup_root *root),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) TP_ARGS(root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) DEFINE_EVENT(cgroup_root, cgroup_remount,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) TP_PROTO(struct cgroup_root *root),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) TP_ARGS(root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DECLARE_EVENT_CLASS(cgroup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) TP_ARGS(cgrp, path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __field( int, root )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) __field( int, level )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) __field( u64, id )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) __string( path, path )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) __entry->root = cgrp->root->hierarchy_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) __entry->id = cgroup_id(cgrp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) __entry->level = cgrp->level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) __assign_str(path, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) TP_printk("root=%d id=%llu level=%d path=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __entry->root, __entry->id, __entry->level, __get_str(path))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) DEFINE_EVENT(cgroup, cgroup_mkdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) DEFINE_EVENT(cgroup, cgroup_rmdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) DEFINE_EVENT(cgroup, cgroup_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) DEFINE_EVENT(cgroup, cgroup_rename,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) DEFINE_EVENT(cgroup, cgroup_freeze,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) DEFINE_EVENT(cgroup, cgroup_unfreeze,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) TP_PROTO(struct cgroup *cgrp, const char *path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) TP_ARGS(cgrp, path)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) DECLARE_EVENT_CLASS(cgroup_migrate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) TP_PROTO(struct cgroup *dst_cgrp, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct task_struct *task, bool threadgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) TP_ARGS(dst_cgrp, path, task, threadgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) __field( int, dst_root )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __field( int, dst_level )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) __field( u64, dst_id )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __field( int, pid )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) __string( dst_path, path )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) __string( comm, task->comm )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) __entry->dst_root = dst_cgrp->root->hierarchy_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) __entry->dst_id = cgroup_id(dst_cgrp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) __entry->dst_level = dst_cgrp->level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) __assign_str(dst_path, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) __entry->pid = task->pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) __assign_str(comm, task->comm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) TP_printk("dst_root=%d dst_id=%llu dst_level=%d dst_path=%s pid=%d comm=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __entry->dst_root, __entry->dst_id, __entry->dst_level,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) __get_str(dst_path), __entry->pid, __get_str(comm))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) TP_PROTO(struct cgroup *dst_cgrp, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct task_struct *task, bool threadgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) TP_ARGS(dst_cgrp, path, task, threadgroup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) TP_PROTO(struct cgroup *dst_cgrp, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct task_struct *task, bool threadgroup),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) TP_ARGS(dst_cgrp, path, task, threadgroup)
^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) DECLARE_EVENT_CLASS(cgroup_event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) TP_PROTO(struct cgroup *cgrp, const char *path, int val),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) TP_ARGS(cgrp, path, val),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) __field( int, root )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) __field( int, level )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) __field( u64, id )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) __string( path, path )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) __field( int, val )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __entry->root = cgrp->root->hierarchy_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) __entry->id = cgroup_id(cgrp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) __entry->level = cgrp->level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) __assign_str(path, path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) __entry->val = val;
^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_printk("root=%d id=%llu level=%d path=%s val=%d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) __entry->root, __entry->id, __entry->level, __get_str(path),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __entry->val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) DEFINE_EVENT(cgroup_event, cgroup_notify_populated,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) TP_PROTO(struct cgroup *cgrp, const char *path, int val),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) TP_ARGS(cgrp, path, val)
^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) DEFINE_EVENT(cgroup_event, cgroup_notify_frozen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) TP_PROTO(struct cgroup *cgrp, const char *path, int val),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) TP_ARGS(cgrp, path, val)
^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) #endif /* _TRACE_CGROUP_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #include <trace/define_trace.h>