1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Frame declaration 4 * 5 * Copyright (c) 2022-2023 Huawei Technologies Co., Ltd. 6 */ 7 8 #ifndef __SCHED_FRAME_RTG_H 9 #define __SCHED_FRAME_RTG_H 10 11 #ifdef CONFIG_SCHED_RTG_FRAME 12 13 #define MAX_TID_NUM 5 14 15 struct frame_info { 16 /* 17 * use rtg load tracking in frame_info 18 * rtg->curr_window_load -=> the workload of current frame 19 * rtg->prev_window_load -=> the workload of last frame 20 * rtg->curr_window_exec -=> the thread's runtime of current frame 21 * rtg->prev_window_exec -=> the thread's runtime of last frame 22 * rtg->prev_window_time -=> the actual time of the last frame 23 */ 24 struct mutex lock; 25 struct related_thread_group *rtg; 26 int prio; 27 struct task_struct *thread[MAX_TID_NUM]; 28 atomic_t thread_prio[MAX_TID_NUM]; 29 int thread_num; 30 unsigned int frame_rate; // frame rate 31 u64 frame_time; 32 atomic_t curr_rt_thread_num; 33 atomic_t max_rt_thread_num; 34 atomic_t frame_sched_state; 35 atomic_t start_frame_freq; 36 atomic_t frame_state; 37 38 /* 39 * frame_vload : the emergency level of current frame. 40 * max_vload_time : the timeline frame_load increase to FRAME_MAX_VLOAD 41 * it's always equal to 2 * frame_time / NSEC_PER_MSEC 42 * 43 * The closer to the deadline, the higher emergency of current 44 * frame, so the frame_vload is only related to frame time, 45 * and grown with time. 46 */ 47 u64 frame_vload; 48 int vload_margin; 49 int max_vload_time; 50 51 u64 frame_util; 52 unsigned long status; 53 unsigned long prev_fake_load_util; 54 unsigned long prev_frame_load_util; 55 unsigned long prev_frame_time; 56 unsigned long prev_frame_exec; 57 unsigned long prev_frame_load; 58 unsigned int frame_min_util; 59 unsigned int frame_max_util; 60 unsigned int prev_min_util; 61 unsigned int prev_max_util; 62 unsigned int frame_boost_min_util; 63 64 bool margin_imme; 65 bool timestamp_skipped; 66 }; 67 68 struct frame_info *rtg_frame_info(int id); 69 static inline frame_info_rtg(const struct frame_info * frame_info)70struct related_thread_group *frame_info_rtg(const struct frame_info *frame_info) 71 { 72 return frame_info->rtg; 73 } 74 #endif 75 #endif 76