Skip to content
Snippets Groups Projects
Commit 54bc6728 authored by mihairenea's avatar mihairenea
Browse files

Commented bugs, TODO's and things that are (at least for me) unclear

parent 1291f5e6
No related branches found
No related tags found
No related merge requests found
......@@ -122,9 +122,15 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
if (next_mode == PB_EXEC_MODE)
{
if (current_mode == PB_EXEC_MODE){
int perf_counter = terminate_perf_event(pb->pevent, pb->plan[pb->c_entry].task_id);
/*
* !!! perf_counter contains return value of perf_event_release_kernel(), not the event counter !!!
*/
// u64 pevent_cntval;
int perf_counter = terminate_perf_event(pb->pevent, pb->plan[pb->c_entry].task_id /*, &pevent_cntval */);
//error detection
if (perf_counter < pb->plan[pb->c_entry].n_instr){
// if (pevent_cntval < pb->plan[pb->c_entry].n_instr){
printk(KERN_WARNING "PB TASK %llu RAN TOO SHORT\n",pb->plan[pb->c_entry].task_id);
}
pb->c_entry++;
......@@ -143,7 +149,7 @@ static struct task_struct * pick_next_task_pb(struct rq *rq,
}
}else if(current_mode == PB_ADMIN_MODE){
printk(KERN_DEBUG "PB ADMIN,STOP,%u,%llu\n", pb->c_entry, sched_clock());
}else{
}else{ // PB_DISABLED_MODE
int perf_init_res = init_perf_event(pb->plan[pb->c_entry], &pb->pevent);
if(perf_init_res < 0){
......@@ -177,7 +183,9 @@ static void set_curr_task_pb(struct rq *rq)
// NOP
}
/*
* TODO: Make sure this does't interrupt determine_next_mode_pb() and pick_next_task_pb()
*/
static void task_tick_pb(struct rq *rq, struct task_struct *p, int queued)
{
int next_mode;
......
......@@ -3,6 +3,15 @@
#define PERF_SAMPLE_PERIOD_SIZE 100000
/*
* Our understanding of perf so far. Please correct as needed.
*
* An event in perf's terms is an instruction in our case.
* A sample is a fixed number of events that CAN trigger a wakeup_event (but not the only way).
* An overflow event is triggered by a fixed number of wakeup_event.
*
*/
//initialize perf event for new task
int init_perf_event(struct plan_entry plan_entry, struct perf_event **pevent){
struct perf_event_attr pe;
......@@ -34,8 +43,14 @@ int init_perf_event(struct plan_entry plan_entry, struct perf_event **pevent){
}
//terminate perf event - return performance counter value
long long terminate_perf_event(struct perf_event *pevent, u64 task_id){
/*
* TODO: return the event counter value
*
*/
long long terminate_perf_event(struct perf_event *pevent, u64 task_id /*, u64 *pevent_cntval */){
// TODO:
// *pevent_cntval = get the counter value here
return perf_event_release_kernel(pevent);
}
......
......@@ -537,7 +537,7 @@ struct pb_rq {
// currently executed entry of the plan
unsigned int c_entry;
// pointer to the dummy task
struct task_struct *proxy_task;
struct task_struct *proxy_task; //TODO: We should comment this out and iterate the plan accordingly
// amount of timer consecutive timer interrupts for pb tasks
u64 n_pb_cycles;
......@@ -552,6 +552,8 @@ struct pb_rq {
// one of PB_DISABLED_MODE, PB_EXEC_MODE, PB_ADMIN_MODE
int mode;
//TODO: Do we still need those?
int measure_k;
u64 kstart;
u64 ktime;
......@@ -881,6 +883,11 @@ static inline int determine_next_mode_pb(struct rq *rq)
{
// initial switch
if (pb->mode == PB_DISABLED_MODE &&
//TODO:
/*
* We have to iterate the Plan, and think about a mechanism to signal that a plan is ready
* to be processed - maybe set pb->size 0 when the plan is done, n when a plan with n entries is ready.
*/
pb->proxy_task != NULL)
{
return PB_EXEC_MODE;
......@@ -890,6 +897,9 @@ static inline int determine_next_mode_pb(struct rq *rq)
if (pb->mode == PB_EXEC_MODE)
{
//stay for n timer interrupts cycles in exec mode
/*
* Is the tick interrupt active in this moment?
*/
if(pb->count_pb_cycles > pb->n_pb_cycles){
mode = PB_ADMIN_MODE;
pb->count_pb_cycles = 0;
......@@ -900,6 +910,9 @@ static inline int determine_next_mode_pb(struct rq *rq)
else if (pb->mode == PB_ADMIN_MODE)
{
//stay for n timer interrupt cylces in uall mode for admin tasks
/*
* Is the tick interrupt active in this moment?
*/
if(pb->count_admin_cycles > pb->n_admin_cycles){
mode = PB_EXEC_MODE;
pb->count_admin_cycles = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment