aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-08-13 16:35:18 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 20:32:23 -0400
commita82378d8802717b9776a7d9b54422f65c414d6cc (patch)
treecfc2dde97382f9eea5a765b23ffd07a61fa2ede3 /kernel/trace
parentd8ec91850efaf6cee9234c80260fe03881242374 (diff)
tracing: Kprobe-tracer supports more than 6 arguments
Support up to 128 arguments to fetch for each kprobes event. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Avi Kivity <avi@redhat.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jason Baron <jbaron@redhat.com> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Przemysław Pawełczyk <przemyslaw@pawelczyk.it> Cc: Roland McGrath <roland@redhat.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Vegard Nossum <vegard.nossum@gmail.com> LKML-Reference: <20090813203518.31965.96979.stgit@localhost.localdomain> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_kprobe.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0c4f00aafb92..6d488efd16b2 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -32,7 +32,7 @@
32#include "trace.h" 32#include "trace.h"
33#include "trace_output.h" 33#include "trace_output.h"
34 34
35#define TRACE_KPROBE_ARGS 6 35#define MAX_TRACE_ARGS 128
36#define MAX_ARGSTR_LEN 63 36#define MAX_ARGSTR_LEN 63
37 37
38/* currently, trace_kprobe only supports X86. */ 38/* currently, trace_kprobe only supports X86. */
@@ -184,11 +184,15 @@ struct trace_probe {
184 struct kretprobe rp; 184 struct kretprobe rp;
185 }; 185 };
186 const char *symbol; /* symbol name */ 186 const char *symbol; /* symbol name */
187 unsigned int nr_args;
188 struct fetch_func args[TRACE_KPROBE_ARGS];
189 struct ftrace_event_call call; 187 struct ftrace_event_call call;
188 unsigned int nr_args;
189 struct fetch_func args[];
190}; 190};
191 191
192#define SIZEOF_TRACE_PROBE(n) \
193 (offsetof(struct trace_probe, args) + \
194 (sizeof(struct fetch_func) * (n)))
195
192static int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs); 196static int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs);
193static int kretprobe_trace_func(struct kretprobe_instance *ri, 197static int kretprobe_trace_func(struct kretprobe_instance *ri,
194 struct pt_regs *regs); 198 struct pt_regs *regs);
@@ -263,11 +267,11 @@ static DEFINE_MUTEX(probe_lock);
263static LIST_HEAD(probe_list); 267static LIST_HEAD(probe_list);
264 268
265static struct trace_probe *alloc_trace_probe(const char *symbol, 269static struct trace_probe *alloc_trace_probe(const char *symbol,
266 const char *event) 270 const char *event, int nargs)
267{ 271{
268 struct trace_probe *tp; 272 struct trace_probe *tp;
269 273
270 tp = kzalloc(sizeof(struct trace_probe), GFP_KERNEL); 274 tp = kzalloc(SIZEOF_TRACE_PROBE(nargs), GFP_KERNEL);
271 if (!tp) 275 if (!tp)
272 return ERR_PTR(-ENOMEM); 276 return ERR_PTR(-ENOMEM);
273 277
@@ -573,9 +577,10 @@ static int create_trace_probe(int argc, char **argv)
573 if (offset && is_return) 577 if (offset && is_return)
574 return -EINVAL; 578 return -EINVAL;
575 } 579 }
580 argc -= 2; argv += 2;
576 581
577 /* setup a probe */ 582 /* setup a probe */
578 tp = alloc_trace_probe(symbol, event); 583 tp = alloc_trace_probe(symbol, event, argc);
579 if (IS_ERR(tp)) 584 if (IS_ERR(tp))
580 return PTR_ERR(tp); 585 return PTR_ERR(tp);
581 586
@@ -594,8 +599,8 @@ static int create_trace_probe(int argc, char **argv)
594 kp->addr = addr; 599 kp->addr = addr;
595 600
596 /* parse arguments */ 601 /* parse arguments */
597 argc -= 2; argv += 2; ret = 0; 602 ret = 0;
598 for (i = 0; i < argc && i < TRACE_KPROBE_ARGS; i++) { 603 for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
599 if (strlen(argv[i]) > MAX_ARGSTR_LEN) { 604 if (strlen(argv[i]) > MAX_ARGSTR_LEN) {
600 pr_info("Argument%d(%s) is too long.\n", i, argv[i]); 605 pr_info("Argument%d(%s) is too long.\n", i, argv[i]);
601 ret = -ENOSPC; 606 ret = -ENOSPC;