瀏覽代碼

tracing: handle unregistering the current tracer

Impact: simplification

Instead of requiring that plugins have the sequence:

  my_tracer_stop(my_trace_array);
  unregister_tracer(my_tracer);

it should be possible just do a:

  unregister_tracer(my_tracer);

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Arnaldo Carvalho de Melo 16 年之前
父節點
當前提交
b5db03c435
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      kernel/trace/trace.c

+ 9 - 0
kernel/trace/trace.c

@@ -559,6 +559,15 @@ void unregister_tracer(struct tracer *type)
 
 
  found:
  found:
 	*t = (*t)->next;
 	*t = (*t)->next;
+
+	if (type == current_trace && tracer_enabled) {
+		tracer_enabled = 0;
+		tracing_stop();
+		if (current_trace->stop)
+			current_trace->stop(&global_trace);
+		current_trace = &nop_trace;
+	}
+
 	if (strlen(type->name) != max_tracer_type_len)
 	if (strlen(type->name) != max_tracer_type_len)
 		goto out;
 		goto out;