diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-21 23:01:47 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-22 00:47:29 -0400 |
commit | ee869ea3b9715e81d75288760011080e82244701 (patch) | |
tree | 8cf31cf62c2ced10701b5e46428e4b8b140f9434 | |
parent | f7fa194248788d8ed57739caa6d7bd363f9b9596 (diff) |
Add Feather-Trace support.
- TICK
- SCHED1
- SCHED2
- RELEASE
- CXS
-rw-r--r-- | include/litmus/trace.h | 11 | ||||
-rw-r--r-- | kernel/sched.c | 27 | ||||
-rw-r--r-- | litmus/rt_domain.c | 7 |
3 files changed, 38 insertions, 7 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index dcb0c1b374..c340d4408d 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -45,12 +45,19 @@ asmlinkage void save_timestamp(unsigned long event); | |||
45 | 45 | ||
46 | #define TS_SCHED_START TIMESTAMP(100) | 46 | #define TS_SCHED_START TIMESTAMP(100) |
47 | #define TS_SCHED_END TIMESTAMP(101) | 47 | #define TS_SCHED_END TIMESTAMP(101) |
48 | #define TS_CXS_START TIMESTAMP(102) | 48 | #define TS_SCHED2_START TIMESTAMP(102) |
49 | #define TS_CXS_END TIMESTAMP(103) | 49 | #define TS_SCHED2_END TIMESTAMP(103) |
50 | |||
51 | #define TS_CXS_START TIMESTAMP(104) | ||
52 | #define TS_CXS_END TIMESTAMP(105) | ||
53 | |||
54 | #define TS_RELEASE_START TIMESTAMP(106) | ||
55 | #define TS_RELEASE_END TIMESTAMP(107) | ||
50 | 56 | ||
51 | #define TS_TICK_START TIMESTAMP(110) | 57 | #define TS_TICK_START TIMESTAMP(110) |
52 | #define TS_TICK_END TIMESTAMP(111) | 58 | #define TS_TICK_END TIMESTAMP(111) |
53 | 59 | ||
60 | |||
54 | #define TS_PLUGIN_SCHED_START TIMESTAMP(120) | 61 | #define TS_PLUGIN_SCHED_START TIMESTAMP(120) |
55 | #define TS_PLUGIN_SCHED_END TIMESTAMP(121) | 62 | #define TS_PLUGIN_SCHED_END TIMESTAMP(121) |
56 | 63 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 2a7e5c455f..7bc6f9a1bb 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -67,6 +67,8 @@ | |||
67 | #include <asm/tlb.h> | 67 | #include <asm/tlb.h> |
68 | #include <asm/irq_regs.h> | 68 | #include <asm/irq_regs.h> |
69 | 69 | ||
70 | #include <litmus/trace.h> | ||
71 | |||
70 | #include <litmus/norqlock.h> | 72 | #include <litmus/norqlock.h> |
71 | 73 | ||
72 | /* | 74 | /* |
@@ -3491,6 +3493,7 @@ void scheduler_tick(void) | |||
3491 | struct task_struct *curr = rq->curr; | 3493 | struct task_struct *curr = rq->curr; |
3492 | u64 next_tick = rq->tick_timestamp + TICK_NSEC; | 3494 | u64 next_tick = rq->tick_timestamp + TICK_NSEC; |
3493 | 3495 | ||
3496 | TS_TICK_START; | ||
3494 | spin_lock(&rq->lock); | 3497 | spin_lock(&rq->lock); |
3495 | __update_rq_clock(rq); | 3498 | __update_rq_clock(rq); |
3496 | /* | 3499 | /* |
@@ -3502,13 +3505,17 @@ void scheduler_tick(void) | |||
3502 | update_cpu_load(rq); | 3505 | update_cpu_load(rq); |
3503 | if (curr != rq->idle) /* FIXME: needed? */ | 3506 | if (curr != rq->idle) /* FIXME: needed? */ |
3504 | curr->sched_class->task_tick(rq, curr); | 3507 | curr->sched_class->task_tick(rq, curr); |
3508 | TS_PLUGIN_TICK_START; | ||
3505 | litmus_tick(rq, curr); | 3509 | litmus_tick(rq, curr); |
3510 | TS_PLUGIN_TICK_END; | ||
3506 | spin_unlock(&rq->lock); | 3511 | spin_unlock(&rq->lock); |
3507 | 3512 | ||
3508 | #ifdef CONFIG_SMP | 3513 | #ifdef CONFIG_SMP |
3509 | rq->idle_at_tick = idle_cpu(cpu); | 3514 | rq->idle_at_tick = idle_cpu(cpu); |
3510 | trigger_load_balance(rq, cpu); | 3515 | if (!is_realtime(current)) |
3516 | trigger_load_balance(rq, cpu); | ||
3511 | #endif | 3517 | #endif |
3518 | TS_TICK_END; | ||
3512 | } | 3519 | } |
3513 | 3520 | ||
3514 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) | 3521 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) |
@@ -3647,6 +3654,7 @@ need_resched: | |||
3647 | 3654 | ||
3648 | release_kernel_lock(prev); | 3655 | release_kernel_lock(prev); |
3649 | need_resched_nonpreemptible: | 3656 | need_resched_nonpreemptible: |
3657 | TS_SCHED_START; | ||
3650 | 3658 | ||
3651 | schedule_debug(prev); | 3659 | schedule_debug(prev); |
3652 | 3660 | ||
@@ -3657,7 +3665,9 @@ need_resched_nonpreemptible: | |||
3657 | __update_rq_clock(rq); | 3665 | __update_rq_clock(rq); |
3658 | spin_lock(&rq->lock); | 3666 | spin_lock(&rq->lock); |
3659 | clear_tsk_need_resched(prev); | 3667 | clear_tsk_need_resched(prev); |
3668 | TS_PLUGIN_SCHED_START; | ||
3660 | litmus_schedule(rq, prev); | 3669 | litmus_schedule(rq, prev); |
3670 | TS_PLUGIN_SCHED_END; | ||
3661 | 3671 | ||
3662 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { | 3672 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { |
3663 | if (unlikely((prev->state & TASK_INTERRUPTIBLE) && | 3673 | if (unlikely((prev->state & TASK_INTERRUPTIBLE) && |
@@ -3682,21 +3692,30 @@ need_resched_nonpreemptible: | |||
3682 | rq->curr = next; | 3692 | rq->curr = next; |
3683 | ++*switch_count; | 3693 | ++*switch_count; |
3684 | 3694 | ||
3685 | TRACE_TASK(next, "switched to\n"); | 3695 | TS_SCHED_END; |
3696 | TS_CXS_START; | ||
3686 | context_switch(rq, prev, next); /* unlocks the rq */ | 3697 | context_switch(rq, prev, next); /* unlocks the rq */ |
3687 | } else | 3698 | TS_CXS_END; |
3699 | } else { | ||
3700 | TS_SCHED_END; | ||
3688 | spin_unlock_irq(&rq->lock); | 3701 | spin_unlock_irq(&rq->lock); |
3702 | } | ||
3703 | TS_SCHED2_START; | ||
3689 | 3704 | ||
3690 | tick_no_rqlock(); | 3705 | tick_no_rqlock(); |
3691 | 3706 | ||
3692 | if (unlikely(reacquire_kernel_lock(current) < 0)) { | 3707 | if (unlikely(reacquire_kernel_lock(current) < 0)) { |
3693 | cpu = smp_processor_id(); | 3708 | cpu = smp_processor_id(); |
3694 | rq = cpu_rq(cpu); | 3709 | rq = cpu_rq(cpu); |
3710 | TS_SCHED2_END; | ||
3695 | goto need_resched_nonpreemptible; | 3711 | goto need_resched_nonpreemptible; |
3696 | } | 3712 | } |
3697 | preempt_enable_no_resched(); | 3713 | preempt_enable_no_resched(); |
3698 | if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) | 3714 | if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) { |
3715 | TS_SCHED2_END; | ||
3699 | goto need_resched; | 3716 | goto need_resched; |
3717 | } | ||
3718 | TS_SCHED2_END; | ||
3700 | if (srp_active()) | 3719 | if (srp_active()) |
3701 | srp_ceiling_block(); | 3720 | srp_ceiling_block(); |
3702 | } | 3721 | } |
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c index b85bb9e38d..28803087b3 100644 --- a/litmus/rt_domain.c +++ b/litmus/rt_domain.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <litmus/rt_domain.h> | 17 | #include <litmus/rt_domain.h> |
18 | 18 | ||
19 | #include <litmus/trace.h> | ||
19 | 20 | ||
20 | static int dummy_resched(rt_domain_t *rt) | 21 | static int dummy_resched(rt_domain_t *rt) |
21 | { | 22 | { |
@@ -36,12 +37,16 @@ static void default_release_job(struct task_struct* t, rt_domain_t* rt) | |||
36 | static enum hrtimer_restart release_job_timer(struct hrtimer *timer) | 37 | static enum hrtimer_restart release_job_timer(struct hrtimer *timer) |
37 | { | 38 | { |
38 | struct task_struct *t; | 39 | struct task_struct *t; |
39 | 40 | ||
41 | TS_RELEASE_START; | ||
42 | |||
40 | t = container_of(timer, struct task_struct, | 43 | t = container_of(timer, struct task_struct, |
41 | rt_param.release_timer); | 44 | rt_param.release_timer); |
42 | 45 | ||
43 | get_domain(t)->release_job(t, get_domain(t)); | 46 | get_domain(t)->release_job(t, get_domain(t)); |
44 | 47 | ||
48 | TS_RELEASE_END; | ||
49 | |||
45 | return HRTIMER_NORESTART; | 50 | return HRTIMER_NORESTART; |
46 | } | 51 | } |
47 | 52 | ||