hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/scripts/tracing/ftrace-bisect.sh
....@@ -12,7 +12,7 @@
1212 # (note, if this is a problem with function_graph tracing, then simply
1313 # replace "function" with "function_graph" in the following steps).
1414 #
15
-# # cd /sys/kernel/debug/tracing
15
+# # cd /sys/kernel/tracing
1616 # # echo schedule > set_ftrace_filter
1717 # # echo function > current_tracer
1818 #
....@@ -20,14 +20,32 @@
2020 #
2121 # # echo nop > current_tracer
2222 #
23
-# # cat available_filter_functions > ~/full-file
23
+# Starting with v5.1 this can be done with numbers, making it much faster:
24
+#
25
+# The old (slow) way, for kernels before v5.1.
26
+#
27
+# [old-way] # cat available_filter_functions > ~/full-file
28
+#
29
+# [old-way] *** Note *** this process will take several minutes to update the
30
+# [old-way] filters. Setting multiple functions is an O(n^2) operation, and we
31
+# [old-way] are dealing with thousands of functions. So go have coffee, talk
32
+# [old-way] with your coworkers, read facebook. And eventually, this operation
33
+# [old-way] will end.
34
+#
35
+# The new way (using numbers) is an O(n) operation, and usually takes less than a second.
36
+#
37
+# seq `wc -l available_filter_functions | cut -d' ' -f1` > ~/full-file
38
+#
39
+# This will create a sequence of numbers that match the functions in
40
+# available_filter_functions, and when echoing in a number into the
41
+# set_ftrace_filter file, it will enable the corresponding function in
42
+# O(1) time. Making enabling all functions O(n) where n is the number of
43
+# functions to enable.
44
+#
45
+# For either the new or old way, the rest of the operations remain the same.
46
+#
2447 # # ftrace-bisect ~/full-file ~/test-file ~/non-test-file
2548 # # cat ~/test-file > set_ftrace_filter
26
-#
27
-# *** Note *** this will take several minutes. Setting multiple functions is
28
-# an O(n^2) operation, and we are dealing with thousands of functions. So go
29
-# have coffee, talk with your coworkers, read facebook. And eventually, this
30
-# operation will end.
3149 #
3250 # # echo function > current_tracer
3351 #
....@@ -35,7 +53,7 @@
3553 #
3654 # Reboot back to test kernel.
3755 #
38
-# # cd /sys/kernel/debug/tracing
56
+# # cd /sys/kernel/tracing
3957 # # mv ~/test-file ~/full-file
4058 #
4159 # If it didn't crash.