mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Li Huafei <lihuafei1@huawei.com>
Subject: [GIT PULL] ftrace: Function graph fixes for 6.12
Date: Sat, 26 Oct 2024 03:45:06 -0400	[thread overview]
Message-ID: <20241026034506.2fe3e1aa@rorschach.local.home> (raw)


Linus,

Fixes for function graph:

- Fix missing mutex unlock in error path of register_ftrace_graph()

  A previous fix added a return on an error path and forgot to unlock the
  mutex. Instead of dealing with error paths, use guard(mutex) as the mutex
  is just released at the exit of the function anyway. Other functions
  in this file should be updated with this, but that's a cleanup and not
  a fix.

- Change cpuhp setup name to be consistent with other cpuhp states

  The same fix that the above patch fixes added a cpuhp_setup_state() call
  with the name of "fgraph_idle_init". I was informed that it should instead
  be something like: "fgraph:online". Update that too.


Please pull the latest ftrace-v6.12-rc4 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
ftrace-v6.12-rc4

Tag SHA1: 8f6be7ca396ba3c46995234d3b17f61bb99a3a20
Head SHA1: a574e7f80e86c740e241c762923f50077b2c2a30


Li Huafei (1):
      fgraph: Fix missing unlock in register_ftrace_graph()

Steven Rostedt (1):
      fgraph: Change the name of cpuhp state to "fgraph:online"

----
 kernel/trace/fgraph.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---------------------------
diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 41e7a15dcb50..69e226a48daa 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1252,10 +1252,10 @@ int register_ftrace_graph(struct fgraph_ops *gops)
 	int ret = 0;
 	int i = -1;
 
-	mutex_lock(&ftrace_lock);
+	guard(mutex)(&ftrace_lock);
 
 	if (!fgraph_initialized) {
-		ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "fgraph_idle_init",
+		ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "fgraph:online",
 					fgraph_cpu_init, NULL);
 		if (ret < 0) {
 			pr_warn("fgraph: Error to init cpu hotplug support\n");
@@ -1273,10 +1273,8 @@ int register_ftrace_graph(struct fgraph_ops *gops)
 	}
 
 	i = fgraph_lru_alloc_index();
-	if (i < 0 || WARN_ON_ONCE(fgraph_array[i] != &fgraph_stub)) {
-		ret = -ENOSPC;
-		goto out;
-	}
+	if (i < 0 || WARN_ON_ONCE(fgraph_array[i] != &fgraph_stub))
+		return -ENOSPC;
 	gops->idx = i;
 
 	ftrace_graph_active++;
@@ -1313,8 +1311,6 @@ int register_ftrace_graph(struct fgraph_ops *gops)
 		gops->saved_func = NULL;
 		fgraph_lru_release_index(i);
 	}
-out:
-	mutex_unlock(&ftrace_lock);
 	return ret;
 }
 

             reply	other threads:[~2024-10-26  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-26  7:45 Steven Rostedt [this message]
2024-10-27 19:03 ` pr-tracker-bot

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=20241026034506.2fe3e1aa@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=lihuafei1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®