public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org, Kaitao Cheng <pilgrimtao@gmail.com>
Subject: [for-linus][PATCH 6/7] kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail
Date: Mon, 06 Jan 2020 16:19:07 -0500	[thread overview]
Message-ID: <20200106211958.579504490@goodmis.org> (raw)
In-Reply-To: 20200106211901.293910946@goodmis.org

From: Kaitao Cheng <pilgrimtao@gmail.com>

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: 478142c39c8c2 ("tracing: do not grab lock in wakeup latency function tracing")
Signed-off-by: Kaitao Cheng <pilgrimtao@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_sched_wakeup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 5e43b9664eca..617e297f46dc 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -630,7 +630,7 @@ static void start_wakeup_tracer(struct trace_array *tr)
 	if (ret) {
 		pr_info("wakeup trace: Couldn't activate tracepoint"
 			" probe to kernel_sched_migrate_task\n");
-		return;
+		goto fail_deprobe_sched_switch;
 	}
 
 	wakeup_reset(tr);
@@ -648,6 +648,8 @@ static void start_wakeup_tracer(struct trace_array *tr)
 		printk(KERN_ERR "failed to start wakeup tracer\n");
 
 	return;
+fail_deprobe_sched_switch:
+	unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL);
 fail_deprobe_wake_new:
 	unregister_trace_sched_wakeup_new(probe_wakeup, NULL);
 fail_deprobe:
-- 
2.24.0



  parent reply	other threads:[~2020-01-06 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 21:19 [for-linus][PATCH 0/7] tracing: Fixes for 5.5 Steven Rostedt
2020-01-06 21:19 ` [for-linus][PATCH 1/7] tracing: Initialize val to zero in parse_entry of inject code Steven Rostedt
2020-01-06 21:19 ` [for-linus][PATCH 2/7] tracing: Define MCOUNT_INSN_SIZE when not defined without direct calls Steven Rostedt
2020-01-06 21:19 ` [for-linus][PATCH 3/7] tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined Steven Rostedt
2020-01-06 21:19 ` [for-linus][PATCH 4/7] ftrace: Avoid potential division by zero in function profiler Steven Rostedt
2020-01-06 21:19 ` [for-linus][PATCH 5/7] tracing: Change offset type to s32 in preempt/irq tracepoints Steven Rostedt
2020-01-06 21:19 ` Steven Rostedt [this message]
2020-01-06 21:19 ` [for-linus][PATCH 7/7] tracing: Fix indentation issue Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106211958.579504490@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pilgrimtao@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox