diff options
Diffstat (limited to 'kernel/trace/trace_selftest.c')
-rw-r--r-- | kernel/trace/trace_selftest.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index a7329b7902f8..e98fca60974f 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -1022,11 +1022,16 @@ trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr) | |||
1022 | #ifdef CONFIG_SCHED_TRACER | 1022 | #ifdef CONFIG_SCHED_TRACER |
1023 | static int trace_wakeup_test_thread(void *data) | 1023 | static int trace_wakeup_test_thread(void *data) |
1024 | { | 1024 | { |
1025 | /* Make this a RT thread, doesn't need to be too high */ | 1025 | /* Make this a -deadline thread */ |
1026 | static const struct sched_param param = { .sched_priority = 5 }; | 1026 | static const struct sched_attr attr = { |
1027 | .sched_policy = SCHED_DEADLINE, | ||
1028 | .sched_runtime = 100000ULL, | ||
1029 | .sched_deadline = 10000000ULL, | ||
1030 | .sched_period = 10000000ULL | ||
1031 | }; | ||
1027 | struct completion *x = data; | 1032 | struct completion *x = data; |
1028 | 1033 | ||
1029 | sched_setscheduler(current, SCHED_FIFO, ¶m); | 1034 | sched_setattr(current, &attr); |
1030 | 1035 | ||
1031 | /* Make it know we have a new prio */ | 1036 | /* Make it know we have a new prio */ |
1032 | complete(x); | 1037 | complete(x); |
@@ -1040,8 +1045,8 @@ static int trace_wakeup_test_thread(void *data) | |||
1040 | /* we are awake, now wait to disappear */ | 1045 | /* we are awake, now wait to disappear */ |
1041 | while (!kthread_should_stop()) { | 1046 | while (!kthread_should_stop()) { |
1042 | /* | 1047 | /* |
1043 | * This is an RT task, do short sleeps to let | 1048 | * This will likely be the system top priority |
1044 | * others run. | 1049 | * task, do short sleeps to let others run. |
1045 | */ | 1050 | */ |
1046 | msleep(100); | 1051 | msleep(100); |
1047 | } | 1052 | } |
@@ -1054,21 +1059,21 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | |||
1054 | { | 1059 | { |
1055 | unsigned long save_max = tracing_max_latency; | 1060 | unsigned long save_max = tracing_max_latency; |
1056 | struct task_struct *p; | 1061 | struct task_struct *p; |
1057 | struct completion isrt; | 1062 | struct completion is_ready; |
1058 | unsigned long count; | 1063 | unsigned long count; |
1059 | int ret; | 1064 | int ret; |
1060 | 1065 | ||
1061 | init_completion(&isrt); | 1066 | init_completion(&is_ready); |
1062 | 1067 | ||
1063 | /* create a high prio thread */ | 1068 | /* create a -deadline thread */ |
1064 | p = kthread_run(trace_wakeup_test_thread, &isrt, "ftrace-test"); | 1069 | p = kthread_run(trace_wakeup_test_thread, &is_ready, "ftrace-test"); |
1065 | if (IS_ERR(p)) { | 1070 | if (IS_ERR(p)) { |
1066 | printk(KERN_CONT "Failed to create ftrace wakeup test thread "); | 1071 | printk(KERN_CONT "Failed to create ftrace wakeup test thread "); |
1067 | return -1; | 1072 | return -1; |
1068 | } | 1073 | } |
1069 | 1074 | ||
1070 | /* make sure the thread is running at an RT prio */ | 1075 | /* make sure the thread is running at -deadline policy */ |
1071 | wait_for_completion(&isrt); | 1076 | wait_for_completion(&is_ready); |
1072 | 1077 | ||
1073 | /* start the tracing */ | 1078 | /* start the tracing */ |
1074 | ret = tracer_init(trace, tr); | 1079 | ret = tracer_init(trace, tr); |
@@ -1082,19 +1087,19 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | |||
1082 | 1087 | ||
1083 | while (p->on_rq) { | 1088 | while (p->on_rq) { |
1084 | /* | 1089 | /* |
1085 | * Sleep to make sure the RT thread is asleep too. | 1090 | * Sleep to make sure the -deadline thread is asleep too. |
1086 | * On virtual machines we can't rely on timings, | 1091 | * On virtual machines we can't rely on timings, |
1087 | * but we want to make sure this test still works. | 1092 | * but we want to make sure this test still works. |
1088 | */ | 1093 | */ |
1089 | msleep(100); | 1094 | msleep(100); |
1090 | } | 1095 | } |
1091 | 1096 | ||
1092 | init_completion(&isrt); | 1097 | init_completion(&is_ready); |
1093 | 1098 | ||
1094 | wake_up_process(p); | 1099 | wake_up_process(p); |
1095 | 1100 | ||
1096 | /* Wait for the task to wake up */ | 1101 | /* Wait for the task to wake up */ |
1097 | wait_for_completion(&isrt); | 1102 | wait_for_completion(&is_ready); |
1098 | 1103 | ||
1099 | /* stop the tracing. */ | 1104 | /* stop the tracing. */ |
1100 | tracing_stop(); | 1105 | tracing_stop(); |