Commit ce4db32b authored by Kaitao Cheng's avatar Kaitao Cheng Committed by Khalid Elmously

kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail

BugLink: https://bugs.launchpad.net/bugs/1859865

commit 50f9ad60 upstream.

In the function, if register_trace_sched_migrate_task() returns error,
sched_switch/sched_wakeup_new/sched_wakeup won't unregister. That is
why fail_deprobe_sched_switch was added.

Link: http://lkml.kernel.org/r/20191231133530.2794-1-pilgrimtao@gmail.com

Cc: stable@vger.kernel.org
Fixes: 478142c3 ("tracing: do not grab lock in wakeup latency function tracing")
Signed-off-by: default avatarKaitao Cheng <pilgrimtao@gmail.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent be8eb776
...@@ -625,7 +625,7 @@ static void start_wakeup_tracer(struct trace_array *tr) ...@@ -625,7 +625,7 @@ static void start_wakeup_tracer(struct trace_array *tr)
if (ret) { if (ret) {
pr_info("wakeup trace: Couldn't activate tracepoint" pr_info("wakeup trace: Couldn't activate tracepoint"
" probe to kernel_sched_migrate_task\n"); " probe to kernel_sched_migrate_task\n");
return; goto fail_deprobe_sched_switch;
} }
wakeup_reset(tr); wakeup_reset(tr);
...@@ -643,6 +643,8 @@ static void start_wakeup_tracer(struct trace_array *tr) ...@@ -643,6 +643,8 @@ static void start_wakeup_tracer(struct trace_array *tr)
printk(KERN_ERR "failed to start wakeup tracer\n"); printk(KERN_ERR "failed to start wakeup tracer\n");
return; return;
fail_deprobe_sched_switch:
unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL);
fail_deprobe_wake_new: fail_deprobe_wake_new:
unregister_trace_sched_wakeup_new(probe_wakeup, NULL); unregister_trace_sched_wakeup_new(probe_wakeup, NULL);
fail_deprobe: fail_deprobe:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment