aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_selftest.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 1003a4d5eb25..2c00a691a540 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -1041,6 +1041,8 @@ static int trace_wakeup_test_thread(void *data)
1041 set_current_state(TASK_INTERRUPTIBLE); 1041 set_current_state(TASK_INTERRUPTIBLE);
1042 schedule(); 1042 schedule();
1043 1043
1044 complete(x);
1045
1044 /* we are awake, now wait to disappear */ 1046 /* we are awake, now wait to disappear */
1045 while (!kthread_should_stop()) { 1047 while (!kthread_should_stop()) {
1046 /* 1048 /*
@@ -1084,24 +1086,21 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr)
1084 /* reset the max latency */ 1086 /* reset the max latency */
1085 tracing_max_latency = 0; 1087 tracing_max_latency = 0;
1086 1088
1087 /* sleep to let the RT thread sleep too */ 1089 while (p->on_rq) {
1088 msleep(100); 1090 /*
1091 * Sleep to make sure the RT thread is asleep too.
1092 * On virtual machines we can't rely on timings,
1093 * but we want to make sure this test still works.
1094 */
1095 msleep(100);
1096 }
1089 1097
1090 /* 1098 init_completion(&isrt);
1091 * Yes this is slightly racy. It is possible that for some
1092 * strange reason that the RT thread we created, did not
1093 * call schedule for 100ms after doing the completion,
1094 * and we do a wakeup on a task that already is awake.
1095 * But that is extremely unlikely, and the worst thing that
1096 * happens in such a case, is that we disable tracing.
1097 * Honestly, if this race does happen something is horrible
1098 * wrong with the system.
1099 */
1100 1099
1101 wake_up_process(p); 1100 wake_up_process(p);
1102 1101
1103 /* give a little time to let the thread wake up */ 1102 /* Wait for the task to wake up */
1104 msleep(100); 1103 wait_for_completion(&isrt);
1105 1104
1106 /* stop the tracing. */ 1105 /* stop the tracing. */
1107 tracing_stop(); 1106 tracing_stop();