From nobody Mon Nov 25 13:17:54 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 685562CA8 for ; Sat, 26 Oct 2024 07:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729928714; cv=none; b=IWAVSOP2JzPpjmBRXGP8Dn1VOaJpzmEaBRiMsPEuPeWeMNfFyXc45BftVzR4s792fuqOSEz7ylFhsBcII/LDFwaigWbBZRhXghxO3mb3ZVVKCMy6bWAiW1r1CS3eZi4ZRNhUUcxKU81TIuPP+5kvSKKmksNYI9Rv/9fj8vGAsTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729928714; c=relaxed/simple; bh=ck5ggRD0az/wSVwPS550Rzh7aUtRcOhIelfQBElqYoM=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=jJxVvsTXgRHgH2Mom92zROi536mgPpLVTI6I2Mqj14cx6deKOv/mdl1fQpJhYmGzwRaNa9zpBiN30rRDGozEgdm2SShQ9MB8UvAmHW27ASJWJWvaFkZRaRYTAO8noWZQB4KXH6BvuL/52yaRwmJz72C7bwUHGtQsmwRdeUnWYqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C10A7C4CEC6; Sat, 26 Oct 2024 07:45:10 +0000 (UTC) Date: Sat, 26 Oct 2024 03:45:06 -0400 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Li Huafei Subject: [GIT PULL] ftrace: Function graph fixes for 6.12 Message-ID: <20241026034506.2fe3e1aa@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D 0; int i =3D -1; =20 - mutex_lock(&ftrace_lock); + guard(mutex)(&ftrace_lock); =20 if (!fgraph_initialized) { - ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "fgraph_idle_init", + ret =3D 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) } =20 i =3D fgraph_lru_alloc_index(); - if (i < 0 || WARN_ON_ONCE(fgraph_array[i] !=3D &fgraph_stub)) { - ret =3D -ENOSPC; - goto out; - } + if (i < 0 || WARN_ON_ONCE(fgraph_array[i] !=3D &fgraph_stub)) + return -ENOSPC; gops->idx =3D i; =20 ftrace_graph_active++; @@ -1313,8 +1311,6 @@ int register_ftrace_graph(struct fgraph_ops *gops) gops->saved_func =3D NULL; fgraph_lru_release_index(i); } -out: - mutex_unlock(&ftrace_lock); return ret; }