Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kernel Program Behaviour Models
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixkhals
Kernel Program Behaviour Models
Commits
54bc6728
Commit
54bc6728
authored
6 years ago
by
mihairenea
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kernel/sched/pb.c
+11
-3
11 additions, 3 deletions
kernel/sched/pb.c
kernel/sched/perf_error_detection.c
+17
-2
17 additions, 2 deletions
kernel/sched/perf_error_detection.c
kernel/sched/sched.h
+14
-1
14 additions, 1 deletion
kernel/sched/sched.h
with
42 additions
and
6 deletions
kernel/sched/pb.c
+
11
−
3
View file @
54bc6728
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/perf_error_detection.c
+
17
−
2
View file @
54bc6728
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
kernel/sched/sched.h
+
14
−
1
View file @
54bc6728
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment