diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-10 14:35:36 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-10 14:35:36 -0500 |
commit | 4ba24fef3eb3b142197135223b90ced2f319cd53 (patch) | |
tree | a20c125b27740ec7b4c761b11d801108e1b316b2 /kernel/trace/trace_selftest.c | |
parent | 47c1ffb2b6b630894e9a16442611c056ab21c057 (diff) | |
parent | 98a4a59ee31a12105a2b84f5b8b515ac2cb208ef (diff) |
Merge branch 'next' into for-linus
Prepare first round of input updates for 3.20.
Diffstat (limited to 'kernel/trace/trace_selftest.c')
-rw-r--r-- | kernel/trace/trace_selftest.c | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 5ef60499dc8e..b0f86ea77881 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -382,6 +382,8 @@ static int trace_selftest_startup_dynamic_tracing(struct tracer *trace, | |||
382 | 382 | ||
383 | /* check the trace buffer */ | 383 | /* check the trace buffer */ |
384 | ret = trace_test_buffer(&tr->trace_buffer, &count); | 384 | ret = trace_test_buffer(&tr->trace_buffer, &count); |
385 | |||
386 | ftrace_enabled = 1; | ||
385 | tracing_start(); | 387 | tracing_start(); |
386 | 388 | ||
387 | /* we should only have one item */ | 389 | /* we should only have one item */ |
@@ -679,6 +681,8 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) | |||
679 | 681 | ||
680 | /* check the trace buffer */ | 682 | /* check the trace buffer */ |
681 | ret = trace_test_buffer(&tr->trace_buffer, &count); | 683 | ret = trace_test_buffer(&tr->trace_buffer, &count); |
684 | |||
685 | ftrace_enabled = 1; | ||
682 | trace->reset(tr); | 686 | trace->reset(tr); |
683 | tracing_start(); | 687 | tracing_start(); |
684 | 688 | ||
@@ -1025,6 +1029,12 @@ trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr) | |||
1025 | #endif | 1029 | #endif |
1026 | 1030 | ||
1027 | #ifdef CONFIG_SCHED_TRACER | 1031 | #ifdef CONFIG_SCHED_TRACER |
1032 | |||
1033 | struct wakeup_test_data { | ||
1034 | struct completion is_ready; | ||
1035 | int go; | ||
1036 | }; | ||
1037 | |||
1028 | static int trace_wakeup_test_thread(void *data) | 1038 | static int trace_wakeup_test_thread(void *data) |
1029 | { | 1039 | { |
1030 | /* Make this a -deadline thread */ | 1040 | /* Make this a -deadline thread */ |
@@ -1034,51 +1044,56 @@ static int trace_wakeup_test_thread(void *data) | |||
1034 | .sched_deadline = 10000000ULL, | 1044 | .sched_deadline = 10000000ULL, |
1035 | .sched_period = 10000000ULL | 1045 | .sched_period = 10000000ULL |
1036 | }; | 1046 | }; |
1037 | struct completion *x = data; | 1047 | struct wakeup_test_data *x = data; |
1038 | 1048 | ||
1039 | sched_setattr(current, &attr); | 1049 | sched_setattr(current, &attr); |
1040 | 1050 | ||
1041 | /* Make it know we have a new prio */ | 1051 | /* Make it know we have a new prio */ |
1042 | complete(x); | 1052 | complete(&x->is_ready); |
1043 | 1053 | ||
1044 | /* now go to sleep and let the test wake us up */ | 1054 | /* now go to sleep and let the test wake us up */ |
1045 | set_current_state(TASK_INTERRUPTIBLE); | 1055 | set_current_state(TASK_INTERRUPTIBLE); |
1046 | schedule(); | 1056 | while (!x->go) { |
1057 | schedule(); | ||
1058 | set_current_state(TASK_INTERRUPTIBLE); | ||
1059 | } | ||
1047 | 1060 | ||
1048 | complete(x); | 1061 | complete(&x->is_ready); |
1062 | |||
1063 | set_current_state(TASK_INTERRUPTIBLE); | ||
1049 | 1064 | ||
1050 | /* we are awake, now wait to disappear */ | 1065 | /* we are awake, now wait to disappear */ |
1051 | while (!kthread_should_stop()) { | 1066 | while (!kthread_should_stop()) { |
1052 | /* | 1067 | schedule(); |
1053 | * This will likely be the system top priority | 1068 | set_current_state(TASK_INTERRUPTIBLE); |
1054 | * task, do short sleeps to let others run. | ||
1055 | */ | ||
1056 | msleep(100); | ||
1057 | } | 1069 | } |
1058 | 1070 | ||
1071 | __set_current_state(TASK_RUNNING); | ||
1072 | |||
1059 | return 0; | 1073 | return 0; |
1060 | } | 1074 | } |
1061 | |||
1062 | int | 1075 | int |
1063 | trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | 1076 | trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) |
1064 | { | 1077 | { |
1065 | unsigned long save_max = tr->max_latency; | 1078 | unsigned long save_max = tr->max_latency; |
1066 | struct task_struct *p; | 1079 | struct task_struct *p; |
1067 | struct completion is_ready; | 1080 | struct wakeup_test_data data; |
1068 | unsigned long count; | 1081 | unsigned long count; |
1069 | int ret; | 1082 | int ret; |
1070 | 1083 | ||
1071 | init_completion(&is_ready); | 1084 | memset(&data, 0, sizeof(data)); |
1085 | |||
1086 | init_completion(&data.is_ready); | ||
1072 | 1087 | ||
1073 | /* create a -deadline thread */ | 1088 | /* create a -deadline thread */ |
1074 | p = kthread_run(trace_wakeup_test_thread, &is_ready, "ftrace-test"); | 1089 | p = kthread_run(trace_wakeup_test_thread, &data, "ftrace-test"); |
1075 | if (IS_ERR(p)) { | 1090 | if (IS_ERR(p)) { |
1076 | printk(KERN_CONT "Failed to create ftrace wakeup test thread "); | 1091 | printk(KERN_CONT "Failed to create ftrace wakeup test thread "); |
1077 | return -1; | 1092 | return -1; |
1078 | } | 1093 | } |
1079 | 1094 | ||
1080 | /* make sure the thread is running at -deadline policy */ | 1095 | /* make sure the thread is running at -deadline policy */ |
1081 | wait_for_completion(&is_ready); | 1096 | wait_for_completion(&data.is_ready); |
1082 | 1097 | ||
1083 | /* start the tracing */ | 1098 | /* start the tracing */ |
1084 | ret = tracer_init(trace, tr); | 1099 | ret = tracer_init(trace, tr); |
@@ -1099,18 +1114,20 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) | |||
1099 | msleep(100); | 1114 | msleep(100); |
1100 | } | 1115 | } |
1101 | 1116 | ||
1102 | init_completion(&is_ready); | 1117 | init_completion(&data.is_ready); |
1118 | |||
1119 | data.go = 1; | ||
1120 | /* memory barrier is in the wake_up_process() */ | ||
1103 | 1121 | ||
1104 | wake_up_process(p); | 1122 | wake_up_process(p); |
1105 | 1123 | ||
1106 | /* Wait for the task to wake up */ | 1124 | /* Wait for the task to wake up */ |
1107 | wait_for_completion(&is_ready); | 1125 | wait_for_completion(&data.is_ready); |
1108 | 1126 | ||
1109 | /* stop the tracing. */ | 1127 | /* stop the tracing. */ |
1110 | tracing_stop(); | 1128 | tracing_stop(); |
1111 | /* check both trace buffers */ | 1129 | /* check both trace buffers */ |
1112 | ret = trace_test_buffer(&tr->trace_buffer, NULL); | 1130 | ret = trace_test_buffer(&tr->trace_buffer, NULL); |
1113 | printk("ret = %d\n", ret); | ||
1114 | if (!ret) | 1131 | if (!ret) |
1115 | ret = trace_test_buffer(&tr->max_buffer, &count); | 1132 | ret = trace_test_buffer(&tr->max_buffer, &count); |
1116 | 1133 | ||