From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>
Subject: [for-next][PATCH 03/12] tracepoints: Do not punish non static call users
Date: Wed, 10 Feb 2021 21:09:30 -0500 [thread overview]
Message-ID: <20210211020948.863725704@goodmis.org> (raw)
In-Reply-To: 20210211020927.829775774@goodmis.org
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
With static calls, a tracepoint can call the callback directly if there is
only one callback registered to that tracepoint. When there is more than
one, the static call will call the tracepoint's "iterator" function, which
needs to reload the tracepoint's "funcs" array again, as it could have
changed since the first time it was loaded.
But an arch without static calls is punished by having to load the
tracepoint's "funcs" array twice. Once in the DO_TRACE macro, and once
again in the iterator macro.
For archs without static calls, there's no reason to load the array macro
in the first place, since the iterator function will do it anyway.
Change the __DO_TRACE_CALL() macro to do the load and call of the
tracepoints funcs array only for architectures with static calls, and just
call the iterator function directly for architectures without static calls.
Link: https://lkml.kernel.org/r/20210208201050.909329787@goodmis.org
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
include/linux/tracepoint.h | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 42bb5b753b33..2aad1c10821a 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -152,9 +152,19 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
#ifdef TRACEPOINTS_ENABLED
#ifdef CONFIG_HAVE_STATIC_CALL
-#define __DO_TRACE_CALL(name) static_call(tp_func_##name)
+#define __DO_TRACE_CALL(name, args) \
+ do { \
+ struct tracepoint_func *it_func_ptr; \
+ void *__data; \
+ it_func_ptr = \
+ rcu_dereference_raw((&__tracepoint_##name)->funcs); \
+ if (it_func_ptr) { \
+ __data = (it_func_ptr)->data; \
+ static_call(tp_func_##name)(__data, args); \
+ } \
+ } while (0)
#else
-#define __DO_TRACE_CALL(name) __traceiter_##name
+#define __DO_TRACE_CALL(name, args) __traceiter_##name(NULL, args)
#endif /* CONFIG_HAVE_STATIC_CALL */
/*
@@ -163,9 +173,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
*/
#define __DO_TRACE(name, args, cond, rcuidle) \
do { \
- struct tracepoint_func *it_func_ptr; \
int __maybe_unused __idx = 0; \
- void *__data; \
\
if (!(cond)) \
return; \
@@ -185,12 +193,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
rcu_irq_enter_irqson(); \
} \
\
- it_func_ptr = \
- rcu_dereference_raw((&__tracepoint_##name)->funcs); \
- if (it_func_ptr) { \
- __data = (it_func_ptr)->data; \
- __DO_TRACE_CALL(name)(__data, args); \
- } \
+ __DO_TRACE_CALL(name, TP_ARGS(args)); \
\
if (rcuidle) { \
rcu_irq_exit_irqson(); \
--
2.29.2
next prev parent reply other threads:[~2021-02-11 2:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-11 2:09 [for-next][PATCH 00/12] tracing: Updates for 5.12 Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 01/12] tracing: Do not create "enable" or "filter" files for ftrace event subsystem Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 02/12] tracepoints: Remove unnecessary "data_args" macro parameter Steven Rostedt
2021-02-11 2:09 ` Steven Rostedt [this message]
2021-02-11 2:09 ` [for-next][PATCH 04/12] tracepoints: Code clean up Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 05/12] ftrace: Remove unused ftrace_force_update() Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 06/12] kprobes: Warn if the kprobe is reregistered Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 07/12] tracing/dynevent: Delegate parsing to create function Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 08/12] tracing: Rework synthetic event command parsing Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 09/12] tracing: Update synth command errors Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 10/12] tracing: Add a backward-compatibility check for synthetic event creation Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 11/12] selftests/ftrace: Update synthetic event syntax errors Steven Rostedt
2021-02-11 2:09 ` [for-next][PATCH 12/12] selftests/ftrace: Add !event synthetic event syntax check 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=20210211020948.863725704@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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