/* * Constant definitions related to * scheduling policy. */ #ifndef _LINUX_LITMUS_H_ #define _LINUX_LITMUS_H_ #include #include typedef enum { SCHED_BEG = 0, SCHED_LINUX = 0, SCHED_PFAIR = 1, SCHED_PFAIR_STAGGER = 2, SCHED_PART_EDF = 3, SCHED_PART_EEVDF = 4, SCHED_GLOBAL_EDF = 5, SCHED_PFAIR_DESYNC = 6, SCHED_GLOBAL_EDF_NP = 7, SCHED_CUSTOM = 8, SCHED_EDF_HSB = 9, SCHED_GSN_EDF = 10, SCHED_PSN_EDF = 11, /* Add your scheduling policy here */ SCHED_END = 11, SCHED_DEFAULT = 0, SCHED_INVALID = -1, } spolicy; /* no options */ #define SCHED_NONE 0 /* make scheduling decisions at quantum boundaries */ #define SCHED_QUANTUM 1 /* only schedule RT tasks at slot boundaries */ #define SCHED_RT_AT_BOUND 2 /* default slot size - number of 1ms jiffies in a scheduling quantum */ #define DEFAULT_SLOT_SIZE 1 /* stagger value for no staggering of slot boundaries */ #define DEFAULT_NO_STAGGER 0 /* default stagger - number of 1ms jiffies by which processors * are staggered, modulo the slot size */ #define DEFAULT_STAGGER 2 /* Runtime modes */ /* CLEANUP: Should maybe an enum? */ #define MAX_MODES 2 #define MODE_NON_RT 0 #define MODE_RT_RUN 1 /* Plugin boot options, for convenience */ #define PLUGIN_LINUX "linux" #define PLUGIN_PFAIR "pfair" #define PLUGIN_PART_EDF "part_edf" #define PLUGIN_GLOBAL_EDF "global_edf" #define PLUGIN_PFAIR_STAGGER "stagger" #define PLUGIN_PFAIR_DESYNC "desync" #define PLUGIN_GLOBAL_EDF_NP "global_edf_np" #define PLUGIN_EDF_HSB "edf_hsb" #define PLUGIN_GSN_EDF "gsn_edf" #define PLUGIN_PSN_EDF "psn_edf" /* Additional clone flags Indicates that the thread is to be used in realtime mode, therefore it should not be woken up in a linux manner, we just set its state to TASK_STOPPED It must be prepared and added to the ready queue explicitly */ /* Type definition for our quantums */ typedef unsigned long long quantum_t; extern spolicy sched_policy; extern int sched_options; /* Make this function available to plugins */ void set_sched_options(int); extern unsigned long slot_size; extern unsigned long stagger_offset; /* RT mode start time */ extern volatile unsigned long rt_start_time; /* Here we store the current mode of the system */ extern atomic_t rt_mode; #define get_rt_mode() (atomic_read(&rt_mode)) #define set_rt_mode(a) atomic_set(&rt_mode,(a)) /* CLEANUP: Should be queue_lock, does it really belong here? */ extern spinlock_t litmus_task_set_lock; #define TRACE(fmt, args...) \ sched_trace_log_message("%d: " fmt, raw_smp_processor_id(), ## args) #define TRACE_TASK(t, fmt, args...) \ TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args) #define TRACE_CUR(fmt, args...) \ TRACE_TASK(current, fmt, ## args) /* in_list - is a given list_head queued on some list? */ static inline int in_list(struct list_head* list) { return !( /* case 1: deleted */ (list->next == LIST_POISON1 && list->prev == LIST_POISON2) || /* case 2: initialized */ (list->next == list && list->prev == list) ); } #endif