diff options
| author | Zelin Tong <ztong@ludwig.cs.unc.edu> | 2020-09-28 06:20:29 -0400 |
|---|---|---|
| committer | Zelin Tong <ztong@ludwig.cs.unc.edu> | 2020-09-28 06:20:29 -0400 |
| commit | 983c9dae37b709efbbfc843ef78dc094c6f47fd2 (patch) | |
| tree | ef527a1a050aedafd6a2d07a078c847420dec113 | |
| parent | 8d1a90a5e4c7594c20c70fbb9e0ef0c77f2c3d1e (diff) | |
added support for np-sections in GEDF reservation.
Also, includes WIP of component allocator. This WIP is not included in
the makefile so it won't mess up the compilation.
| -rw-r--r-- | include/litmus/reservations/ext_reservation.h | 36 | ||||
| -rw-r--r-- | include/litmus/reservations/gedf_reservation.h | 7 | ||||
| -rw-r--r-- | include/litmus/reservations/table_driven_ext_reservation.h | 23 | ||||
| -rw-r--r-- | include/litmus/rt_domain.h | 7 | ||||
| -rw-r--r-- | litmus/reservations/Makefile | 1 | ||||
| -rw-r--r-- | litmus/reservations/gedf_reservation.c | 169 | ||||
| -rw-r--r-- | litmus/reservations/table_driven_ext_reservation.c | 256 | ||||
| -rw-r--r-- | litmus/rt_domain.c | 8 | ||||
| -rw-r--r-- | litmus/sched_ext_res.c | 52 |
9 files changed, 457 insertions, 102 deletions
diff --git a/include/litmus/reservations/ext_reservation.h b/include/litmus/reservations/ext_reservation.h index 40c9cd9e098e..97b8bad916df 100644 --- a/include/litmus/reservations/ext_reservation.h +++ b/include/litmus/reservations/ext_reservation.h | |||
| @@ -25,6 +25,7 @@ typedef void (*drain_budget_t) ( | |||
| 25 | 25 | ||
| 26 | typedef struct task_struct* (*dispatch_client_t) ( | 26 | typedef struct task_struct* (*dispatch_client_t) ( |
| 27 | struct reservation *reservation, | 27 | struct reservation *reservation, |
| 28 | lt_t* time_slice, | ||
| 28 | int cpu | 29 | int cpu |
| 29 | ); | 30 | ); |
| 30 | 31 | ||
| @@ -40,8 +41,15 @@ typedef void (*on_preempt_t) ( | |||
| 40 | int cpu | 41 | int cpu |
| 41 | ); | 42 | ); |
| 42 | 43 | ||
| 44 | typedef int (*is_np_t) ( | ||
| 45 | struct reservation *reservation, | ||
| 46 | int cpu | ||
| 47 | ); | ||
| 48 | |||
| 43 | /* Destructor: called before scheduler is deactivated. */ | 49 | /* Destructor: called before scheduler is deactivated. */ |
| 44 | typedef void (*shutdown_t)(struct reservation *reservation); | 50 | typedef void (*shutdown_t)( |
| 51 | struct reservation *reservation | ||
| 52 | ); | ||
| 45 | 53 | ||
| 46 | struct reservation_ops { | 54 | struct reservation_ops { |
| 47 | drain_budget_t drain_budget; | 55 | drain_budget_t drain_budget; |
| @@ -49,6 +57,7 @@ struct reservation_ops { | |||
| 49 | dispatch_client_t dispatch_client; | 57 | dispatch_client_t dispatch_client; |
| 50 | on_schedule_t on_schedule; | 58 | on_schedule_t on_schedule; |
| 51 | on_preempt_t on_preempt; | 59 | on_preempt_t on_preempt; |
| 60 | is_np_t is_np; | ||
| 52 | shutdown_t shutdown; | 61 | shutdown_t shutdown; |
| 53 | }; | 62 | }; |
| 54 | 63 | ||
| @@ -58,6 +67,7 @@ struct reservation { | |||
| 58 | /* exact meaning defined by impl. */ | 67 | /* exact meaning defined by impl. */ |
| 59 | lt_t priority; | 68 | lt_t priority; |
| 60 | lt_t replenishment_time; | 69 | lt_t replenishment_time; |
| 70 | lt_t cur_budget; | ||
| 61 | 71 | ||
| 62 | /* budget stats */ | 72 | /* budget stats */ |
| 63 | lt_t budget_consumed; /* how much budget consumed in this allocation cycle? */ | 73 | lt_t budget_consumed; /* how much budget consumed in this allocation cycle? */ |
| @@ -93,6 +103,7 @@ typedef void (*env_update_time_t) ( | |||
| 93 | 103 | ||
| 94 | typedef struct task_struct* (*env_dispatch_t) ( | 104 | typedef struct task_struct* (*env_dispatch_t) ( |
| 95 | struct reservation_environment* env, | 105 | struct reservation_environment* env, |
| 106 | lt_t* time_slice, | ||
| 96 | int cpu); | 107 | int cpu); |
| 97 | 108 | ||
| 98 | typedef void (*env_resume_t) ( | 109 | typedef void (*env_resume_t) ( |
| @@ -103,12 +114,24 @@ typedef void (*env_suspend_t) ( | |||
| 103 | struct reservation_environment* env, | 114 | struct reservation_environment* env, |
| 104 | int cpu); | 115 | int cpu); |
| 105 | 116 | ||
| 106 | typedef void (*env_add_res_t) (struct reservation_environment* env, | 117 | typedef void (*env_add_res_t) ( |
| 107 | struct reservation* res); | 118 | struct reservation_environment* env, |
| 119 | struct reservation* res, | ||
| 120 | int cpu); | ||
| 108 | 121 | ||
| 109 | typedef void (*env_remove_res_t) (struct reservation_environment* env, | 122 | typedef void (*env_remove_res_t) ( |
| 123 | struct reservation_environment* env, | ||
| 110 | struct reservation* res, | 124 | struct reservation* res, |
| 111 | int complete); | 125 | int complete, |
| 126 | int cpu); | ||
| 127 | |||
| 128 | typedef struct reservation* (*env_find_res_t) ( | ||
| 129 | struct reservation_environment* env, | ||
| 130 | int id); | ||
| 131 | |||
| 132 | typedef int (*env_is_np_t) ( | ||
| 133 | struct reservation_environment* env, | ||
| 134 | int cpu); | ||
| 112 | 135 | ||
| 113 | typedef void (*env_shutdown_t) ( | 136 | typedef void (*env_shutdown_t) ( |
| 114 | struct reservation_environment* env); | 137 | struct reservation_environment* env); |
| @@ -120,12 +143,15 @@ struct reservation_environment_ops { | |||
| 120 | env_suspend_t suspend; | 143 | env_suspend_t suspend; |
| 121 | env_add_res_t add_res; | 144 | env_add_res_t add_res; |
| 122 | env_remove_res_t remove_res; | 145 | env_remove_res_t remove_res; |
| 146 | env_find_res_t find_res_by_id; | ||
| 147 | env_is_np_t is_np; | ||
| 123 | env_shutdown_t shutdown; | 148 | env_shutdown_t shutdown; |
| 124 | }; | 149 | }; |
| 125 | 150 | ||
| 126 | struct reservation_environment { | 151 | struct reservation_environment { |
| 127 | struct reservation_environment_ops* ops; | 152 | struct reservation_environment_ops* ops; |
| 128 | struct reservation* res; | 153 | struct reservation* res; |
| 154 | struct list_head all_reservations; | ||
| 129 | }; | 155 | }; |
| 130 | 156 | ||
| 131 | static inline void env_to_res_couple( | 157 | static inline void env_to_res_couple( |
diff --git a/include/litmus/reservations/gedf_reservation.h b/include/litmus/reservations/gedf_reservation.h index 2adaaabbcaf4..e39d632262a3 100644 --- a/include/litmus/reservations/gedf_reservation.h +++ b/include/litmus/reservations/gedf_reservation.h | |||
| @@ -10,15 +10,14 @@ | |||
| 10 | /* ************************************************************************** */ | 10 | /* ************************************************************************** */ |
| 11 | struct gedf_reservation { | 11 | struct gedf_reservation { |
| 12 | struct reservation res; | 12 | struct reservation res; |
| 13 | struct cpu_entry* linked_on; | 13 | struct gedf_cpu_entry* linked_on; |
| 14 | lt_t cur_budget; | 14 | lt_t cur_budget; |
| 15 | int will_remove; | 15 | int will_remove; |
| 16 | int blocked; | 16 | int blocked; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | struct cpu_entry { | 19 | struct gedf_cpu_entry { |
| 20 | int id; | 20 | int id; |
| 21 | struct hrtimer timer; | ||
| 22 | struct bheap_node* hn; | 21 | struct bheap_node* hn; |
| 23 | struct gedf_reservation* linked; | 22 | struct gedf_reservation* linked; |
| 24 | struct gedf_reservation* scheduled; | 23 | struct gedf_reservation* scheduled; |
| @@ -60,7 +59,7 @@ struct gedf_reservation_environment { | |||
| 60 | volatile int num_cpus; | 59 | volatile int num_cpus; |
| 61 | 60 | ||
| 62 | /* array of gedf cpu entries */ | 61 | /* array of gedf cpu entries */ |
| 63 | struct cpu_entry cpu_entries[NR_CPUS]; | 62 | struct gedf_cpu_entry cpu_entries[NR_CPUS]; |
| 64 | 63 | ||
| 65 | /* used to order cpus for gedf purposes */ | 64 | /* used to order cpus for gedf purposes */ |
| 66 | struct bheap cpu_heap; | 65 | struct bheap cpu_heap; |
diff --git a/include/litmus/reservations/table_driven_ext_reservation.h b/include/litmus/reservations/table_driven_ext_reservation.h index 51c32eadb419..100b4eea8cba 100644 --- a/include/litmus/reservations/table_driven_ext_reservation.h +++ b/include/litmus/reservations/table_driven_ext_reservation.h | |||
| @@ -4,22 +4,14 @@ | |||
| 4 | #include <litmus/reservations/ext_reservation.h> | 4 | #include <litmus/reservations/ext_reservation.h> |
| 5 | 5 | ||
| 6 | /* ************************************************************************** */ | 6 | /* ************************************************************************** */ |
| 7 | struct cpu_entry { | ||
| 8 | int id; | ||
| 9 | struct hrtimer timer; | ||
| 10 | struct bheap_node* hn; | ||
| 11 | struct reservation* linked; | ||
| 12 | struct reservation* scheduled; | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct mtd_reservation { | 7 | struct mtd_reservation { |
| 16 | struct reservation res; | 8 | struct reservation res; |
| 9 | volatile int in_env; | ||
| 17 | lt_t major_cycle; | 10 | lt_t major_cycle; |
| 18 | unsigned int interval_index[NR_CPUS]; | 11 | unsigned int interval_index[NR_CPUS]; |
| 19 | unsigned int num_intervals[NR_CPUS]; | 12 | unsigned int num_intervals[NR_CPUS]; |
| 20 | struct lt_interval* intervals[NR_CPUS]; | 13 | struct lt_interval* intervals[NR_CPUS]; |
| 21 | 14 | ||
| 22 | int num_cur_intervals; | ||
| 23 | struct lt_interval cur_interval[NR_CPUS]; | 15 | struct lt_interval cur_interval[NR_CPUS]; |
