* [PATCH] tools lib traceevent: Add direct access to dynamic arrays
@ 2013-11-11 21:08 Steven Rostedt
2013-11-12 9:46 ` Jiri Olsa
2013-11-12 21:57 ` [tip:perf/urgent] " tip-bot for Steven Rostedt
0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2013-11-11 21:08 UTC (permalink / raw)
To: LKML
Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar, Namhyung Kim,
Frederic Weisbecker
Jiri Olsa was writing a plugin for the cfg80211_tx_mlme_mgmt trace
event, and was not able to get the implemented function working.
The event's print fmt looks like:
"netdev:%s(%d), ftype:0x%.2x", REC->name, REC->ifindex,
__le16_to_cpup((__le16 *)__get_dynamic_array(frame))
As there's no helper function for __le16_to_cpup(), Jiri was creating one
with a plugin. But unfortunately, it would not work even though he set
up the plugin correctly.
The problem is that the function parameters do not handle the helper
function "__get_dynamic_array()", and that passes in a NULL pointer.
Adding PRINT_DYNAMIC_ARRAY direct support to eval_num_arg() allows the
use of __get_dynamic_array() in function parameters.
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
tools/lib/traceevent/event-parse.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 8f450ad..0362d57 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3435,6 +3435,19 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
goto out_warning_op;
}
break;
+ case PRINT_DYNAMIC_ARRAY:
+ /* Without [], we pass the address to the dynamic data */
+ offset = pevent_read_number(pevent,
+ data + arg->dynarray.field->offset,
+ arg->dynarray.field->size);
+ /*
+ * The actual length of the dynamic array is stored
+ * in the top half of the field, and the offset
+ * is in the bottom half of the 32 bit field.
+ */
+ offset &= 0xffff;
+ val = (unsigned long long)(data + offset);
+ break;
default: /* not sure what to do there */
return 0;
}
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools lib traceevent: Add direct access to dynamic arrays
2013-11-11 21:08 [PATCH] tools lib traceevent: Add direct access to dynamic arrays Steven Rostedt
@ 2013-11-12 9:46 ` Jiri Olsa
2013-11-12 21:57 ` [tip:perf/urgent] " tip-bot for Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2013-11-12 9:46 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Arnaldo Carvalho de Melo, Ingo Molnar, Namhyung Kim,
Frederic Weisbecker
On Mon, Nov 11, 2013 at 04:08:10PM -0500, Steven Rostedt wrote:
>
> Jiri Olsa was writing a plugin for the cfg80211_tx_mlme_mgmt trace
> event, and was not able to get the implemented function working.
> The event's print fmt looks like:
>
> "netdev:%s(%d), ftype:0x%.2x", REC->name, REC->ifindex,
> __le16_to_cpup((__le16 *)__get_dynamic_array(frame))
>
> As there's no helper function for __le16_to_cpup(), Jiri was creating one
> with a plugin. But unfortunately, it would not work even though he set
> up the plugin correctly.
>
> The problem is that the function parameters do not handle the helper
> function "__get_dynamic_array()", and that passes in a NULL pointer.
>
> Adding PRINT_DYNAMIC_ARRAY direct support to eval_num_arg() allows the
> use of __get_dynamic_array() in function parameters.
>
> Reported-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
cool, thanks
Tested-by: Jiri Olsa <jolsa@redhat.com>
jirka
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] tools lib traceevent: Add direct access to dynamic arrays
2013-11-11 21:08 [PATCH] tools lib traceevent: Add direct access to dynamic arrays Steven Rostedt
2013-11-12 9:46 ` Jiri Olsa
@ 2013-11-12 21:57 ` tip-bot for Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Steven Rostedt @ 2013-11-12 21:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, namhyung, jolsa, fweisbec, rostedt, tglx
Commit-ID: 0497a9ebaf7ae4d573497b3e053ad4c3d5c9921d
Gitweb: http://git.kernel.org/tip/0497a9ebaf7ae4d573497b3e053ad4c3d5c9921d
Author: Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Mon, 11 Nov 2013 16:08:10 -0500
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Nov 2013 17:23:44 -0300
tools lib traceevent: Add direct access to dynamic arrays
Jiri Olsa was writing a plugin for the cfg80211_tx_mlme_mgmt trace
event, and was not able to get the implemented function working.
The event's print fmt looks like:
"netdev:%s(%d), ftype:0x%.2x", REC->name, REC->ifindex,
__le16_to_cpup((__le16 *)__get_dynamic_array(frame))
As there's no helper function for __le16_to_cpup(), Jiri was creating one
with a plugin. But unfortunately, it would not work even though he set
up the plugin correctly.
The problem is that the function parameters do not handle the helper
function "__get_dynamic_array()", and that passes in a NULL pointer.
Adding PRINT_DYNAMIC_ARRAY direct support to eval_num_arg() allows the
use of __get_dynamic_array() in function parameters.
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20131111160810.0ba9df7d@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 8f450ad..0362d57 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3435,6 +3435,19 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
goto out_warning_op;
}
break;
+ case PRINT_DYNAMIC_ARRAY:
+ /* Without [], we pass the address to the dynamic data */
+ offset = pevent_read_number(pevent,
+ data + arg->dynarray.field->offset,
+ arg->dynarray.field->size);
+ /*
+ * The actual length of the dynamic array is stored
+ * in the top half of the field, and the offset
+ * is in the bottom half of the 32 bit field.
+ */
+ offset &= 0xffff;
+ val = (unsigned long long)(data + offset);
+ break;
default: /* not sure what to do there */
return 0;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-12 21:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-11 21:08 [PATCH] tools lib traceevent: Add direct access to dynamic arrays Steven Rostedt
2013-11-12 9:46 ` Jiri Olsa
2013-11-12 21:57 ` [tip:perf/urgent] " tip-bot for Steven Rostedt
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).