From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
paulmck@kernel.org, frextrite@gmail.com, rcu@vger.kernel.org,
madhuparnabhowmik04@gmail.com
Subject: [PATCH] kernel/trace: Use rcu_assign_pointer() for setting fgraph hash pointers
Date: Wed, 5 Feb 2020 17:18:08 -0500 [thread overview]
Message-ID: <20200205221808.54576-1-joel@joelfernandes.org> (raw)
set_ftrace_early_graph() sets pointers without any explicit
release-barriers. Let us use rcu_assign_pointer() to ensure the same.
Note that ftrace_early_graph() calls ftrace_graph_set_hash() which does
do mutex_unlock(&ftrace_lock); which should imply a release barrier.
However it is better to not depend on it and just use
rcu_assign_pointer() which should also avoid sparse errors in the
future.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
kernel/trace/ftrace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 959ded08dc13f..340d30557a10e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5477,9 +5477,9 @@ static void __init set_ftrace_early_graph(char *buf, int enable)
}
if (enable)
- ftrace_graph_hash = hash;
+ rcu_assign_pointer(ftrace_graph_hash, hash);
else
- ftrace_graph_notrace_hash = hash;
+ rcu_assign_pointer(ftrace_graph_notrace_hash, hash);
}
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
--
2.25.0.341.g760bfbb309-goog
next reply other threads:[~2020-02-05 22:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-05 22:18 Joel Fernandes (Google) [this message]
2020-02-05 22:25 ` [PATCH] kernel/trace: Use rcu_assign_pointer() for setting fgraph hash pointers Steven Rostedt
2020-02-05 22:34 ` Joel Fernandes
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=20200205221808.54576-1-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=frextrite@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=madhuparnabhowmik04@gmail.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).