hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/kernel/trace/trace_selftest.c
....@@ -23,7 +23,7 @@
2323 return 0;
2424 }
2525
26
-static int trace_test_buffer_cpu(struct trace_buffer *buf, int cpu)
26
+static int trace_test_buffer_cpu(struct array_buffer *buf, int cpu)
2727 {
2828 struct ring_buffer_event *event;
2929 struct trace_entry *entry;
....@@ -60,7 +60,7 @@
6060 * Test the trace buffer to see if all the elements
6161 * are still sane.
6262 */
63
-static int __maybe_unused trace_test_buffer(struct trace_buffer *buf, unsigned long *count)
63
+static int __maybe_unused trace_test_buffer(struct array_buffer *buf, unsigned long *count)
6464 {
6565 unsigned long flags, cnt = 0;
6666 int cpu, ret = 0;
....@@ -362,7 +362,7 @@
362362 msleep(100);
363363
364364 /* we should have nothing in the buffer */
365
- ret = trace_test_buffer(&tr->trace_buffer, &count);
365
+ ret = trace_test_buffer(&tr->array_buffer, &count);
366366 if (ret)
367367 goto out;
368368
....@@ -383,7 +383,7 @@
383383 ftrace_enabled = 0;
384384
385385 /* check the trace buffer */
386
- ret = trace_test_buffer(&tr->trace_buffer, &count);
386
+ ret = trace_test_buffer(&tr->array_buffer, &count);
387387
388388 ftrace_enabled = 1;
389389 tracing_start();
....@@ -687,7 +687,7 @@
687687 ftrace_enabled = 0;
688688
689689 /* check the trace buffer */
690
- ret = trace_test_buffer(&tr->trace_buffer, &count);
690
+ ret = trace_test_buffer(&tr->array_buffer, &count);
691691
692692 ftrace_enabled = 1;
693693 trace->reset(tr);
....@@ -746,6 +746,11 @@
746746 return trace_graph_entry(trace);
747747 }
748748
749
+static struct fgraph_ops fgraph_ops __initdata = {
750
+ .entryfunc = &trace_graph_entry_watchdog,
751
+ .retfunc = &trace_graph_return,
752
+};
753
+
749754 /*
750755 * Pretty much the same than for the function tracer from which the selftest
751756 * has been borrowed.
....@@ -768,10 +773,9 @@
768773 * Simulate the init() callback but we attach a watchdog callback
769774 * to detect and recover from possible hangs
770775 */
771
- tracing_reset_online_cpus(&tr->trace_buffer);
776
+ tracing_reset_online_cpus(&tr->array_buffer);
772777 set_graph_array(tr);
773
- ret = register_ftrace_graph(&trace_graph_return,
774
- &trace_graph_entry_watchdog);
778
+ ret = register_ftrace_graph(&fgraph_ops);
775779 if (ret) {
776780 warn_failed_init_tracer(trace, ret);
777781 goto out;
....@@ -783,7 +787,7 @@
783787
784788 /* Have we just recovered from a hang? */
785789 if (graph_hang_thresh > GRAPH_MAX_FUNC_TEST) {
786
- tracing_selftest_disabled = true;
790
+ disable_tracing_selftest("recovering from a hang");
787791 ret = -1;
788792 goto out;
789793 }
....@@ -791,9 +795,12 @@
791795 tracing_stop();
792796
793797 /* check the trace buffer */
794
- ret = trace_test_buffer(&tr->trace_buffer, &count);
798
+ ret = trace_test_buffer(&tr->array_buffer, &count);
795799
796
- trace->reset(tr);
800
+ /* Need to also simulate the tr->reset to remove this fgraph_ops */
801
+ tracing_stop_cmdline_record();
802
+ unregister_ftrace_graph(&fgraph_ops);
803
+
797804 tracing_start();
798805
799806 if (!ret && !count) {
....@@ -846,7 +853,7 @@
846853 /* stop the tracing. */
847854 tracing_stop();
848855 /* check both trace buffers */
849
- ret = trace_test_buffer(&tr->trace_buffer, NULL);
856
+ ret = trace_test_buffer(&tr->array_buffer, NULL);
850857 if (!ret)
851858 ret = trace_test_buffer(&tr->max_buffer, &count);
852859 trace->reset(tr);
....@@ -908,7 +915,7 @@
908915 /* stop the tracing. */
909916 tracing_stop();
910917 /* check both trace buffers */
911
- ret = trace_test_buffer(&tr->trace_buffer, NULL);
918
+ ret = trace_test_buffer(&tr->array_buffer, NULL);
912919 if (!ret)
913920 ret = trace_test_buffer(&tr->max_buffer, &count);
914921 trace->reset(tr);
....@@ -974,7 +981,7 @@
974981 /* stop the tracing. */
975982 tracing_stop();
976983 /* check both trace buffers */
977
- ret = trace_test_buffer(&tr->trace_buffer, NULL);
984
+ ret = trace_test_buffer(&tr->array_buffer, NULL);
978985 if (ret)
979986 goto out;
980987
....@@ -1004,7 +1011,7 @@
10041011 /* stop the tracing. */
10051012 tracing_stop();
10061013 /* check both trace buffers */
1007
- ret = trace_test_buffer(&tr->trace_buffer, NULL);
1014
+ ret = trace_test_buffer(&tr->array_buffer, NULL);
10081015 if (ret)
10091016 goto out;
10101017
....@@ -1134,7 +1141,7 @@
11341141 /* stop the tracing. */
11351142 tracing_stop();
11361143 /* check both trace buffers */
1137
- ret = trace_test_buffer(&tr->trace_buffer, NULL);
1144
+ ret = trace_test_buffer(&tr->array_buffer, NULL);
11381145 if (!ret)
11391146 ret = trace_test_buffer(&tr->max_buffer, &count);
11401147
....@@ -1175,7 +1182,7 @@
11751182 /* stop the tracing. */
11761183 tracing_stop();
11771184 /* check the trace buffer */
1178
- ret = trace_test_buffer(&tr->trace_buffer, &count);
1185
+ ret = trace_test_buffer(&tr->array_buffer, &count);
11791186 trace->reset(tr);
11801187 tracing_start();
11811188