Provides CPU resource reservations into the kernel through a kernel API. More...
Data Structures | |
struct | server_params_t |
struct | server_t |
RRES server main structure. More... | |
struct | task_list |
Used to queue a task as either active or blocked within a server. More... | |
Files | |
file | rres.h |
Internal resource reservation header file. | |
file | rres_dispatch_gsd_2.4.h |
Module interfacing with the Linux scheduler for the purpose of forcing schedule and deschedule of processes belonging to the servers. | |
file | rres_dispatch_gsd_2.6.h |
Module interfacing with the Linux scheduler for the purpose of forcing schedule and deschedule of processes belonging to the servers. | |
file | rres_dispatch_new.c |
Module interfacing with the Linux scheduler for the purpose of forcing schedule and deschedule of processes belonging to the servers. | |
file | rres_dispatch_new.h |
Module interfacing with the Linux scheduler for the purpose of forcing schedule and deschedule of processes belonging to the servers. | |
file | rres_dispatch_sig.h |
Module interfacing with the Linux scheduler for the purpose of forcing schedule and deschedule of processes belonging to the servers. | |
file | rres_hooks.h |
Hooks functions declaration and functions to set/unset hooks handlers. | |
file | rres_interface.h |
RRES Module main interface header. | |
file | rres_kpi_core.h |
RRES Module main interface header. | |
file | rres_kpi_protected.h |
RRES Module protected interface header. | |
file | rres_proc_fs.h |
Support of proc file system. | |
file | rres_ready_queue.h |
Implementation of an edf queue. | |
file | rres_ready_queue_eheap.h |
Heap-based implementation of an edf queue. | |
file | rres_ready_queue_list.h |
List-based implementation of an edf queue. | |
file | rres_server.h |
Internal resource reservation header file. | |
file | rres_time.h |
time and clock related functions | |
file | rres_utils.h |
Utility functions, like list handling. | |
Defines | |
#define | for_each_srv(srv, head, list_field, pos) |
Macro used by for_each_*_server to iterate over a server list. | |
#define | for_each_srv_safe(srv, head, list_field, pos, postmp) |
Macro used against removal risks to iterate over the server list. | |
#define | for_each_server(srv, pos) for_each_srv((srv), &server_list, slist, (pos)) |
Iterate over all servers in the system. | |
#define | for_each_server_safe(srv, pos, tmppos) for_each_srv_safe((srv), &server_list, slist, (pos), (tmppos)) |
Iterate over all servers in the system - safe against removal. | |
#define | get_task_entry(h) list_entry((h), struct task_list, others) |
Return the ponter to task_list referred by (h). | |
#define | for_each_ready_task_in_server(__srv, t, pos) |
Loop on all tasks in a server (do not modify the list). | |
#define | for_each_blocked_task_in_server(__srv, t, pos) |
#define | for_each_ready_task_in_server_safe(__srv, t, __pos, __tmp) |
Loop on all tasks in a server. | |
#define | for_each_blocked_task_in_server_safe(__srv, t, __pos, __tmp) |
#define | qos_log_state(__t) qos_log_debug("(%d), state: %ld, prio: %d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task | |
#define | qos_log_state_simple(__t) qos_log_simple(QOS_DEBUG_LEVEL, "(%d),s:%ld, p:%d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task (without any other debug info) | |
#define | SCHED_OTHER SCHED_NORMAL |
#define | STOP_PRIORITY -2100 |
priority to force linux descheduling | |
#define | qos_log_state(__t) qos_log_debug("(%d), state: %ld, prio: %d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task | |
#define | qos_log_state_simple(__t) qos_log_simple(QOS_DEBUG_LEVEL, "(%d),s:%ld, p:%d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task (without any other debug info) | |
#define | set_tsk_need_resched(task) do { task->need_resched = 1; } while (0) |
force to call the linux scheduler | |
#define | GENSCHED_DISABLED 1024 |
state of a task that is forced to be descheduled | |
#define | RRES_DISPATCH_PRIORITY 65 |
priority to force linux scheduling | |
#define | rres_init_sched_param(task) set_task_rr_prio(task, RRES_DISPATCH_PRIORITY) |
#define | rres_task_sched_default(task) |
#define | QOS_DEBUG_LEVEL RRES_MOD_DEBUG_LEVEL |
#define | SCHED_OTHER SCHED_NORMAL |
#define | rres_init_sched_param(task) set_task_rr_prio(task, RRES_DISPATCH_PRIORITY) |
#define | rres_task_sched_default(task) set_task_rr_prio(task, -1) |
#define | SCHED_OTHER SCHED_NORMAL |
#define | rres_init_sched_param(task) |
#define | rres_task_sched_default(task) |
#define | SCHED_OTHER SCHED_NORMAL |
#define | MIN_SRV_PERIOD 1000LU |
usec. | |
#define | MIN_SRV_MAX_BUDGET 0LU |
usec. | |
#define | MIN_SRV_PERIOD_DEBUG 200000LU |
usec. | |
#define | QOS_F_DEFAULT 0x00000001 |
The server to create is the default one. | |
#define | QOS_F_SOFT 0x00000002 |
Server tasks are scheduled within the reservation, and also by Linux outside. | |
#define | kal_eheap_key_lt kal_time_lt |
#define | RRES_MAX_NUM_SERVERS_BITS 12 |
#define | RRES_MAX_NUM_SERVERS (1 << RRES_MAX_NUM_SERVERS_BITS) |
#define | rq_placeholder_init(p_it) kal_eheap_iterator_init(p_it) |
Inititalize a ready queue placeholder as invalid (item not enqueued). | |
#define | for_each_ready_server(srv, p_it) |
iterate over ready server list | |
#define | rq_placeholder_init(p_list_head) INIT_LIST_HEAD_NULL(p_list_head) |
Inititalize a ready queue placeholder as invalid (item not enqueued). | |
#define | for_each_ready_server(srv, pos) for_each_srv((srv), &ready_queue, rq_ph, (pos)) |
iterate over ready server list | |
#define | U_LUB2 (U_LUB+r2bw_c(1,100)) |
This adds a tolerance to U_LUB as defined for QRES/QSUP, so to avoid that RRESMOD notifies a system overload when QRES/QSUP do not. | |
#define | CPU_KHZ_TYPE unsigned long |
#define | do_gettimeofday(__tv) gettimeofday((__tv), NULL); |
#define | INIT_LIST_HEAD_NULL(ptr) do { (ptr)->prev = NULL; (ptr)->next = NULL; } while (0) |
#define | list_add_ordered(head, obj_type, obj, list_field, ord_field, ret) |
add an object in an ordered list insert in the (head) list the (obj) of type (obj_type), ordered in increasing order by field (ord_field) of (obj) example list_add_ordered (ready_list, server_t, srv, rq_ph, deadline, ret) NOTE: in the parameters description "" are used for argument that are name and not variables. | |
Typedefs | |
typedef struct server_params_t | server_params_t |
typedef struct server_t * | server_p |
Avoids circular dependencies. | |
typedef struct list_head | rq_placeholder_t |
Ready queue placeholder, useful for being embedded within an enqueued item for subsequenct extraction. | |
typedef struct server_t | server_t |
Functions | |
qos_rv | rres_init (void) |
Initialise server lists, timers, and algorithm related data, then call rres_schedule(). | |
qos_rv | rres_cleanup (void) |
Destroy all servers in the system. | |
qos_rv | rres_cleanup_default_server_nosched (server_t *srv) |
Detach all the tasks served by the default server and cleanup the server. | |
qos_rv | rres_detach_task_nosched (server_t *srv, struct task_struct *task) |
qos_rv | rres_move_nosched (server_t *new_srv, struct task_struct *task) |
Move into the specified server the specified task. | |
void | rres_schedule (void) |
Activate the server due to a new job arrival or add a pending request of activation if already active. | |
void | recharge (server_t *srv) |
Recharge the budget and update the deadline to the old value plus the server period. | |
void | recharge_reset_from_now (server_t *srv) |
recharge the budget and set the deadline to the actual time plus the server period | |
qos_rv | rres_on_task_block (struct task_struct *task) |
qos_rv | rres_on_task_unblock (struct task_struct *task) |
static qos_bool_t | is_in_default_server (struct task_struct *t) |
Check if the task is served by the default server. | |
static qos_bool_t | is_default_server (server_t *srv) |
It returns true if the server is the default server. | |
void | rres_stop (server_t *srv) |
Stop all tasks handled by the server. | |
void | rres_dispatch (server_t *srv) |
Dispatch (force scheduling) of all tasks handled by the server. | |
void | stop_task_safe (server_t *srv, struct task_struct *task) |
void | dispatch_task_safe (server_t *srv, struct task_struct *task) |
static void | kal_force_reschedule (void) |
int | task_ready (struct task_struct *task) |
return true if task is ready to run (task's state = TASK_RUNNING in Linux) | |
void | rres_init_sched_param (struct task_struct *task) |
void | rres_task_sched_default (struct task_struct *task) |
void | stop_task (struct task_struct *t) |
Make a task not schedulable by Linux scheduler. | |
void | dispatch_task (struct task_struct *t) |
Force Linux to schedule this task (or one of the task of the same server). | |
static void | rres_idle_cpu (void) |
Forces scheduling of the Linux idle task. | |
static void | rres_dispatch_setup (server_t *srv) |
int | task_ready (kal_task_t *task) |
return true if task is ready to run (task's state = TASK_RUNNING in Linux) | |
void | rres_init_sched_param (kal_task_t *task) |
void | rres_task_sched_default (kal_task_t *task) |
void | activate_task_local (kal_task_t *task) |
void | deactivate_task_local (kal_task_t *task) |
void | stop_task (kal_task_t *t) |
Make a task not schedulable by the Linux scheduler. | |
void | dispatch_task (kal_task_t *t) |
Allow the Linux scheduler to schedule this task. | |
void | activate_task_local (struct task_struct *task) |
void | deactivate_task_local (struct task_struct *task) |
int | check_gensched_hooks (void) |
Return true if hooks are not initialised. | |
void | set_gensched_hooks (void) |
Set scheduler hooks. | |
void | unset_gensched_hooks (void) |
Unset scheduler hooks. | |
static struct task_list * | rres_find_task_list (kal_task_t *task) |
static server_t * | rres_find_by_task (kal_task_t *task) |
Return the pointer to the server the task is attached to, or NULL. | |
int | rres_init_module (void) |
Initialise rres module. | |
void | rres_cleanup_module (void) |
Cleanup rres module. | |
qos_rv | rres_create_server (server_t **new_srv, qres_time_t max_budget, qres_time_t period, unsigned long flags) |
Create a new server for task t. | |
qos_rv | rres_init_server (server_t *new_srv, qres_time_t max_budget, qres_time_t period, unsigned long flags) |
Initialize an already allocated server_t (or derived class). | |
qos_rv | rres_attach_task (server_t *srv, struct task_struct *task) |
Attach a task to an existing (possibly empty) server. | |
qos_rv | rres_detach_task (server_t *srv, struct task_struct *task) |
Detach specified task from its own RRES server. | |
qos_rv | rres_destroy_server (server_t *rres) |
Destroy the specified server. | |
qos_rv | rres_cleanup_server (server_t *rres) |
Cleanup the specified server, which must already be empty. | |
qos_rv | rres_check_destroy (server_t *srv) |
Check if server empty and, if appropriate for the server flags, destroy it. | |
server_t * | rres_find_by_id (qres_sid_t sid) |
Return the pointer to the server with identification number "id". | |
qres_sid_t | rres_get_sid (server_t *rres) |
Returns a server unique identifier. | |
qos_rv | rres_set_params (server_t *rres, qres_time_t budget, qres_time_t period) |
Set budget and period of RRES server (us). | |
qos_rv | rres_get_params (server_t *rres, qres_time_t *budget, qres_time_t *period) |
Get RRES scheduling params (us). | |
qos_rv | rres_set_budget (server_t *rres, qres_time_t budget) |
Set budget of RRES server (us). | |
static qres_time_t | rres_get_curr_budget (server_t *srv) |
Get remaining budget for the current server instance (us). | |
qres_time_t | rres_get_period (server_t *rres) |
Get RRES server period (us). | |
static qos_rv | rres_get_deadline (server_t *rres, struct timespec *p_deadline) |
Get RRES current deadline (timespec). | |
static unsigned long | rres_get_flags (server_t *rres) |
Get RRES server flags. | |
qres_time_t | rres_get_exec_time (server_t *rres) |
Get execution time since server creation (clocks). | |
server_t * | rres_get_default_server (void) |
Get pointer to default server. | |
qos_rv | rres_init_default_server (server_t *srv, qres_time_t Q, qres_time_t P, unsigned long flags) |
Initialize the default server. | |
int | rres_has_server (struct task_struct *t) |
returns true if the task is served by any server | |
int | rres_empty (server_t *srv) |
return true if the server has no task to serve | |
int | rres_running (server_t *srv) |
Check if the server is currently running. | |
static struct task_struct * | rres_any_ready_task (server_t *srv) |
Just return one of the attached ready tasks, or NULL if none exists. | |
static struct task_struct * | rres_any_blocked_task (server_t *srv) |
Just return one of the attached blocked tasks, or NULL if none exists. | |
static kal_lock_t * | rres_get_spinlock (void) |
static server_t * | rres_find_by_task (struct task_struct *task) |
Return the pointer to the server the task belong to. | |
qos_rv | rres_init_server (server_t *p_server, server_params_t *p_params) |
Initialize an already allocated server_t (or derived class). | |
qos_rv | rres_get_params (server_t *p_server, server_params_t *p_params) |
Get RRES scheduling params. | |
qos_rv | rres_set_params (server_t *p_server, server_params_t *p_params) |
Set RRES scheduling params. | |
qos_rv | _rres_cleanup_server (server_t *srv) |
Non-virtual server destructor. | |
qos_bw_t | _rres_get_bandwidth (server_t *srv) |
Non-virtual bandwidth retrieval function. | |
int | rres_has_ready_tasks (server_t *srv) |
static qos_bw_t | rres_get_bandwidth (server_t *srv) |
Return the approved bandwidth for the server. | |
static qos_bw_t | rres_set_current_bandwidth (server_t *srv, qos_bw_t U_approved) |
This function sets the current bandwidth U_current as specified in the supplied parameter, updating the global variables U_tot and U_active_tot. | |
static qos_bw_t | rres_update_current_bandwidth (server_t *srv) |
static qos_bw_t | rres_get_current_bandwidth (server_t *srv) |
Return the current bandwidth allocated to the server. | |
int | rres_proc_register (void) |
void | rres_proc_unregister (void) |
kal_define_eheap (kal_time_t, server_p) | |
typedef | kal_eheap_iterator_t (kal_time_t, server_p) rq_placeholder_t |
Ready queue placeholder, useful for being embedded within an enqueued item for subsequenct extraction. | |
kal_eheap_t (kal_time_t, server_p) eheap | |
Heap of ready servers, min-ordered by abs deadline. | |
static server_t * | get_highest_priority_server (void) |
return a pointer to the highest priority server (the first of EDF queue) | |
static int | ready_queue_empty (void) |
return true if the ready queue is empty (no ready server in the system) | |
static int | srv_alone (server_t *srv) |
return true if the server is the only ready server in the system | |
static int | in_ready_queue (server_t *srv) |
return true if the server is in ready queue | |
static void | ready_queue_remove (server_t *srv) |
Remove the server from ready queue. | |
static qos_rv | rres_edf_init (void) |
static void | rres_edf_cleanup (void) |
static qos_rv | ready_queue_add (server_t *srv) |
Add the server to ready queue, ordered by deadline (EDF). | |
static void | rres_set_weight (server_t *srv, unsigned int weight) |
Set the user-supplied server weight, that may be used by some scheduling policies (i.e., shrub). | |
static unsigned int | rres_get_weight (server_t *srv) |
static long long | llimd (long long ll, int mult, int div) |
static unsigned long long int | us2clock (unsigned long u) |
static unsigned long int | clock2ms (unsigned long long c) |
static unsigned long int | clock2us (unsigned long long c) |
static unsigned long int | clock2jiffies (unsigned long long c) |
static unsigned long long | sched_read_clock (void) |
static unsigned long | sched_read_clock_us (void) |
static void | rres_init_time (void) |
static void | rres_sample_time (void) |
Sample the current time, with the best available precision, into sched_time. | |
static unsigned long int | clock2subjiffies (unsigned long long c) |
static void | list_del_null (struct list_head *entry) |
Remove from list and set to NULL pointers that point to next and previous objects. | |
Variables | |
spinlock_t generic_scheduler_lock | __cacheline_aligned |
used for spinlock on hook handlers and timer handler | |
struct list_head | server_list |
list of the servers | |
kal_time_t | last_update_time |
time of last budget updating | |
spinlock_t | rres_lock |
struct proc_dir_entry * | qres_proc_root |
pointer to qres proc_fs root directory (/proc/qres) | |
struct list_head | ready_queue |
List of ready servers, min-ordered by abs deadline. | |
qos_bw_t | U_tot |
Total allocated bandwidth. | |
kal_time_t | sched_time |
used to avoid reading too frequently the time. | |
unsigned int | cpu_khz |
unsigned | fast_gettimeoffset_quotient |
Provides CPU resource reservations into the kernel through a kernel API.
Provides CPU core resource reservations into the kernel through a kernel API.
#define CPU_KHZ_TYPE unsigned long |
Definition at line 22 of file rres_time.h.
#define do_gettimeofday | ( | __tv | ) | gettimeofday((__tv), NULL); |
Definition at line 33 of file rres_time.h.
#define for_each_blocked_task_in_server | ( | __srv, | |||
t, | |||||
pos | ) |
#define for_each_blocked_task_in_server_safe | ( | __srv, | |||
t, | |||||
__pos, | |||||
__tmp | ) |
#define for_each_ready_server | ( | srv, | |||
pos | ) | for_each_srv((srv), &ready_queue, rq_ph, (pos)) |
iterate over ready server list
srv,: | (server_t *) variable for "current" server (used inside the loop) pos: (rq_placeholder_t *) temporal variable used to iterate (not used in following loop block) |
Definition at line 44 of file rres_ready_queue_list.h.
#define for_each_ready_server | ( | srv, | |||
p_it | ) |
for ( \ kal_eheap_begin(&eheap, (p_it)); \ kal_eheap_next(&eheap, (p_it), NULL, &(srv)) == QOS_OK); \ /* Increment not necessary, already made by kal_eheap_next */ \ )
iterate over ready server list
srv,: | (server_t *) variable for "current" server (used inside the loop) p_it: (rq_placeholder_t *) temporal variable used to iterate (not used in following loop block) |
Definition at line 51 of file rres_ready_queue_eheap.h.
#define for_each_ready_task_in_server | ( | __srv, | |||
t, | |||||
pos | ) |
for ((pos) = (__srv)->ready_tasks.next, prefetch((pos)->next); \ (t) = (list_entry((pos), struct task_list, node))->task, (pos) != &((__srv)->ready_tasks); \ (pos) = (pos)->next, prefetch((pos)->next))
Loop on all tasks in a server (do not modify the list).
__srv | (server_t *) server that contains the list of tasks | |
t | (struct task_struct *) pointer to "current" task in iteration | |
pos | (list_head *) temporary variable used for iteration |
Definition at line 122 of file rres.h.
Referenced by rres_dispatch(), and rres_stop().
#define for_each_ready_task_in_server_safe | ( | __srv, | |||
t, | |||||
__pos, | |||||
__tmp | ) |
for ((__pos) = (__srv)->ready_tasks.next, __tmp = (__pos)->next; \ (t) = (list_entry((__pos), struct task_list, node))->task, (__pos) != &((__srv)->ready_tasks); \ (__pos) = (__tmp), __tmp = (__pos)->next)
Loop on all tasks in a server.
use this instead of for_each_task_in_server() if you need to modify the list (adding or removing an entry)
__srv | (server_t *) server that contains the list of tasks | |
t | (struct task_struct *) pointer to "current" task in iteration | |
pos | (list_head *) temporary variable used for iteration |
#define for_each_server | ( | srv, | |||
pos | ) | for_each_srv((srv), &server_list, slist, (pos)) |
Iterate over all servers in the system.
srv | (server_t *) variable for "current" server (used inside the loop) | |
pos | (struct list_head *) temporal variable used to iterate (not used in following loop block) |
Definition at line 103 of file rres.h.
Referenced by qres_update_bandwidths(), rres_find_by_id(), and update_budgets().
#define for_each_server_safe | ( | srv, | |||
pos, | |||||
tmppos | ) | for_each_srv_safe((srv), &server_list, slist, (pos), (tmppos)) |
Iterate over all servers in the system - safe against removal.
srv | (server_t *) variable for "current" server (used inside the loop) | |
pos | (struct list_head *) temporal variable used to iterate (not used in following loop block) | |
tmppos | (struct list_head *) temporal variable used to store temporarily the pos variable used during removal |
Definition at line 110 of file rres.h.
Referenced by qres_cleanup(), and rres_cleanup().
#define for_each_srv | ( | srv, | |||
head, | |||||
list_field, | |||||
pos | ) |
for ((pos) = (head)->next, prefetch((pos)->next); \ (srv) = (list_entry((pos), server_t, list_field)), (pos) != (head); \ (pos) = (pos)->next, prefetch((pos)->next))
Macro used by for_each_*_server to iterate over a server list.
srv | (server_t *) variable for "current" server (used inside the loop) | |
head | (struct list_head *) head of the list of servers (ready, recharging etc.) | |
list_field | ("name of field") name of field used to insert the object in the list(e.g. slist) | |
pos | (struct list_head *) temporal variable used to iterate (not used in following loop block) |
#define for_each_srv_safe | ( | srv, | |||
head, | |||||
list_field, | |||||
pos, | |||||
postmp | ) |
for (pos = (head)->next, postmp = pos->next; \ (srv) = (list_entry((pos), server_t, list_field)), pos != (head); \ pos = postmp, postmp = pos->next)
Macro used against removal risks to iterate over the server list.
srv | (server_t *) variable for "current" server (used inside the loop) | |
head | (struct list_head *) head of the list of servers (ready, recharging etc.) list_field ("name of field") name of field used to insert the object in the list(e.g. slist) | |
pos | (struct list_head *) temporal variable used to iterate (not used in following loop block) | |
tmppos | (struct list_head *) temporal variable used to store temporarily the pos variable used during removal |
#define GENSCHED_DISABLED 1024 |
state of a task that is forced to be descheduled
Definition at line 26 of file rres_dispatch_gsd_2.6.h.
#define get_task_entry | ( | h | ) | list_entry((h), struct task_list, others) |
#define INIT_LIST_HEAD_NULL | ( | ptr | ) | do { (ptr)->prev = NULL; (ptr)->next = NULL; } while (0) |
Definition at line 18 of file rres_utils.h.
#define kal_eheap_key_lt kal_time_lt |
Definition at line 16 of file rres_ready_queue_eheap.h.
#define list_add_ordered | ( | head, | |||
obj_type, | |||||
obj, | |||||
list_field, | |||||
ord_field, | |||||
ret | ) |
do { \ struct list_head *h; \ if (list_empty(&head)) { \ list_add(&((obj)->list_field ), &(head)); \ goto __ret1; \ } else { \ for (h = (head).next; h != &(head); h = h->next) { \ if ((list_entry(h, struct obj_type, list_field)->ord_field) > (obj)->ord_field) { \ break; \ } \ } \ list_add_tail(&((obj)->list_field), h); \ } \ if (&((obj)->list_field) == (head).next) { \ goto __ret1; \ } \ (ret) = 0; \ break; \ __ret1: \ (ret) = 1; \ } while (0)
add an object in an ordered list insert in the (head) list the (obj) of type (obj_type), ordered in increasing order by field (ord_field) of (obj) example list_add_ordered (ready_list, server_t, srv, rq_ph, deadline, ret) NOTE: in the parameters description "" are used for argument that are name and not variables.
head,: | (struct list_head * ) head of the list obj_type: ("object type") type of each element of the list obj: (obj_type object) object that must be added to the list list_field: ("name of field") name of field used to insert the object in the list ord_field: ("name of filed") name of filed the list is ordered by ret: (int) return value is put here return 1 if the object is inserted at the beginning of the list return 0 otherwise |
Definition at line 35 of file rres_utils.h.
#define MIN_SRV_MAX_BUDGET 0LU |
usec.
Minimum allowed server budget (HRT)
Definition at line 28 of file rres_interface.h.
Referenced by qos_func_define(), and rres_init_server().
#define MIN_SRV_PERIOD 1000LU |
usec.
Minimum allowed server period (HRT)
Definition at line 27 of file rres_interface.h.
Referenced by qos_func_define(), and rres_init_server().
#define MIN_SRV_PERIOD_DEBUG 200000LU |
usec.
Minimum allowed server period while debugging
Definition at line 34 of file rres_interface.h.
Referenced by rres_init_server().
#define QOS_DEBUG_LEVEL RRES_MOD_DEBUG_LEVEL |
Definition at line 25 of file rres_dispatch_new.c.
#define QOS_F_DEFAULT 0x00000001 |
The server to create is the default one.
Definition at line 31 of file rres_kpi_core.h.
#define QOS_F_SOFT 0x00000002 |
Server tasks are scheduled within the reservation, and also by Linux outside.
Definition at line 38 of file rres_kpi_core.h.
#define qos_log_state | ( | __t | ) | qos_log_debug("(%d), state: %ld, prio: %d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task
Definition at line 29 of file rres_dispatch_gsd_2.4.h.
#define qos_log_state | ( | __t | ) | qos_log_debug("(%d), state: %ld, prio: %d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task
Definition at line 12 of file rres_dispatch.h.
#define qos_log_state_simple | ( | __t | ) | qos_log_simple(QOS_DEBUG_LEVEL, "(%d),s:%ld, p:%d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task (without any other debug info)
Definition at line 32 of file rres_dispatch_gsd_2.4.h.
#define qos_log_state_simple | ( | __t | ) | qos_log_simple(QOS_DEBUG_LEVEL, "(%d),s:%ld, p:%d", (__t)->pid, (__t)->state, (int)(__t)->rt_priority) |
print the state of the task (without any other debug info)
Definition at line 15 of file rres_dispatch.h.
#define rq_placeholder_init | ( | p_list_head | ) | INIT_LIST_HEAD_NULL(p_list_head) |
Inititalize a ready queue placeholder as invalid (item not enqueued).
Definition at line 30 of file rres_ready_queue_list.h.
#define rq_placeholder_init | ( | p_it | ) | kal_eheap_iterator_init(p_it) |
Inititalize a ready queue placeholder as invalid (item not enqueued).
Definition at line 33 of file rres_ready_queue_eheap.h.
Referenced by rres_init_server().
#define RRES_DISPATCH_PRIORITY 65 |
priority to force linux scheduling
Definition at line 27 of file rres_dispatch_gsd_2.6.h.
#define rres_init_sched_param | ( | task | ) |
Definition at line 27 of file rres_dispatch_sig.h.
#define rres_init_sched_param | ( | task | ) | set_task_rr_prio(task, RRES_DISPATCH_PRIORITY) |
Definition at line 36 of file rres_dispatch_new.h.
#define rres_init_sched_param | ( | task | ) | set_task_rr_prio(task, RRES_DISPATCH_PRIORITY) |
Definition at line 39 of file rres_dispatch_gsd_2.6.h.
Referenced by dispatch_task_safe(), and rres_attach_task_nosched().
#define RRES_MAX_NUM_SERVERS (1 << RRES_MAX_NUM_SERVERS_BITS) |
Definition at line 30 of file rres_ready_queue_eheap.h.
#define RRES_MAX_NUM_SERVERS_BITS 12 |
Definition at line 29 of file rres_ready_queue_eheap.h.
#define rres_task_sched_default | ( | task | ) |
Definition at line 30 of file rres_dispatch_sig.h.
#define rres_task_sched_default | ( | task | ) | set_task_rr_prio(task, -1) |
Definition at line 39 of file rres_dispatch_new.h.
#define rres_task_sched_default | ( | task | ) |
do { \ if (task->state == GENSCHED_DISABLED) \ task->state = TASK_RUNNING; \ set_task_rr_prio(task, -1); \ } while (0)
Definition at line 42 of file rres_dispatch_gsd_2.6.h.
Referenced by rres_detach_task_nosched(), and stop_task_safe().
#define SCHED_OTHER SCHED_NORMAL |
Definition at line 33 of file rres_dispatch_sig.h.
#define SCHED_OTHER SCHED_NORMAL |
Definition at line 42 of file rres_dispatch_new.h.
#define SCHED_OTHER SCHED_NORMAL |
Definition at line 45 of file rres_dispatch_new.c.
#define SCHED_OTHER SCHED_NORMAL |
Definition at line 24 of file rres_dispatch_gsd_2.4.h.
Referenced by main().
#define set_tsk_need_resched | ( | task | ) | do { task->need_resched = 1; } while (0) |
force to call the linux scheduler
Definition at line 38 of file rres_dispatch_gsd_2.4.h.
#define STOP_PRIORITY -2100 |
priority to force linux descheduling
Definition at line 26 of file rres_dispatch_gsd_2.4.h.
#define U_LUB2 (U_LUB+r2bw_c(1,100)) |
This adds a tolerance to U_LUB as defined for QRES/QSUP, so to avoid that RRESMOD notifies a system overload when QRES/QSUP do not.
Definition at line 73 of file rres_server.h.
Referenced by rres_init_server(), rres_set_budget(), rres_set_current_bandwidth(), and rres_set_params().
typedef struct list_head rq_placeholder_t |
Ready queue placeholder, useful for being embedded within an enqueued item for subsequenct extraction.
Definition at line 22 of file rres_ready_queue_list.h.
Avoids circular dependencies.
Definition at line 17 of file rres_ready_queue.h.
typedef struct server_params_t server_params_t |
Definition at line 63 of file rres_server.h.
Non-virtual server destructor.
Definition at line 855 of file rres.c.
References server_t::id, in_ready_queue(), qos_chk, qos_chk_do, QOS_E_INTERNAL_ERROR, qos_log_crit, qos_log_debug, QOS_OK, QRES_SID_FMT, QRES_TIME_FMT, ready_queue_remove(), rres_empty(), rres_get_default_server(), rres_get_exec_time(), RRES_PARANOID, rres_remove_from_srv_set(), rres_running(), rres_sample_time(), rres_set_current_bandwidth(), and stop_pending_timers().
Referenced by qos_func_define(), and rres_init_server().
Non-virtual bandwidth retrieval function.
Non-virtual bandwidth retrieval function.
Definition at line 188 of file rres.c.
References server_t::max_budget_us, server_t::period_us, and r2bw().
Referenced by _qres_get_bandwidth(), qos_func_define(), and rres_init_server().
void activate_task_local | ( | struct task_struct * | task | ) |
void activate_task_local | ( | kal_task_t * | task | ) |
Referenced by dispatch_task().
int check_gensched_hooks | ( | void | ) |
Return true if hooks are not initialised.
Definition at line 173 of file rres_hooks.c.
References block_hook, cleanup_hook, continue_hook, fork_hook, stop_hook, and unblock_hook.
Referenced by rres_init_module().
static unsigned long int clock2jiffies | ( | unsigned long long | c | ) | [inline, static] |
Definition at line 42 of file rres_timeOLD.h.
References fast_gettimeoffset_quotient, and llimd().
static unsigned long int clock2ms | ( | unsigned long long | c | ) | [inline, static] |
Definition at line 32 of file rres_timeOLD.h.
References fast_gettimeoffset_quotient, and llimd().
static unsigned long int clock2subjiffies | ( | unsigned long long | c | ) | [inline, static] |
Definition at line 50 of file rres_timeOLD.h.
References cpu_khz, fast_gettimeoffset_quotient, and llimd().
static unsigned long int clock2us | ( | unsigned long long | c | ) | [inline, static] |
Definition at line 37 of file rres_timeOLD.h.
References fast_gettimeoffset_quotient.
void deactivate_task_local | ( | struct task_struct * | task | ) |
void deactivate_task_local | ( | kal_task_t * | task | ) |
Referenced by stop_task().
void dispatch_task | ( | kal_task_t * | t | ) |
Allow the Linux scheduler to schedule this task.
Definition at line 65 of file rres_dispatch_new.c.
References activate_task_local(), and qos_log_debug.
static void dispatch_task | ( | struct task_struct * | t | ) | [inline] |
Force Linux to schedule this task (or one of the task of the same server).
Allow the Linux scheduler to schedule this task.
Definition at line 42 of file rres_dispatch_sig.h.
Referenced by dispatch_task_safe().
void dispatch_task_safe | ( | server_t * | srv, | |
struct task_struct * | task | |||
) |
static server_t * get_highest_priority_server | ( | void | ) | [inline, static] |
return a pointer to the highest priority server (the first of EDF queue)
Definition at line 33 of file rres_ready_queue_list.h.
References ready_queue.
Referenced by rres_schedule().
static int in_ready_queue | ( | server_t * | srv | ) | [inline, static] |
return true if the server is in ready queue
Definition at line 58 of file rres_ready_queue_list.h.
Referenced by _rres_cleanup_server(), ready_queue_add(), ready_queue_remove(), rres_deactivate_nosched(), rres_update_budget(), and update_budgets().
static qos_bool_t is_default_server | ( | server_t * | srv | ) | [inline, static] |
It returns true if the server is the default server.
Definition at line 160 of file rres.h.
Referenced by rres_dispatch(), and rres_stop().
static qos_bool_t is_in_default_server | ( | struct task_struct * | t | ) | [inline, static] |
Check if the task is served by the default server.
Definition at line 151 of file rres.h.
References rres_find_by_task().
kal_define_eheap | ( | kal_time_t | , | |
server_p | ||||
) |
typedef kal_eheap_iterator_t | ( | kal_time_t | , | |
server_p | ||||
) |
Ready queue placeholder, useful for being embedded within an enqueued item for subsequenct extraction.
kal_eheap_t | ( | kal_time_t | , | |
server_p | ||||
) |
Heap of ready servers, min-ordered by abs deadline.
static void kal_force_reschedule | ( | void | ) | [inline, static] |
Definition at line 17 of file rres_dispatch.h.
References set_tsk_need_resched.
Referenced by rres_schedule().
static void list_del_null | ( | struct list_head * | entry | ) | [inline, static] |
Remove from list and set to NULL pointers that point to next and previous objects.
Definition at line 59 of file rres_utils.h.
static long long llimd | ( | long long | ll, | |
int | mult, | |||
int | div | |||
) | [inline, static] |
Definition at line 74 of file rres_timeOLD.h.
Add the server to ready queue, ordered by deadline (EDF).
Definition at line 83 of file rres_ready_queue_list.h.
References DUMP_STACK, server_t::id, in_ready_queue(), list_add_ordered, qos_log_crit, qos_log_debug, QOS_OK, ready_queue, and ready_queue_remove().
Referenced by iris_hr_reactive_timer_handler(), and rres_activate_nosched().
static int ready_queue_empty | ( | void | ) | [inline, static] |
return true if the ready queue is empty (no ready server in the system)
Definition at line 48 of file rres_ready_queue_list.h.
References ready_queue.
static void ready_queue_remove | ( | server_t * | srv | ) | [static] |
Remove the server from ready queue.
Definition at line 63 of file rres_ready_queue_list.h.
References server_t::id, in_ready_queue(), list_del_null(), qos_chk_do, qos_log_debug, and server_t::rq_ph.
Referenced by _rres_cleanup_server(), ready_queue_add(), rres_deactivate_nosched(), and rres_update_budget().
void recharge | ( | server_t * | srv | ) |
Recharge the budget and update the deadline to the old value plus the server period.
Definition at line 258 of file rres.c.
References bw2Q(), server_t::c, server_t::deadline, server_t::id, kal_time_add(), KAL_TIME_FMT, KAL_TIME_FMT_ARG, kal_time_le(), kal_usec2time(), server_t::max_budget, server_t::rres_stat::n_rcg, server_t::period, server_t::period_us, QOS_BW_FMT, qos_log_debug, qos_log_warn, rres_update_current_bandwidth(), sched_time, server_t::stat, and U_tot.
Referenced by iris_hr_reactive_timer_handler(), and recharge_reset_from_now().
void recharge_reset_from_now | ( | server_t * | srv | ) |
recharge the budget and set the deadline to the actual time plus the server period
recharge the budget and set the deadline to the actual time plus the server period
Definition at line 283 of file rres.c.
References server_t::c, server_t::deadline, KAL_TIME_US, recharge(), and sched_time.
Referenced by rres_activate_nosched(), and rres_init_server().
static struct task_struct* rres_any_blocked_task | ( | server_t * | srv | ) | [static, read] |
Just return one of the attached blocked tasks, or NULL if none exists.
Definition at line 181 of file rres_interface.h.
References server_t::blocked_tasks, task_list::node, qos_chk_do, qos_mem_valid(), RRES_PARANOID, and task_list::task.
Referenced by qos_func_define(), rres_destroy_server(), and rres_detach_all_tasks_nosched().
static struct task_struct* rres_any_ready_task | ( | server_t * | srv | ) | [static, read] |
Just return one of the attached ready tasks, or NULL if none exists.
Definition at line 170 of file rres_interface.h.
References task_list::node, qos_chk_do, qos_mem_valid(), server_t::ready_tasks, RRES_PARANOID, and task_list::task.
Referenced by qos_func_define(), rres_destroy_server(), and rres_detach_all_tasks_nosched().
Attach a task to an existing (possibly empty) server.
Check if server empty and, if appropriate for the server flags, destroy it.
This must be explicitly called after any call to functions that may detach tasks from a server leaving it empty, e.g. rres_detach_server(), rres_move(), rres_detach_all_tasks(), in order to enforce non-persistent servers semantics.
Check if server empty and, if appropriate for the server flags, destroy it.
This includes calling rres_schedule() afterwards.
Definition at line 635 of file rres.c.
References server_t::flags, qos_chk_ok_ret, QOS_F_PERSISTENT, QOS_OK, rres_destroy_server(), and rres_empty().
Referenced by qos_func_define(), and rres_cleanup_hook().
qos_rv rres_cleanup | ( | void | ) |
Destroy all servers in the system.
This is used before unloading the rres module. Servers are destroyed through calls to the rres_destroy_server() function, that performs a virtual call to the destructor using the rres->cleanup() pointer.
Definition at line 1288 of file rres.c.
References for_each_server_safe, server_t::id, kal_timer_del(), qos_free(), QOS_LEVEL_VERB, qos_log, QOS_OK, rres_destroy_server(), and rres_edf_cleanup().
Referenced by rres_cleanup_module(), and rres_init_module().
Detach all the tasks served by the default server and cleanup the server.
void rres_cleanup_module | ( | void | ) |
Cleanup rres module.
Cleanup rres module.
This part of code is mutually exclusive with other rres*.c parts, even if it uses hook_lock instead of rres_lock.
Definition at line 148 of file rres_init.c.
References hook_lock, qos_chk_ok, qos_log_debug, qos_log_err, qos_log_info, qos_mem_clean(), rres_cleanup(), rres_get_spinlock(), rres_mod_removed, rres_proc_unregister(), and unset_gensched_hooks().
Cleanup the specified server, which must already be empty.
Uninitialize an already allocated server_t, without deallocating it.
Any resource associated to the server pointed to by rres parameter, except the server_t struct itself, is deallocated.
Definition at line 75 of file rres_server.h.
References server_t::cleanup, qos_chk_do, QOS_E_INTERNAL_ERROR, and RRES_PARANOID.
Referenced by rres_destroy_server().
qos_rv rres_create_server | ( | server_t ** | new_srv, | |
qres_time_t | max_budget, | |||
qres_time_t | period, | |||
unsigned long | type | |||
) |
Create a new server for task t.
It performs extra operation with respect to rres_create_server if the task is already served by an existing server.
max_budget and period are expressed in usecs.
Create a new server for task t.
It is not schedulable so the scheduler must not be called
Definition at line 896 of file rres.c.
References qos_chk_do, qos_chk_ok_ret, qos_chk_rv, qos_create, QOS_E_INTERNAL_ERROR, QOS_E_NO_MEMORY, QOS_OK, rres_init_server(), and RRES_PARANOID.
Referenced by test_rres_init_module().
Destroy the specified server.
All attached tasks are detached and return to the default scheduling policy. Any resource associated to the server pointed to by rres parameter, including the server_t struct itself, is deallocated.
Definition at line 909 of file rres.c.
References qos_chk_do, qos_chk_ok_ret, QOS_E_INTERNAL_ERROR, QOS_E_INVALID_PARAM, qos_free(), QOS_OK, rres_any_blocked_task(), rres_any_ready_task(), rres_cleanup_server(), rres_detach_task(), RRES_PARANOID, and task_list::task.
Referenced by qos_func_define(), rres_check_destroy(), rres_cleanup(), and test_rres_init_module().
Detach specified task from its own RRES server.
Do not automatically destroy the server if it becomes empty.
void rres_dispatch | ( | server_t * | srv | ) |
Dispatch (force scheduling) of all tasks handled by the server.
Definition at line 1143 of file rres.c.
References dispatch_task_safe(), for_each_ready_task_in_server, server_t::id, is_default_server(), qos_log_debug, qos_log_err, RRES_DISPATCH_PRIORITY, and rres_empty().
Referenced by rres_schedule().
static void rres_dispatch_setup | ( | server_t * | srv | ) | [inline, static] |
Definition at line 58 of file rres_dispatch_gsd_2.4.h.
static void rres_edf_cleanup | ( | void | ) | [inline, static] |
Definition at line 77 of file rres_ready_queue_list.h.
References qos_chk, and ready_queue.
Referenced by rres_cleanup().
static qos_rv rres_edf_init | ( | void | ) | [inline, static] |
Definition at line 72 of file rres_ready_queue_list.h.
References QOS_OK, and ready_queue.
Referenced by rres_init().
int rres_empty | ( | server_t * | srv | ) |
return true if the server has no task to serve
Return true is the specified server has no attached tasks.
return true if the server has no task to serve
Return true is the specified server has no attached tasks.
Definition at line 112 of file rres.c.
References server_t::blocked_tasks, and server_t::ready_tasks.
Referenced by _rres_cleanup_server(), iris_hr_reactive_timer_handler(), rres_check_destroy(), rres_cleanup_hook(), rres_detach_task(), rres_dispatch(), rres_schedule(), and rres_stop().
server_t* rres_find_by_id | ( | qres_sid_t | sid | ) |
Return the pointer to the server with identification number "id".
Return NULL if no server with the specified id is found.
Return the pointer to the server with identification number "id".
Return the pointer to the server with the specified server id, or NULL if not found.
Definition at line 144 of file rres.c.
References for_each_server, server_t::id, QRES_SID_NULL, rres_find_by_task(), and srv.
Referenced by new_server_id(), qres_find_by_id(), and test_rres_init_module().
static server_t* rres_find_by_task | ( | struct task_struct * | task | ) | [inline, static] |
Return the pointer to the server the task belong to.
static server_t* rres_find_by_task | ( | kal_task_t * | task | ) | [inline, static] |
Return the pointer to the server the task is attached to, or NULL.
Definition at line 41 of file rres_interface.h.
References rres_find_task_list(), and task_list::srv.
Referenced by is_in_default_server(), qos_func_define(), qres_attach_data_to_task(), qres_retrieve_from_task(), rres_attach_all_tasks_nosched(), rres_attach_task(), rres_attach_task_nosched(), rres_cleanup_hook(), rres_detach_task(), rres_find_by_id(), rres_fork_hook(), rres_has_server(), rres_move_nosched(), and test_rres_init_module().
static struct task_list* rres_find_task_list | ( | kal_task_t * | task | ) | [static, read] |
Definition at line 36 of file rres_interface.h.
Referenced by dispatch_task_safe(), rres_del(), rres_find_by_task(), rres_on_task_block(), rres_on_task_unblock(), rres_stop(), and stop_task_safe().
Return the approved bandwidth for the server.
Definition at line 39 of file rres_kpi_protected.h.
References server_t::get_bandwidth.
Referenced by qos_func_define(), qres_update_bandwidths(), rres_get_actual_budget(), rres_get_params(), and rres_update_current_bandwidth().
static qres_time_t rres_get_curr_budget | ( | server_t * | srv | ) | [inline, static] |
Get remaining budget for the current server instance (us).
Definition at line 120 of file rres_interface.h.
References server_t::c, and kal_time2usec().
Referenced by qos_func_define().
Return the current bandwidth allocated to the server.
This is the value that is going to be used for the very next server instance, and its value is updated by the rres_update_current_bandwidth() function.
Definition at line 74 of file rres_kpi_protected.h.
References server_t::U_current.
Referenced by qos_func_define().
Get RRES current deadline (timespec).
Definition at line 128 of file rres_interface.h.
References server_t::deadline, kal_time2timespec(), and QOS_OK.
Referenced by qos_func_define().
server_t* rres_get_default_server | ( | void | ) |
Get pointer to default server.
Return NULL if default server is not configured
Get pointer to default server.
Return NULL if default server is not configured
Definition at line 1083 of file rres.c.
Referenced by _rres_cleanup_server(), rres_attach_task_nosched(), rres_detach_task(), rres_detach_task_nosched(), rres_init_server(), rres_on_task_block(), and rres_on_task_unblock().
qres_time_t rres_get_exec_time | ( | server_t * | rres | ) |
Get execution time since server creation (clocks).
Get execution time since server creation (clocks).
If srv is the currently running server, then include in the result the elapsed time since the last recharge as well.
Definition at line 1066 of file rres.c.
References server_t::rres_stat::exec_time, kal_time2usec(), kal_time_add(), kal_time_now(), kal_time_sub(), last_update_time, qos_chk_do, QOS_LEVEL_ERROR, qos_log, RRES_PARANOID, and server_t::stat.
Referenced by _rres_cleanup_server(), and qos_func_define().
static unsigned long rres_get_flags | ( | server_t * | rres | ) | [inline, static] |
qos_rv rres_get_params | ( | server_t * | p_server, | |
server_params_t * | p_params | |||
) |
Get RRES scheduling params.
qos_rv rres_get_params | ( | server_t * | srv, | |
qres_time_t * | budget, | |||
qres_time_t * | period | |||
) |
Get RRES scheduling params (us).
Definition at line 1035 of file rres.c.
References bw2Q(), server_t::id, server_t::period_us, qos_chk_do, QOS_E_INTERNAL_ERROR, qos_log_debug, QOS_OK, QRES_TIME_FMT, rres_get_bandwidth(), and RRES_PARANOID.
qres_time_t rres_get_period | ( | server_t * | srv | ) |
Get RRES server period (us).
Get RRES server period (us).
Definition at line 1055 of file rres.c.
References server_t::period_us.
Referenced by qres_update_bandwidths().
qres_sid_t rres_get_sid | ( | server_t * | srv | ) |
Returns a server unique identifier.
Returns a server unique identifier.
Definition at line 951 of file rres.c.
References server_t::id, and QRES_SID_NULL.
Referenced by qos_func_define().
static kal_lock_t* rres_get_spinlock | ( | void | ) | [inline, static] |
Definition at line 193 of file rres_interface.h.
References rres_lock.
Referenced by enforce_timer_handler(), iris_hr_reactive_timer_handler(), my_init_module(), qres_cleanup_module(), qres_get_lock(), qres_init_module(), qsup_gw_ks(), rres_block_hook(), rres_cleanup_hook(), rres_cleanup_module(), rres_fork_hook(), rres_init_module(), rres_read_qsup(), rres_unblock_hook(), and test_rres_init_module().
static unsigned int rres_get_weight | ( | server_t * | srv | ) | [inline, static] |
Definition at line 88 of file rres_server.h.
References server_t::weight.
Referenced by qos_func_define().
int rres_has_ready_tasks | ( | server_t * | srv | ) |
Definition at line 514 of file rres.c.
References qos_chk_do, server_t::ready_tasks, and RRES_PARANOID.
Referenced by iris_hr_reactive_timer_handler(), qos_func_define(), rres_activate_nosched(), rres_attach_task_nosched(), rres_cleanup_hook(), rres_deactivate_nosched(), rres_detach_task_nosched(), rres_on_task_block(), rres_on_task_unblock(), rres_schedule(), rres_set_budget(), rres_set_current_bandwidth(), and rres_set_params().
qos_bool_t rres_has_server | ( | struct task_struct * | t | ) |
returns true if the task is served by any server
static void rres_idle_cpu | ( | void | ) | [inline, static] |
Forces scheduling of the Linux idle task.
Forces scheduling of Linux.
Definition at line 80 of file rres_dispatch_gsd_2.6.h.
References set_tsk_need_resched.
qos_rv rres_init | ( | void | ) |
Initialise server lists, timers, and algorithm related data, then call rres_schedule().
Definition at line 1262 of file rres.c.
References enforce_timer_handler(), kal_timer_init(), last_update_time, qos_chk_do, qos_chk_ok_ret, qos_create, QOS_E_NO_MEMORY, QOS_OK, rres_edf_init(), rres_init_time(), rres_sample_time(), rres_schedule(), sched_time, and server_list.
Referenced by rres_init_module().
qos_rv rres_init_default_server | ( | server_t * | srv, | |
qres_time_t | Q, | |||
qres_time_t | P, | |||
unsigned long | flags | |||
) |
Initialize the default server.
The default server hosts all tasks that do not explicitly use AQuoSA. After this call, all system tasks have been attached to the default server.
srv | Pointer to an already allocated structure of type server_t (or subtype). |
int rres_init_module | ( | void | ) |
Initialise rres module.
Initialise rres module.
This part of code is mutually exclusive with other rres*.c parts, even if it uses hook_lock instead of rres_lock.
ProcFS-related functions may sleep, so no spinlock should be held
Definition at line 73 of file rres_init.c.
References check_gensched_hooks(), hook_lock, qos_log_crit, qos_log_debug, qos_log_err, QOS_OK, rres_cleanup(), rres_get_spinlock(), rres_init(), rres_proc_register(), rres_sample_time(), and set_gensched_hooks().
void rres_init_sched_param | ( | kal_task_t * | task | ) |
Definition at line 37 of file rres_dispatch_new.c.
References RRES_DISPATCH_PRIORITY, and set_task_rr_prio().
void rres_init_sched_param | ( | struct task_struct * | task | ) |
qos_rv rres_init_server | ( | server_t * | p_server, | |
server_params_t * | p_params | |||
) |
Initialize an already allocated server_t (or derived class).
qos_rv rres_init_server | ( | server_t * | srv, | |
qres_time_t | max_budget, | |||
qres_time_t | period, | |||
unsigned long | flags | |||
) |
Initialize an already allocated server_t (or derived class).
Initialize an already allocated server_t (or derived class).
Internal use only It performs checks on parameters max_budget and period are time values expressed in usecs. The server is created empty (with no task attached)
Definition at line 760 of file rres.c.
References _rres_cleanup_server(), _rres_get_bandwidth(), server_t::blocked_tasks, server_t::c, server_t::cleanup, server_t::deadline, server_t::rres_stat::exec_time, server_t::flags, server_t::forbid_reorder, server_t::get_bandwidth, iris_hr_reactive_timer_handler(), kal_time_now(), KAL_TIME_US, kal_timer_init(), kal_usec2time(), server_t::max_budget, server_t::max_budget_us, MAX_BW, MIN_SRV_MAX_BUDGET, MIN_SRV_PERIOD, MIN_SRV_PERIOD_DEBUG, server_t::rres_stat::n_rcg, new_server_id(), server_t::period, server_t::period_us, qos_chk_do, qos_chk_ok_ret, qos_debug_enabled_for, QOS_E_INCONSISTENT_STATE, QOS_E_INTERNAL_ERROR, QOS_E_INVALID_PARAM, QOS_E_SYSTEM_OVERLOAD, QOS_E_UNIMPLEMENTED, QOS_F_DEFAULT, QOS_LEVEL_DEBUG, qos_log_debug, qos_log_err, QOS_OK, qos_return_if_cond, qos_strerror(), QRES_SID_NULL, QRES_TIME_FMT, r2bw(), server_t::reactive, server_t::ready_tasks, recharge_reset_from_now(), server_t::rq_ph, rq_placeholder_init, rres_add_to_srv_set(), rres_attach_all_tasks_nosched(), rres_get_default_server(), RRES_PARANOID, rres_remove_from_srv_set(), rres_sample_time(), rres_set_budget(), server_t::stat, server_t::U_current, U_LUB2, and U_tot.
Referenced by qos_func_define(), and rres_create_server().
static void rres_init_time | ( | void | ) | [inline, static] |
Definition at line 124 of file rres_time.h.
Referenced by rres_init().
Move into the specified server the specified task.
qos_rv rres_on_task_block | ( | struct task_struct * | task | ) |
qos_rv rres_on_task_unblock | ( | struct task_struct * | task | ) |
int rres_proc_register | ( | void | ) |
Definition at line 250 of file rres_proc_fs.c.
Referenced by rres_init_module().
void rres_proc_unregister | ( | void | ) |
Definition at line 251 of file rres_proc_fs.c.
Referenced by rres_cleanup_module().
int rres_running | ( | server_t * | srv | ) |
Check if the server is currently running.
Definition at line 1306 of file rres.c.
Referenced by _rres_cleanup_server(), rres_attach_task_nosched(), rres_cleanup_hook(), rres_detach_task(), and rres_on_task_unblock().
static void rres_sample_time | ( | void | ) | [inline, static] |
Sample the current time, with the best available precision, into sched_time.
Used at every synchronous or asynchronous enter of code flow within rres, in order to avoid too frequent precise reads of the current time.
Definition at line 135 of file rres_time.h.
References KAL_TIME_FMT, KAL_TIME_FMT_ARG, kal_time_now(), and qos_log_debug.
Referenced by _rres_cleanup_server(), enforce_timer_handler(), iris_hr_reactive_timer_handler(), rres_attach_task(), rres_cleanup_hook(), rres_detach_task(), rres_init(), rres_init_module(), rres_init_server(), rres_on_task_block(), and rres_on_task_unblock().
void rres_schedule | ( | void | ) |
Activate the server due to a new job arrival or add a pending request of activation if already active.
Called when a job ends (tasks blocks) if it was the last active task in the server, remove the server from the ready queue Main RRES server scheduling function.
Update budget of currently running server, if any. Select the earliest deadline server and dispatch it.
Activate the server due to a new job arrival or add a pending request of activation if already active.
If a server is executing, then update its budget. Select the earliest deadline server and, if changed:
If the currently executing task does not belong to the last selected server for execution, then ask the system scheduler (e.g. Linux scheduler) to deschedule it.
timer | Timer whose callback we are in while calling this function, or NULL. This is useful for avoiding to stop that timer while from its callback, as some kal_timer implementations may not like it (e.g. hrtimer blocks the kernel in such a case). |
This check makes the task_list->is_blocked flag no more required, as when we deactivate the last active task, we do not rres_stop() the server anymore (that flag was required in order to avoid a task_stop() on a blocked task, in this event).
Definition at line 1200 of file rres.c.
References get_highest_priority_server(), get_max_time_slice(), server_t::id, kal_force_reschedule(), kal_time2usec(), kal_timer_del(), qos_chk, qos_chk_do, qos_log_debug, qos_mem_valid(), rres_dispatch(), rres_dump, rres_empty(), rres_has_ready_tasks(), rres_stop(), rres_update_budget(), sched_time, set_enforce_timer(), and stop_pending_timers().
Referenced by enforce_timer_handler(), iris_hr_reactive_timer_handler(), rres_attach_task(), rres_cleanup_hook(), rres_detach_task(), rres_init(), rres_on_task_block(), and rres_on_task_unblock().
qos_rv rres_set_budget | ( | server_t * | srv, | |
qres_time_t | new_budget | |||
) |
Set budget of RRES server (us).
Set budget of RRES server (us).
Definition at line 1011 of file rres.c.
References server_t::c, server_t::get_bandwidth, kal_time_le(), kal_usec2time(), server_t::max_budget, server_t::max_budget_us, server_t::period_us, qos_chk_do, QOS_E_INTERNAL_ERROR, QOS_E_SYSTEM_OVERLOAD, QOS_OK, r2bw(), rres_has_ready_tasks(), RRES_PARANOID, rres_update_current_bandwidth(), U_LUB2, and U_tot.
Referenced by qres_update_bandwidths(), and rres_init_server().
This function sets the current bandwidth U_current as specified in the supplied parameter, updating the global variables U_tot and U_active_tot.
Definition at line 46 of file rres_kpi_protected.h.
References QOS_BW_FMT, qos_log_debug, rres_has_ready_tasks(), server_t::U_current, U_LUB2, and U_tot.
Referenced by _rres_cleanup_server(), and rres_update_current_bandwidth().
qos_rv rres_set_params | ( | server_t * | p_server, | |
server_params_t * | p_params | |||
) |
Set RRES scheduling params.
qos_rv rres_set_params | ( | server_t * | srv, | |
qres_time_t | new_budget, | |||
qres_time_t | new_period | |||
) |
Set budget and period of RRES server (us).
Set budget and period of RRES server (us).
Admission control is performed on the basis of the total sum of bandwidths as requested through rres_create_server() and rres_set_params(). Actually, the server is assigned a current bandwidth that may generally be lower than the requested value, for at most a time window of duration equal to the greatest server period (in the worst case).
Definition at line 970 of file rres.c.
References bw2Q(), server_t::c, server_t::deadline, server_t::get_bandwidth, server_t::id, kal_time2usec(), kal_time_le(), kal_time_lt(), kal_time_sub(), kal_usec2time(), server_t::max_budget, server_t::max_budget_us, server_t::period, server_t::period_us, qos_chk_do, QOS_E_INTERNAL_ERROR, QOS_E_SYSTEM_OVERLOAD, qos_log_debug, QOS_OK, QRES_TIME_FMT, r2bw(), rres_has_ready_tasks(), RRES_PARANOID, rres_update_current_bandwidth(), sched_time, U_LUB2, and U_tot.
Referenced by qos_func_define(), and test_rres_init_module().
static void rres_set_weight | ( | server_t * | srv, | |
unsigned int | weight | |||
) | [inline, static] |
Set the user-supplied server weight, that may be used by some scheduling policies (i.e., shrub).
Definition at line 84 of file rres_server.h.
References server_t::weight.
Referenced by qos_func_define().
void rres_stop | ( | server_t * | srv | ) |
Stop all tasks handled by the server.
Stop all tasks handled by the server.
The rotation may be disabled by setting the srv->forbid_reorder flag. This is useful while iterating over servers, e.g. while detaching all servers or similar.
Definition at line 1106 of file rres.c.
References for_each_ready_task_in_server, server_t::forbid_reorder, server_t::id, is_default_server(), task_list::node, qos_log_debug, server_t::ready_tasks, RRES_DISPATCH_PRIORITY, rres_empty(), rres_find_task_list(), task_list::srv, and stop_task_safe().
Referenced by rres_schedule().
void rres_task_sched_default | ( | kal_task_t * | task | ) |
Definition at line 41 of file rres_dispatch_new.c.
References set_task_rr_prio().
void rres_task_sched_default | ( | struct task_struct * | task | ) |
Definition at line 64 of file rres_kpi_protected.h.
References rres_get_bandwidth(), and rres_set_current_bandwidth().
Referenced by recharge(), rres_set_budget(), and rres_set_params().
static unsigned long long sched_read_clock | ( | void | ) | [inline, static] |
Definition at line 60 of file rres_timeOLD.h.
static unsigned long sched_read_clock_us | ( | void | ) | [inline, static] |
Definition at line 68 of file rres_timeOLD.h.
References clock2us(), and sched_read_clock().
void set_gensched_hooks | ( | void | ) |
Set scheduler hooks.
This must be called with preemption disabled
Definition at line 162 of file rres_hooks.c.
References block_hook, cleanup_hook, continue_hook, fork_hook, rres_block_hook(), rres_cleanup_hook(), rres_continue_hook(), rres_fork_hook(), rres_stop_hook(), rres_unblock_hook(), stop_hook, and unblock_hook.
Referenced by rres_init_module().
static int srv_alone | ( | server_t * | srv | ) | [inline, static] |
return true if the server is the only ready server in the system
Definition at line 53 of file rres_ready_queue_list.h.
References ready_queue.
void stop_task | ( | kal_task_t * | t | ) |
Make a task not schedulable by the Linux scheduler.
Definition at line 51 of file rres_dispatch_new.c.
References deactivate_task_local(), and qos_log_debug.
static void stop_task | ( | struct task_struct * | t | ) | [inline] |
Make a task not schedulable by Linux scheduler.
Make a task not schedulable by the Linux scheduler.
Definition at line 36 of file rres_dispatch_sig.h.
Referenced by stop_task_safe().
void stop_task_safe | ( | server_t * | srv, | |
struct task_struct * | task | |||
) |
int task_ready | ( | kal_task_t * | task | ) |
return true if task is ready to run (task's state = TASK_RUNNING in Linux)
Definition at line 33 of file rres_dispatch_new.c.
References TASK_RUNNING.
static int task_ready | ( | struct task_struct * | task | ) | [inline] |
return true if task is ready to run (task's state = TASK_RUNNING in Linux)
Definition at line 23 of file rres_dispatch_sig.h.
References TASK_RUNNING.
Referenced by rres_attach_task_nosched(), stop_task_safe(), and tasklist_init().
void unset_gensched_hooks | ( | void | ) |
Unset scheduler hooks.
This must be called with preemption disabled
Definition at line 185 of file rres_hooks.c.
References block_hook, cleanup_hook, continue_hook, fork_hook, stop_hook, and unblock_hook.
Referenced by rres_cleanup_module().
static unsigned long long int us2clock | ( | unsigned long | u | ) | [inline, static] |
Definition at line 27 of file rres_timeOLD.h.
spinlock_t generic_scheduler_lock __cacheline_aligned |
used for spinlock on hook handlers and timer handler
unsigned int cpu_khz |
Definition at line 2 of file test-get-time.c.
Referenced by clock2subjiffies(), and us2clock().
unsigned fast_gettimeoffset_quotient |
Definition at line 3 of file test-get-time.c.
Referenced by clock2jiffies(), clock2ms(), clock2subjiffies(), clock2us(), and main().
time of last budget updating
Definition at line 36 of file rres.c.
Referenced by rres_get_exec_time(), rres_init(), rres_update_budget(), and set_enforce_timer().
struct proc_dir_entry* qres_proc_root |
pointer to qres proc_fs root directory (/proc/qres)
struct list_head ready_queue |
List of ready servers, min-ordered by abs deadline.
Definition at line 11 of file rres_ready_queue.c.
Referenced by get_highest_priority_server(), ready_queue_add(), ready_queue_empty(), rres_edf_cleanup(), rres_edf_init(), and srv_alone().
spinlock_t rres_lock |
Referenced by rres_get_spinlock().
used to avoid reading too frequently the time.
Time must be read at each "entry point"
Definition at line 1 of file test-get-time.c.
Referenced by recharge(), recharge_reset_from_now(), rres_activate_nosched(), rres_init(), rres_schedule(), rres_set_params(), rres_update_budget(), and set_enforce_timer().
struct list_head server_list |
list of the servers
Definition at line 34 of file rres.c.
Referenced by rres_add_to_srv_set(), and rres_init().
Total allocated bandwidth.
Definition at line 37 of file rres.c.
Referenced by recharge(), rres_init_server(), rres_set_budget(), rres_set_current_bandwidth(), and rres_set_params().