1/* SPDX-License-Identifier: GPL-2.0 */ 2#undef TRACE_SYSTEM 3#define TRACE_SYSTEM sched 4 5#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ) 6#define _TRACE_SCHED_H 7 8#include <linux/kthread.h> 9#include <linux/sched/numa_balancing.h> 10#include <linux/sched/clock.h> 11#include <linux/tracepoint.h> 12#include <linux/binfmts.h> 13 14#ifdef CONFIG_SCHED_RT_CAS 15#include "eas_sched.h" 16#endif 17 18/* 19 * Tracepoint for calling kthread_stop, performed to end a kthread: 20 */ 21TRACE_EVENT(sched_kthread_stop, 22 23 TP_PROTO(struct task_struct *t), 24 25 TP_ARGS(t), 26 27 TP_STRUCT__entry( 28 __array( char, comm, TASK_COMM_LEN ) 29 __field( pid_t, pid ) 30 ), 31 32 TP_fast_assign( 33 memcpy(__entry->comm, t->comm, TASK_COMM_LEN); 34 __entry->pid = t->pid; 35 ), 36 37 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) 38); 39 40/* 41 * Tracepoint for the return value of the kthread stopping: 42 */ 43TRACE_EVENT(sched_kthread_stop_ret, 44 45 TP_PROTO(int ret), 46 47 TP_ARGS(ret), 48 49 TP_STRUCT__entry( 50 __field( int, ret ) 51 ), 52 53 TP_fast_assign( 54 __entry->ret = ret; 55 ), 56 57 TP_printk("ret=%d", __entry->ret) 58); 59 60/** 61 * sched_kthread_work_queue_work - called when a work gets queued 62 * @worker: pointer to the kthread_worker 63 * @work: pointer to struct kthread_work 64 * 65 * This event occurs when a work is queued immediately or once a 66 * delayed work is actually queued (ie: once the delay has been 67 * reached). 68 */ 69TRACE_EVENT(sched_kthread_work_queue_work, 70 71 TP_PROTO(struct kthread_worker *worker, 72 struct kthread_work *work), 73 74 TP_ARGS(worker, work), 75 76 TP_STRUCT__entry( 77 __field( void *, work ) 78 __field( void *, function) 79 __field( void *, worker) 80 ), 81 82 TP_fast_assign( 83 __entry->work = work; 84 __entry->function = work->func; 85 __entry->worker = worker; 86 ), 87 88 TP_printk("work struct=%p function=%ps worker=%p", 89 __entry->work, __entry->function, __entry->worker) 90); 91 92/** 93 * sched_kthread_work_execute_start - called immediately before the work callback 94 * @work: pointer to struct kthread_work 95 * 96 * Allows to track kthread work execution. 97 */ 98TRACE_EVENT(sched_kthread_work_execute_start, 99 100 TP_PROTO(struct kthread_work *work), 101 102 TP_ARGS(work), 103 104 TP_STRUCT__entry( 105 __field( void *, work ) 106 __field( void *, function) 107 ), 108 109 TP_fast_assign( 110 __entry->work = work; 111 __entry->function = work->func; 112 ), 113 114 TP_printk("work struct %p: function %ps", __entry->work, __entry->function) 115); 116 117/** 118 * sched_kthread_work_execute_end - called immediately after the work callback 119 * @work: pointer to struct work_struct 120 * @function: pointer to worker function 121 * 122 * Allows to track workqueue execution. 123 */ 124TRACE_EVENT(sched_kthread_work_execute_end, 125 126 TP_PROTO(struct kthread_work *work, kthread_work_func_t function), 127 128 TP_ARGS(work, function), 129 130 TP_STRUCT__entry( 131 __field( void *, work ) 132 __field( void *, function) 133 ), 134 135 TP_fast_assign( 136 __entry->work = work; 137 __entry->function = function; 138 ), 139 140 TP_printk("work struct %p: function %ps", __entry->work, __entry->function) 141); 142 143/* 144 * Tracepoint for waking up a task: 145 */ 146DECLARE_EVENT_CLASS(sched_wakeup_template, 147 148 TP_PROTO(struct task_struct *p), 149 150 TP_ARGS(__perf_task(p)), 151 152 TP_STRUCT__entry( 153 __array( char, comm, TASK_COMM_LEN ) 154 __field( pid_t, pid ) 155 __field( int, prio ) 156 __field( int, target_cpu ) 157 ), 158 159 TP_fast_assign( 160 memcpy(__entry->comm, p->comm, TASK_COMM_LEN); 161 __entry->pid = p->pid; 162 __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ 163 __entry->target_cpu = task_cpu(p); 164 ), 165 166 TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d", 167 __entry->comm, __entry->pid, __entry->prio, 168 __entry->target_cpu) 169); 170 171/* 172 * Tracepoint called when waking a task; this tracepoint is guaranteed to be 173 * called from the waking context. 174 */ 175DEFINE_EVENT(sched_wakeup_template, sched_waking, 176 TP_PROTO(struct task_struct *p), 177 TP_ARGS(p)); 178 179/* 180 * Tracepoint called when the task is actually woken; p->state == TASK_RUNNING. 181 * It is not always called from the waking context. 182 */ 183DEFINE_EVENT(sched_wakeup_template, sched_wakeup, 184 TP_PROTO(struct task_struct *p), 185 TP_ARGS(p)); 186 187/* 188 * Tracepoint for waking up a new task: 189 */ 190DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, 191 TP_PROTO(struct task_struct *p), 192 TP_ARGS(p)); 193 194#ifdef CREATE_TRACE_POINTS 195static inline long __trace_sched_switch_state(bool preempt, 196 unsigned int prev_state, 197 struct task_struct *p) 198{ 199 unsigned int state; 200 201#ifdef CONFIG_SCHED_DEBUG 202 BUG_ON(p != current); 203#endif /* CONFIG_SCHED_DEBUG */ 204 205 /* 206 * Preemption ignores task state, therefore preempted tasks are always 207 * RUNNING (we will not have dequeued if state != RUNNING). 208 */ 209 if (preempt) 210 return TASK_REPORT_MAX; 211 212 /* 213 * task_state_index() uses fls() and returns a value from 0-8 range. 214 * Decrement it by 1 (except TASK_RUNNING state i.e 0) before using 215 * it for left shift operation to get the correct task->state 216 * mapping. 217 */ 218 state = __task_state_index(prev_state, p->exit_state); 219 220 return state ? (1 << (state - 1)) : state; 221} 222#endif /* CREATE_TRACE_POINTS */ 223 224/* 225 * Tracepoint for task switches, performed by the scheduler: 226 */ 227TRACE_EVENT(sched_switch, 228 229 TP_PROTO(bool preempt, 230 struct task_struct *prev, 231 struct task_struct *next, 232 unsigned int prev_state), 233 234 TP_ARGS(preempt, prev, next, prev_state), 235 236 TP_STRUCT__entry( 237 __array( char, prev_comm, TASK_COMM_LEN ) 238 __field( pid_t, prev_pid ) 239 __field( int, prev_prio ) 240 __field( long, prev_state ) 241 __array( char, next_comm, TASK_COMM_LEN ) 242 __field( pid_t, next_pid ) 243 __field( int, next_prio ) 244 ), 245 246 TP_fast_assign( 247 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); 248 __entry->prev_pid = prev->pid; 249 __entry->prev_prio = prev->prio; 250 __entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev); 251 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); 252 __entry->next_pid = next->pid; 253 __entry->next_prio = next->prio; 254 /* XXX SCHED_DEADLINE */ 255 ), 256 257 TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d", 258 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, 259 260 (__entry->prev_state & (TASK_REPORT_MAX - 1)) ? 261 __print_flags(__entry->prev_state & (TASK_REPORT_MAX - 1), "|", 262 { TASK_INTERRUPTIBLE, "S" }, 263 { TASK_UNINTERRUPTIBLE, "D" }, 264 { __TASK_STOPPED, "T" }, 265 { __TASK_TRACED, "t" }, 266 { EXIT_DEAD, "X" }, 267 { EXIT_ZOMBIE, "Z" }, 268 { TASK_PARKED, "P" }, 269 { TASK_DEAD, "I" }) : 270 "R", 271 272 __entry->prev_state & TASK_REPORT_MAX ? "+" : "", 273 __entry->next_comm, __entry->next_pid, __entry->next_prio) 274); 275 276/* 277 * Tracepoint for a task being migrated: 278 */ 279TRACE_EVENT(sched_migrate_task, 280 281 TP_PROTO(struct task_struct *p, int dest_cpu), 282 283 TP_ARGS(p, dest_cpu), 284 285 TP_STRUCT__entry( 286 __array( char, comm, TASK_COMM_LEN ) 287 __field( pid_t, pid ) 288 __field( int, prio ) 289 __field( int, orig_cpu ) 290 __field( int, dest_cpu ) 291 ), 292 293 TP_fast_assign( 294 memcpy(__entry->comm, p->comm, TASK_COMM_LEN); 295 __entry->pid = p->pid; 296 __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ 297 __entry->orig_cpu = task_cpu(p); 298 __entry->dest_cpu = dest_cpu; 299 ), 300 301 TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", 302 __entry->comm, __entry->pid, __entry->prio, 303 __entry->orig_cpu, __entry->dest_cpu) 304); 305 306DECLARE_EVENT_CLASS(sched_process_template, 307 308 TP_PROTO(struct task_struct *p), 309 310 TP_ARGS(p), 311 312 TP_STRUCT__entry( 313 __array( char, comm, TASK_COMM_LEN ) 314 __field( pid_t, pid ) 315 __field( int, prio ) 316 ), 317 318 TP_fast_assign( 319 memcpy(__entry->comm, p->comm, TASK_COMM_LEN); 320 __entry->pid = p->pid; 321 __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ 322 ), 323 324 TP_printk("comm=%s pid=%d prio=%d", 325 __entry->comm, __entry->pid, __entry->prio) 326); 327 328/* 329 * Tracepoint for freeing a task: 330 */ 331DEFINE_EVENT(sched_process_template, sched_process_free, 332 TP_PROTO(struct task_struct *p), 333 TP_ARGS(p)); 334 335/* 336 * Tracepoint for a task exiting: 337 */ 338DEFINE_EVENT(sched_process_template, sched_process_exit, 339 TP_PROTO(struct task_struct *p), 340 TP_ARGS(p)); 341 342/* 343 * Tracepoint for waiting on task to unschedule: 344 */ 345DEFINE_EVENT(sched_process_template, sched_wait_task, 346 TP_PROTO(struct task_struct *p), 347 TP_ARGS(p)); 348 349/* 350 * Tracepoint for a waiting task: 351 */ 352TRACE_EVENT(sched_process_wait, 353 354 TP_PROTO(struct pid *pid), 355 356 TP_ARGS(pid), 357 358 TP_STRUCT__entry( 359 __array( char, comm, TASK_COMM_LEN ) 360 __field( pid_t, pid ) 361 __field( int, prio ) 362 ), 363 364 TP_fast_assign( 365 memcpy(__entry->comm, current->comm, TASK_COMM_LEN); 366 __entry->pid = pid_nr(pid); 367 __entry->prio = current->prio; /* XXX SCHED_DEADLINE */ 368 ), 369 370 TP_printk("comm=%s pid=%d prio=%d", 371 __entry->comm, __entry->pid, __entry->prio) 372); 373 374/* 375 * Tracepoint for kernel_clone: 376 */ 377TRACE_EVENT(sched_process_fork, 378 379 TP_PROTO(struct task_struct *parent, struct task_struct *child), 380 381 TP_ARGS(parent, child), 382 383 TP_STRUCT__entry( 384 __array( char, parent_comm, TASK_COMM_LEN ) 385 __field( pid_t, parent_pid ) 386 __array( char, child_comm, TASK_COMM_LEN ) 387 __field( pid_t, child_pid ) 388 ), 389 390 TP_fast_assign( 391 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); 392 __entry->parent_pid = parent->pid; 393 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); 394 __entry->child_pid = child->pid; 395 ), 396 397 TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d", 398 __entry->parent_comm, __entry->parent_pid, 399 __entry->child_comm, __entry->child_pid) 400); 401 402/* 403 * Tracepoint for exec: 404 */ 405TRACE_EVENT(sched_process_exec, 406 407 TP_PROTO(struct task_struct *p, pid_t old_pid, 408 struct linux_binprm *bprm), 409 410 TP_ARGS(p, old_pid, bprm), 411 412 TP_STRUCT__entry( 413 __string( filename, bprm->filename ) 414 __field( pid_t, pid ) 415 __field( pid_t, old_pid ) 416 ), 417 418 TP_fast_assign( 419 __assign_str(filename, bprm->filename); 420 __entry->pid = p->pid; 421 __entry->old_pid = old_pid; 422 ), 423 424 TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), 425 __entry->pid, __entry->old_pid) 426); 427 428 429#ifdef CONFIG_SCHEDSTATS 430#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT 431#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS 432#else 433#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT_NOP 434#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS_NOP 435#endif 436 437/* 438 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE 439 * adding sched_stat support to SCHED_FIFO/RR would be welcome. 440 */ 441DECLARE_EVENT_CLASS_SCHEDSTAT(sched_stat_template, 442 443 TP_PROTO(struct task_struct *tsk, u64 delay), 444 445 TP_ARGS(__perf_task(tsk), __perf_count(delay)), 446 447 TP_STRUCT__entry( 448 __array( char, comm, TASK_COMM_LEN ) 449 __field( pid_t, pid ) 450 __field( u64, delay ) 451 ), 452 453 TP_fast_assign( 454 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); 455 __entry->pid = tsk->pid; 456 __entry->delay = delay; 457 ), 458 459 TP_printk("comm=%s pid=%d delay=%Lu [ns]", 460 __entry->comm, __entry->pid, 461 (unsigned long long)__entry->delay) 462); 463 464/* 465 * Tracepoint for accounting wait time (time the task is runnable 466 * but not actually running due to scheduler contention). 467 */ 468DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_wait, 469 TP_PROTO(struct task_struct *tsk, u64 delay), 470 TP_ARGS(tsk, delay)); 471 472/* 473 * Tracepoint for accounting sleep time (time the task is not runnable, 474 * including iowait, see below). 475 */ 476DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_sleep, 477 TP_PROTO(struct task_struct *tsk, u64 delay), 478 TP_ARGS(tsk, delay)); 479 480/* 481 * Tracepoint for accounting iowait time (time the task is not runnable 482 * due to waiting on IO to complete). 483 */ 484DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_iowait, 485 TP_PROTO(struct task_struct *tsk, u64 delay), 486 TP_ARGS(tsk, delay)); 487 488/* 489 * Tracepoint for accounting blocked time (time the task is in uninterruptible). 490 */ 491DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_blocked, 492 TP_PROTO(struct task_struct *tsk, u64 delay), 493 TP_ARGS(tsk, delay)); 494 495/* 496 * Tracepoint for accounting runtime (time the task is executing 497 * on a CPU). 498 */ 499DECLARE_EVENT_CLASS(sched_stat_runtime, 500 501 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), 502 503 TP_ARGS(tsk, __perf_count(runtime), vruntime), 504 505 TP_STRUCT__entry( 506 __array( char, comm, TASK_COMM_LEN ) 507 __field( pid_t, pid ) 508 __field( u64, runtime ) 509 __field( u64, vruntime ) 510 ), 511 512 TP_fast_assign( 513 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); 514 __entry->pid = tsk->pid; 515 __entry->runtime = runtime; 516 __entry->vruntime = vruntime; 517 ), 518 519 TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", 520 __entry->comm, __entry->pid, 521 (unsigned long long)__entry->runtime, 522 (unsigned long long)__entry->vruntime) 523); 524 525DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, 526 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), 527 TP_ARGS(tsk, runtime, vruntime)); 528 529/* 530 * Tracepoint for showing priority inheritance modifying a tasks 531 * priority. 532 */ 533TRACE_EVENT(sched_pi_setprio, 534 535 TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task), 536 537 TP_ARGS(tsk, pi_task), 538 539 TP_STRUCT__entry( 540 __array( char, comm, TASK_COMM_LEN ) 541 __field( pid_t, pid ) 542 __field( int, oldprio ) 543 __field( int, newprio ) 544 ), 545 546 TP_fast_assign( 547 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); 548 __entry->pid = tsk->pid; 549 __entry->oldprio = tsk->prio; 550 __entry->newprio = pi_task ? 551 min(tsk->normal_prio, pi_task->prio) : 552 tsk->normal_prio; 553 /* XXX SCHED_DEADLINE bits missing */ 554 ), 555 556 TP_printk("comm=%s pid=%d oldprio=%d newprio=%d", 557 __entry->comm, __entry->pid, 558 __entry->oldprio, __entry->newprio) 559); 560 561#ifdef CONFIG_DETECT_HUNG_TASK 562TRACE_EVENT(sched_process_hang, 563 TP_PROTO(struct task_struct *tsk), 564 TP_ARGS(tsk), 565 566 TP_STRUCT__entry( 567 __array( char, comm, TASK_COMM_LEN ) 568 __field( pid_t, pid ) 569 ), 570 571 TP_fast_assign( 572 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); 573 __entry->pid = tsk->pid; 574 ), 575 576 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) 577); 578#endif /* CONFIG_DETECT_HUNG_TASK */ 579 580/* 581 * Tracks migration of tasks from one runqueue to another. Can be used to 582 * detect if automatic NUMA balancing is bouncing between nodes. 583 */ 584TRACE_EVENT(sched_move_numa, 585 586 TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), 587 588 TP_ARGS(tsk, src_cpu, dst_cpu), 589 590 TP_STRUCT__entry( 591 __field( pid_t, pid ) 592 __field( pid_t, tgid ) 593 __field( pid_t, ngid ) 594 __field( int, src_cpu ) 595 __field( int, src_nid ) 596 __field( int, dst_cpu ) 597 __field( int, dst_nid ) 598 ), 599 600 TP_fast_assign( 601 __entry->pid = task_pid_nr(tsk); 602 __entry->tgid = task_tgid_nr(tsk); 603 __entry->ngid = task_numa_group_id(tsk); 604 __entry->src_cpu = src_cpu; 605 __entry->src_nid = cpu_to_node(src_cpu); 606 __entry->dst_cpu = dst_cpu; 607 __entry->dst_nid = cpu_to_node(dst_cpu); 608 ), 609 610 TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", 611 __entry->pid, __entry->tgid, __entry->ngid, 612 __entry->src_cpu, __entry->src_nid, 613 __entry->dst_cpu, __entry->dst_nid) 614); 615 616DECLARE_EVENT_CLASS(sched_numa_pair_template, 617 618 TP_PROTO(struct task_struct *src_tsk, int src_cpu, 619 struct task_struct *dst_tsk, int dst_cpu), 620 621 TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu), 622 623 TP_STRUCT__entry( 624 __field( pid_t, src_pid ) 625 __field( pid_t, src_tgid ) 626 __field( pid_t, src_ngid ) 627 __field( int, src_cpu ) 628 __field( int, src_nid ) 629 __field( pid_t, dst_pid ) 630 __field( pid_t, dst_tgid ) 631 __field( pid_t, dst_ngid ) 632 __field( int, dst_cpu ) 633 __field( int, dst_nid ) 634 ), 635 636 TP_fast_assign( 637 __entry->src_pid = task_pid_nr(src_tsk); 638 __entry->src_tgid = task_tgid_nr(src_tsk); 639 __entry->src_ngid = task_numa_group_id(src_tsk); 640 __entry->src_cpu = src_cpu; 641 __entry->src_nid = cpu_to_node(src_cpu); 642 __entry->dst_pid = dst_tsk ? task_pid_nr(dst_tsk) : 0; 643 __entry->dst_tgid = dst_tsk ? task_tgid_nr(dst_tsk) : 0; 644 __entry->dst_ngid = dst_tsk ? task_numa_group_id(dst_tsk) : 0; 645 __entry->dst_cpu = dst_cpu; 646 __entry->dst_nid = dst_cpu >= 0 ? cpu_to_node(dst_cpu) : -1; 647 ), 648 649 TP_printk("src_pid=%d src_tgid=%d src_ngid=%d src_cpu=%d src_nid=%d dst_pid=%d dst_tgid=%d dst_ngid=%d dst_cpu=%d dst_nid=%d", 650 __entry->src_pid, __entry->src_tgid, __entry->src_ngid, 651 __entry->src_cpu, __entry->src_nid, 652 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, 653 __entry->dst_cpu, __entry->dst_nid) 654); 655 656DEFINE_EVENT(sched_numa_pair_template, sched_stick_numa, 657 658 TP_PROTO(struct task_struct *src_tsk, int src_cpu, 659 struct task_struct *dst_tsk, int dst_cpu), 660 661 TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu) 662); 663 664DEFINE_EVENT(sched_numa_pair_template, sched_swap_numa, 665 666 TP_PROTO(struct task_struct *src_tsk, int src_cpu, 667 struct task_struct *dst_tsk, int dst_cpu), 668 669 TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu) 670); 671 672 673/* 674 * Tracepoint for waking a polling cpu without an IPI. 675 */ 676TRACE_EVENT(sched_wake_idle_without_ipi, 677 678 TP_PROTO(int cpu), 679 680 TP_ARGS(cpu), 681 682 TP_STRUCT__entry( 683 __field( int, cpu ) 684 ), 685 686 TP_fast_assign( 687 __entry->cpu = cpu; 688 ), 689 690 TP_printk("cpu=%d", __entry->cpu) 691); 692 693#ifdef CONFIG_SCHED_CORE_CTRL 694TRACE_EVENT(core_ctl_eval_need, 695 696 TP_PROTO(unsigned int cpu, unsigned int old_need, 697 unsigned int new_need, unsigned int updated), 698 TP_ARGS(cpu, old_need, new_need, updated), 699 TP_STRUCT__entry( 700 __field(u32, cpu) 701 __field(u32, old_need) 702 __field(u32, new_need) 703 __field(u32, updated) 704 ), 705 TP_fast_assign( 706 __entry->cpu = cpu; 707 __entry->old_need = old_need; 708 __entry->new_need = new_need; 709 __entry->updated = updated; 710 ), 711 TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, 712 __entry->old_need, __entry->new_need, __entry->updated) 713); 714 715TRACE_EVENT(core_ctl_set_busy, 716 717 TP_PROTO(unsigned int cpu, unsigned int busy, 718 unsigned int old_is_busy, unsigned int is_busy, int high_irqload), 719 TP_ARGS(cpu, busy, old_is_busy, is_busy, high_irqload), 720 TP_STRUCT__entry( 721 __field(u32, cpu) 722 __field(u32, busy) 723 __field(u32, old_is_busy) 724 __field(u32, is_busy) 725 __field(bool, high_irqload) 726 ), 727 TP_fast_assign( 728 __entry->cpu = cpu; 729 __entry->busy = busy; 730 __entry->old_is_busy = old_is_busy; 731 __entry->is_busy = is_busy; 732 __entry->high_irqload = high_irqload; 733 ), 734 TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u high_irqload=%d", 735 __entry->cpu, __entry->busy, __entry->old_is_busy, 736 __entry->is_busy, __entry->high_irqload) 737); 738 739TRACE_EVENT(core_ctl_set_boost, 740 741 TP_PROTO(u32 refcount, s32 ret), 742 TP_ARGS(refcount, ret), 743 TP_STRUCT__entry( 744 __field(u32, refcount) 745 __field(s32, ret) 746 ), 747 TP_fast_assign( 748 __entry->refcount = refcount; 749 __entry->ret = ret; 750 ), 751 TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret) 752); 753 754TRACE_EVENT(core_ctl_update_nr_need, 755 756 TP_PROTO(int cpu, int nr_need, int prev_misfit_need, 757 int nrrun, int max_nr, int nr_prev_assist), 758 759 TP_ARGS(cpu, nr_need, prev_misfit_need, nrrun, max_nr, nr_prev_assist), 760 761 TP_STRUCT__entry( 762 __field(int, cpu) 763 __field(int, nr_need) 764 __field(int, prev_misfit_need) 765 __field(int, nrrun) 766 __field(int, max_nr) 767 __field(int, nr_prev_assist) 768 ), 769 770 TP_fast_assign( 771 __entry->cpu = cpu; 772 __entry->nr_need = nr_need; 773 __entry->prev_misfit_need = prev_misfit_need; 774 __entry->nrrun = nrrun; 775 __entry->max_nr = max_nr; 776 __entry->nr_prev_assist = nr_prev_assist; 777 ), 778 779 TP_printk("cpu=%d nr_need=%d prev_misfit_need=%d nrrun=%d max_nr=%d nr_prev_assist=%d", 780 __entry->cpu, __entry->nr_need, __entry->prev_misfit_need, 781 __entry->nrrun, __entry->max_nr, __entry->nr_prev_assist) 782); 783#endif 784 785#ifdef CONFIG_SCHED_RUNNING_AVG 786/* 787 * Tracepoint for sched_get_nr_running_avg 788 */ 789TRACE_EVENT(sched_get_nr_running_avg, 790 791 TP_PROTO(int cpu, int nr, int nr_misfit, int nr_max), 792 793 TP_ARGS(cpu, nr, nr_misfit, nr_max), 794 795 TP_STRUCT__entry( 796 __field(int, cpu) 797 __field(int, nr) 798 __field(int, nr_misfit) 799 __field(int, nr_max) 800 ), 801 802 TP_fast_assign( 803 __entry->cpu = cpu; 804 __entry->nr = nr; 805 __entry->nr_misfit = nr_misfit; 806 __entry->nr_max = nr_max; 807 ), 808 809 TP_printk("cpu=%d nr=%d nr_misfit=%d nr_max=%d", 810 __entry->cpu, __entry->nr, __entry->nr_misfit, __entry->nr_max) 811); 812#endif 813 814#ifdef CONFIG_CPU_ISOLATION_OPT 815/* 816 * sched_isolate - called when cores are isolated/unisolated 817 * 818 * @acutal_mask: mask of cores actually isolated/unisolated 819 * @req_mask: mask of cores requested isolated/unisolated 820 * @online_mask: cpu online mask 821 * @time: amount of time in us it took to isolate/unisolate 822 * @isolate: 1 if isolating, 0 if unisolating 823 * 824 */ 825TRACE_EVENT(sched_isolate, 826 827 TP_PROTO(unsigned int requested_cpu, unsigned int isolated_cpus, 828 u64 start_time, unsigned char isolate), 829 830 TP_ARGS(requested_cpu, isolated_cpus, start_time, isolate), 831 832 TP_STRUCT__entry( 833 __field(u32, requested_cpu) 834 __field(u32, isolated_cpus) 835 __field(u32, time) 836 __field(unsigned char, isolate) 837 ), 838 839 TP_fast_assign( 840 __entry->requested_cpu = requested_cpu; 841 __entry->isolated_cpus = isolated_cpus; 842 __entry->time = div64_u64(sched_clock() - start_time, 1000); 843 __entry->isolate = isolate; 844 ), 845 846 TP_printk("iso cpu=%u cpus=0x%x time=%u us isolated=%d", 847 __entry->requested_cpu, __entry->isolated_cpus, 848 __entry->time, __entry->isolate) 849); 850#endif 851 852/* 853 * Following tracepoints are not exported in tracefs and provide hooking 854 * mechanisms only for testing and debugging purposes. 855 * 856 * Postfixed with _tp to make them easily identifiable in the code. 857 */ 858DECLARE_TRACE(pelt_cfs_tp, 859 TP_PROTO(struct cfs_rq *cfs_rq), 860 TP_ARGS(cfs_rq)); 861 862DECLARE_TRACE(pelt_rt_tp, 863 TP_PROTO(struct rq *rq), 864 TP_ARGS(rq)); 865 866DECLARE_TRACE(pelt_dl_tp, 867 TP_PROTO(struct rq *rq), 868 TP_ARGS(rq)); 869 870DECLARE_TRACE(pelt_thermal_tp, 871 TP_PROTO(struct rq *rq), 872 TP_ARGS(rq)); 873 874DECLARE_TRACE(pelt_irq_tp, 875 TP_PROTO(struct rq *rq), 876 TP_ARGS(rq)); 877 878DECLARE_TRACE(pelt_se_tp, 879 TP_PROTO(struct sched_entity *se), 880 TP_ARGS(se)); 881 882DECLARE_TRACE(sched_cpu_capacity_tp, 883 TP_PROTO(struct rq *rq), 884 TP_ARGS(rq)); 885 886DECLARE_TRACE(sched_overutilized_tp, 887 TP_PROTO(struct root_domain *rd, bool overutilized), 888 TP_ARGS(rd, overutilized)); 889 890DECLARE_TRACE(sched_util_est_cfs_tp, 891 TP_PROTO(struct cfs_rq *cfs_rq), 892 TP_ARGS(cfs_rq)); 893 894DECLARE_TRACE(sched_util_est_se_tp, 895 TP_PROTO(struct sched_entity *se), 896 TP_ARGS(se)); 897 898DECLARE_TRACE(sched_update_nr_running_tp, 899 TP_PROTO(struct rq *rq, int change), 900 TP_ARGS(rq, change)); 901 902#endif /* _TRACE_SCHED_H */ 903 904/* This part must be outside protection */ 905#include <trace/define_trace.h> 906