From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 5/5] tracing: Add __get_dynamic_array_len() macro for trace events
Date: Thu, 05 Jun 2014 11:15:45 -0400 [thread overview]
Message-ID: <20140605152114.331909098@goodmis.org> (raw)
In-Reply-To: 20140605151540.672365024@goodmis.org
[-- Attachment #1: 0004-tracing-Add-__get_dynamic_array_len-macro-for-trace-.patch --]
[-- Type: text/plain, Size: 1964 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
If a trace event uses a dynamic array for something other than a string
then there's currently no way the TP_printk() can figure out what size
it is. A __get_dynamic_array_len() is required to know the length.
This also simplifies the __get_bitmask() macro which required it as well,
but instead just hardcoded it.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/ftrace.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 9b7a989dcbcc..0fd06fef9fac 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -203,6 +203,10 @@
#define __get_dynamic_array(field) \
((void *)__entry + (__entry->__data_loc_##field & 0xffff))
+#undef __get_dynamic_array_len
+#define __get_dynamic_array_len(field) \
+ ((__entry->__data_loc_##field >> 16) & 0xffff)
+
#undef __get_str
#define __get_str(field) (char *)__get_dynamic_array(field)
@@ -211,7 +215,7 @@
({ \
void *__bitmask = __get_dynamic_array(field); \
unsigned int __bitmask_size; \
- __bitmask_size = (__entry->__data_loc_##field >> 16) & 0xffff; \
+ __bitmask_size = __get_dynamic_array_len(field); \
ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
})
@@ -636,6 +640,7 @@ static inline void ftrace_test_probe_##call(void) \
#undef __print_symbolic
#undef __print_hex
#undef __get_dynamic_array
+#undef __get_dynamic_array_len
#undef __get_str
#undef __get_bitmask
@@ -700,6 +705,10 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
#define __get_dynamic_array(field) \
((void *)__entry + (__entry->__data_loc_##field & 0xffff))
+#undef __get_dynamic_array_len
+#define __get_dynamic_array_len(field) \
+ ((__entry->__data_loc_##field >> 16) & 0xffff)
+
#undef __get_str
#define __get_str(field) (char *)__get_dynamic_array(field)
--
2.0.0.rc2
prev parent reply other threads:[~2014-06-05 15:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 15:15 [for-next][PATCH 0/5] tracing: More stuff for this merge window Steven Rostedt
2014-06-05 15:15 ` [for-next][PATCH 1/5] tracing: Print max callstack on stacktrace bug Steven Rostedt
2014-06-05 15:15 ` [for-next][PATCH 2/5] ftrace/x86: Call text_ip_addr() instead of the duplicated code Steven Rostedt
2014-06-05 15:15 ` [for-next][PATCH 3/5] tracing: Eliminate double free on failure of allocation on boot up Steven Rostedt
2014-06-05 15:15 ` [for-next][PATCH 4/5] tracing: Remove unused variable in trace_benchmark Steven Rostedt
2014-06-05 15:15 ` Steven Rostedt [this message]
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=20140605152114.331909098@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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