[for-next][PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2014-01-02 Thread Steven Rostedt
From: Namhyung Kim 

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu 
Acked-by: Srikar Dronamraju 
Acked-by: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d..afda372 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu->call.class = >class;
-   tu->call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu->call.name)
+   tu->tp.call.class = >tp.class;
+   tu->tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu->tp.call.name)
goto error;
 
-   tu->class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu->class.system)
+   tu->tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu->tp.class.system)
goto error;
 
INIT_LIST_HEAD(>list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu->consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(>filter);
-   tu->call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu->tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu->call.name);
+   kfree(tu->tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i < tu->nr_args; i++)
-   traceprobe_free_probe_arg(>args[i]);
+   for (i = 0; i < tu->tp.nr_args; i++)
+   traceprobe_free_probe_arg(>tp.args[i]);
 
iput(tu->inode);
-   kfree(tu->call.class->system);
-   kfree(tu->call.name);
+   kfree(tu->tp.call.class->system);
+   kfree(tu->tp.call.name);
kfree(tu->filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, _list, list)
-   if (strcmp(tu->call.name, event) == 0 &&
-   strcmp(tu->call.class->system, group) == 0)
+   if (strcmp(tu->tp.call.name, event) == 0 &&
+   strcmp(tu->tp.call.class->system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu->call.name, tu->call.class->system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu->tp.call.name, tu->tp.call.class->system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = >tp.args[i];
+
/* Increment count for freeing args in error case */
-   tu->nr_args++;
+   tu->tp.nr_args++;
 

[for-next][PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2014-01-02 Thread Steven Rostedt
From: Namhyung Kim namhyung@lge.com

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Acked-by: Srikar Dronamraju sri...@linux.vnet.ibm.com
Acked-by: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d..afda372 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu-call.class = tu-class;
-   tu-call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu-call.name)
+   tu-tp.call.class = tu-tp.class;
+   tu-tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu-tp.call.name)
goto error;
 
-   tu-class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu-class.system)
+   tu-tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu-tp.class.system)
goto error;
 
INIT_LIST_HEAD(tu-list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu-consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(tu-filter);
-   tu-call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu-tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu-call.name);
+   kfree(tu-tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i  tu-nr_args; i++)
-   traceprobe_free_probe_arg(tu-args[i]);
+   for (i = 0; i  tu-tp.nr_args; i++)
+   traceprobe_free_probe_arg(tu-tp.args[i]);
 
iput(tu-inode);
-   kfree(tu-call.class-system);
-   kfree(tu-call.name);
+   kfree(tu-tp.call.class-system);
+   kfree(tu-tp.call.name);
kfree(tu-filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, uprobe_list, list)
-   if (strcmp(tu-call.name, event) == 0 
-   strcmp(tu-call.class-system, group) == 0)
+   if (strcmp(tu-tp.call.name, event) == 0 
+   strcmp(tu-tp.call.class-system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(uprobe_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu-call.name, tu-call.class-system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu-tp.call.name, tu-tp.call.class-system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i  argc  i  MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = tu-tp.args[i];
+

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-12-15 Thread Namhyung Kim
From: Namhyung Kim 

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu 
Acked-by: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..afda3726f288 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu->call.class = >class;
-   tu->call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu->call.name)
+   tu->tp.call.class = >tp.class;
+   tu->tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu->tp.call.name)
goto error;
 
-   tu->class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu->class.system)
+   tu->tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu->tp.class.system)
goto error;
 
INIT_LIST_HEAD(>list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu->consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(>filter);
-   tu->call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu->tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu->call.name);
+   kfree(tu->tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i < tu->nr_args; i++)
-   traceprobe_free_probe_arg(>args[i]);
+   for (i = 0; i < tu->tp.nr_args; i++)
+   traceprobe_free_probe_arg(>tp.args[i]);
 
iput(tu->inode);
-   kfree(tu->call.class->system);
-   kfree(tu->call.name);
+   kfree(tu->tp.call.class->system);
+   kfree(tu->tp.call.name);
kfree(tu->filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, _list, list)
-   if (strcmp(tu->call.name, event) == 0 &&
-   strcmp(tu->call.class->system, group) == 0)
+   if (strcmp(tu->tp.call.name, event) == 0 &&
+   strcmp(tu->tp.call.class->system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu->call.name, tu->call.class->system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu->tp.call.name, tu->tp.call.class->system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = >tp.args[i];
+
/* Increment count for freeing args in error case */
-   tu->nr_args++;
+   tu->tp.nr_args++;
 

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-12-15 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Acked-by: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..afda3726f288 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu-call.class = tu-class;
-   tu-call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu-call.name)
+   tu-tp.call.class = tu-tp.class;
+   tu-tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu-tp.call.name)
goto error;
 
-   tu-class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu-class.system)
+   tu-tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu-tp.class.system)
goto error;
 
INIT_LIST_HEAD(tu-list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu-consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(tu-filter);
-   tu-call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu-tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu-call.name);
+   kfree(tu-tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i  tu-nr_args; i++)
-   traceprobe_free_probe_arg(tu-args[i]);
+   for (i = 0; i  tu-tp.nr_args; i++)
+   traceprobe_free_probe_arg(tu-tp.args[i]);
 
iput(tu-inode);
-   kfree(tu-call.class-system);
-   kfree(tu-call.name);
+   kfree(tu-tp.call.class-system);
+   kfree(tu-tp.call.name);
kfree(tu-filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, uprobe_list, list)
-   if (strcmp(tu-call.name, event) == 0 
-   strcmp(tu-call.class-system, group) == 0)
+   if (strcmp(tu-tp.call.name, event) == 0 
+   strcmp(tu-tp.call.class-system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(uprobe_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu-call.name, tu-call.class-system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu-tp.call.name, tu-tp.call.class-system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i  argc  i  MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = tu-tp.args[i];
+

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-12-08 Thread Namhyung Kim
From: Namhyung Kim 

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu 
Acked-by: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..afda3726f288 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu->call.class = >class;
-   tu->call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu->call.name)
+   tu->tp.call.class = >tp.class;
+   tu->tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu->tp.call.name)
goto error;
 
-   tu->class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu->class.system)
+   tu->tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu->tp.class.system)
goto error;
 
INIT_LIST_HEAD(>list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu->consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(>filter);
-   tu->call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu->tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu->call.name);
+   kfree(tu->tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i < tu->nr_args; i++)
-   traceprobe_free_probe_arg(>args[i]);
+   for (i = 0; i < tu->tp.nr_args; i++)
+   traceprobe_free_probe_arg(>tp.args[i]);
 
iput(tu->inode);
-   kfree(tu->call.class->system);
-   kfree(tu->call.name);
+   kfree(tu->tp.call.class->system);
+   kfree(tu->tp.call.name);
kfree(tu->filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, _list, list)
-   if (strcmp(tu->call.name, event) == 0 &&
-   strcmp(tu->call.class->system, group) == 0)
+   if (strcmp(tu->tp.call.name, event) == 0 &&
+   strcmp(tu->tp.call.class->system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu->call.name, tu->call.class->system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu->tp.call.name, tu->tp.call.class->system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = >tp.args[i];
+
/* Increment count for freeing args in error case */
-   tu->nr_args++;
+   tu->tp.nr_args++;
 

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-12-08 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Acked-by: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_uprobe.c | 159 ++--
 1 file changed, 79 insertions(+), 80 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..afda3726f288 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  tp;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, tp.args) +   \
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu-call.class = tu-class;
-   tu-call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu-call.name)
+   tu-tp.call.class = tu-tp.class;
+   tu-tp.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu-tp.call.name)
goto error;
 
-   tu-class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu-class.system)
+   tu-tp.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu-tp.class.system)
goto error;
 
INIT_LIST_HEAD(tu-list);
@@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (is_ret)
tu-consumer.ret_handler = uretprobe_dispatcher;
init_trace_uprobe_filter(tu-filter);
-   tu-call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
+   tu-tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER;
return tu;
 
 error:
-   kfree(tu-call.name);
+   kfree(tu-tp.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i  tu-nr_args; i++)
-   traceprobe_free_probe_arg(tu-args[i]);
+   for (i = 0; i  tu-tp.nr_args; i++)
+   traceprobe_free_probe_arg(tu-tp.args[i]);
 
iput(tu-inode);
-   kfree(tu-call.class-system);
-   kfree(tu-call.name);
+   kfree(tu-tp.call.class-system);
+   kfree(tu-tp.call.name);
kfree(tu-filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, uprobe_list, list)
-   if (strcmp(tu-call.name, event) == 0 
-   strcmp(tu-call.class-system, group) == 0)
+   if (strcmp(tu-tp.call.name, event) == 0 
+   strcmp(tu-tp.call.class-system, group) == 0)
return tu;
 
return NULL;
@@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe 
*tu)
 /* Register a trace_uprobe and probe_event */
 static int register_trace_uprobe(struct trace_uprobe *tu)
 {
-   struct trace_uprobe *old_tp;
+   struct trace_uprobe *old_tu;
int ret;
 
mutex_lock(uprobe_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu-call.name, tu-call.class-system);
-   if (old_tp) {
+   old_tu = find_probe_event(tu-tp.call.name, tu-tp.call.class-system);
+   if (old_tu) {
/* delete old event */
-   ret = unregister_trace_uprobe(old_tp);
+   ret = unregister_trace_uprobe(old_tu);
if (ret)
goto end;
}
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i  argc  i  MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = tu-tp.args[i];
+

Re: [PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-11-29 Thread Srikar Dronamraju
* Namhyung Kim  [2013-11-27 15:19:50]:

> From: Namhyung Kim 
> 
> Convert struct trace_uprobe to make use of the common trace_probe
> structure.
> 
> Reviewed-by: Masami Hiramatsu 
> Cc: Srikar Dronamraju 
> Cc: Oleg Nesterov 
> Cc: zhangwei(Jovi) 
> Cc: Arnaldo Carvalho de Melo 
> Signed-off-by: Namhyung Kim 

Acked-by: Srikar Dronamraju 

> ---

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-11-29 Thread Srikar Dronamraju
* Namhyung Kim namhy...@kernel.org [2013-11-27 15:19:50]:

 From: Namhyung Kim namhyung@lge.com
 
 Convert struct trace_uprobe to make use of the common trace_probe
 structure.
 
 Reviewed-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
 Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
 Cc: Oleg Nesterov o...@redhat.com
 Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
 Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
 Signed-off-by: Namhyung Kim namhy...@kernel.org

Acked-by: Srikar Dronamraju sri...@linux.vnet.ibm.com

 ---

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim 

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu 
Cc: Srikar Dronamraju 
Cc: Oleg Nesterov 
Cc: zhangwei(Jovi) 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Namhyung Kim 
---
 kernel/trace/trace_uprobe.c | 151 ++--
 1 file changed, 75 insertions(+), 76 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..3b2885ef47c9 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  p;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, p.args) +\
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu->call.class = >class;
-   tu->call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu->call.name)
+   tu->p.call.class = >p.class;
+   tu->p.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu->p.call.name)
goto error;
 
-   tu->class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu->class.system)
+   tu->p.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu->p.class.system)
goto error;
 
INIT_LIST_HEAD(>list);
@@ -132,7 +127,7 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
return tu;
 
 error:
-   kfree(tu->call.name);
+   kfree(tu->p.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i < tu->nr_args; i++)
-   traceprobe_free_probe_arg(>args[i]);
+   for (i = 0; i < tu->p.nr_args; i++)
+   traceprobe_free_probe_arg(>p.args[i]);
 
iput(tu->inode);
-   kfree(tu->call.class->system);
-   kfree(tu->call.name);
+   kfree(tu->p.call.class->system);
+   kfree(tu->p.call.name);
kfree(tu->filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, _list, list)
-   if (strcmp(tu->call.name, event) == 0 &&
-   strcmp(tu->call.class->system, group) == 0)
+   if (strcmp(tu->p.call.name, event) == 0 &&
+   strcmp(tu->p.call.class->system, group) == 0)
return tu;
 
return NULL;
@@ -187,7 +182,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
mutex_lock(_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu->call.name, tu->call.class->system);
+   old_tp = find_probe_event(tu->p.call.name, tu->p.call.class->system);
if (old_tp) {
/* delete old event */
ret = unregister_trace_uprobe(old_tp);
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = >p.args[i];
+
/* Increment count for freeing args in error case */
-   tu->nr_args++;
+   tu->p.nr_args++;
 
/* Parse argument name */
arg = strchr(argv[i], '=');
if (arg) {
*arg++ = '\0';
-   tu->args[i].name = kstrdup(argv[i], GFP_KERNEL);
+   parg->name = kstrdup(argv[i], GFP_KERNEL);
} else {
arg = argv[i];
/* If argument name is omitted, set "argN" */
snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1);
-   tu->args[i].name = kstrdup(buf, GFP_KERNEL);
+   parg->name = kstrdup(buf, 

[PATCH 04/17] tracing/uprobes: Convert to struct trace_probe

2013-11-26 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Convert struct trace_uprobe to make use of the common trace_probe
structure.

Reviewed-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Srikar Dronamraju sri...@linux.vnet.ibm.com
Cc: Oleg Nesterov o...@redhat.com
Cc: zhangwei(Jovi) jovi.zhang...@huawei.com
Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 kernel/trace/trace_uprobe.c | 151 ++--
 1 file changed, 75 insertions(+), 76 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c77b92d61551..3b2885ef47c9 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -51,22 +51,17 @@ struct trace_uprobe_filter {
  */
 struct trace_uprobe {
struct list_headlist;
-   struct ftrace_event_class   class;
-   struct ftrace_event_callcall;
struct trace_uprobe_filter  filter;
struct uprobe_consumer  consumer;
struct inode*inode;
char*filename;
unsigned long   offset;
unsigned long   nhit;
-   unsigned intflags;  /* For TP_FLAG_* */
-   ssize_t size;   /* trace entry size */
-   unsigned intnr_args;
-   struct probe_argargs[];
+   struct trace_probe  p;
 };
 
-#define SIZEOF_TRACE_UPROBE(n) \
-   (offsetof(struct trace_uprobe, args) +  \
+#define SIZEOF_TRACE_UPROBE(n) \
+   (offsetof(struct trace_uprobe, p.args) +\
(sizeof(struct probe_arg) * (n)))
 
 static int register_uprobe_event(struct trace_uprobe *tu);
@@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
if (!tu)
return ERR_PTR(-ENOMEM);
 
-   tu-call.class = tu-class;
-   tu-call.name = kstrdup(event, GFP_KERNEL);
-   if (!tu-call.name)
+   tu-p.call.class = tu-p.class;
+   tu-p.call.name = kstrdup(event, GFP_KERNEL);
+   if (!tu-p.call.name)
goto error;
 
-   tu-class.system = kstrdup(group, GFP_KERNEL);
-   if (!tu-class.system)
+   tu-p.class.system = kstrdup(group, GFP_KERNEL);
+   if (!tu-p.class.system)
goto error;
 
INIT_LIST_HEAD(tu-list);
@@ -132,7 +127,7 @@ alloc_trace_uprobe(const char *group, const char *event, 
int nargs, bool is_ret)
return tu;
 
 error:
-   kfree(tu-call.name);
+   kfree(tu-p.call.name);
kfree(tu);
 
return ERR_PTR(-ENOMEM);
@@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
 {
int i;
 
-   for (i = 0; i  tu-nr_args; i++)
-   traceprobe_free_probe_arg(tu-args[i]);
+   for (i = 0; i  tu-p.nr_args; i++)
+   traceprobe_free_probe_arg(tu-p.args[i]);
 
iput(tu-inode);
-   kfree(tu-call.class-system);
-   kfree(tu-call.name);
+   kfree(tu-p.call.class-system);
+   kfree(tu-p.call.name);
kfree(tu-filename);
kfree(tu);
 }
@@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char 
*event, const char *grou
struct trace_uprobe *tu;
 
list_for_each_entry(tu, uprobe_list, list)
-   if (strcmp(tu-call.name, event) == 0 
-   strcmp(tu-call.class-system, group) == 0)
+   if (strcmp(tu-p.call.name, event) == 0 
+   strcmp(tu-p.call.class-system, group) == 0)
return tu;
 
return NULL;
@@ -187,7 +182,7 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
mutex_lock(uprobe_lock);
 
/* register as an event */
-   old_tp = find_probe_event(tu-call.name, tu-call.class-system);
+   old_tp = find_probe_event(tu-p.call.name, tu-p.call.class-system);
if (old_tp) {
/* delete old event */
ret = unregister_trace_uprobe(old_tp);
@@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i  argc  i  MAX_TRACE_ARGS; i++) {
+   struct probe_arg *parg = tu-p.args[i];
+
/* Increment count for freeing args in error case */
-   tu-nr_args++;
+   tu-p.nr_args++;
 
/* Parse argument name */
arg = strchr(argv[i], '=');
if (arg) {
*arg++ = '\0';
-   tu-args[i].name = kstrdup(argv[i], GFP_KERNEL);
+   parg-name = kstrdup(argv[i], GFP_KERNEL);
} else {
arg = argv[i];
/* If argument name is omitted, set argN */
snprintf(buf, MAX_EVENT_NAME_LEN, arg%d, i + 1);