* [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir
2019-06-12 18:19 [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Steven Rostedt
@ 2019-06-12 18:19 ` Steven Rostedt
2019-06-13 14:40 ` Tzvetomir Stoyanov
2019-06-12 18:19 ` [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance Steven Rostedt
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2019-06-12 18:19 UTC (permalink / raw)
To: linux-trace-devel
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
The order-only prerequisit to $(bdir)/include has a typo of "$(bidr)"
instead of being "$(bdir)"
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tracecmd/Makefile b/tracecmd/Makefile
index 93b373d58155..bcd437a26b98 100644
--- a/tracecmd/Makefile
+++ b/tracecmd/Makefile
@@ -47,7 +47,7 @@ all: $(TARGETS)
$(bdir):
@mkdir -p $(bdir)
-$(bdir)/include: | $(bidr)
+$(bdir)/include: | $(bdir)
@mkdir -p $(bdir)/include
$(TC_VERSION): force | $(bdir)/include
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir
2019-06-12 18:19 ` [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir Steven Rostedt
@ 2019-06-13 14:40 ` Tzvetomir Stoyanov
0 siblings, 0 replies; 9+ messages in thread
From: Tzvetomir Stoyanov @ 2019-06-13 14:40 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-trace-devel
On Wed, Jun 12, 2019 at 9:19 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> The order-only prerequisit to $(bdir)/include has a typo of "$(bidr)"
> instead of being "$(bdir)"
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
Looks OK to me
Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> tracecmd/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tracecmd/Makefile b/tracecmd/Makefile
> index 93b373d58155..bcd437a26b98 100644
> --- a/tracecmd/Makefile
> +++ b/tracecmd/Makefile
> @@ -47,7 +47,7 @@ all: $(TARGETS)
> $(bdir):
> @mkdir -p $(bdir)
>
> -$(bdir)/include: | $(bidr)
> +$(bdir)/include: | $(bdir)
> @mkdir -p $(bdir)/include
>
> $(TC_VERSION): force | $(bdir)/include
> --
> 2.20.1
>
>
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance
2019-06-12 18:19 [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Steven Rostedt
2019-06-12 18:19 ` [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir Steven Rostedt
@ 2019-06-12 18:19 ` Steven Rostedt
2019-06-13 14:48 ` Tzvetomir Stoyanov
2019-06-12 18:19 ` [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file() Steven Rostedt
2019-06-13 14:51 ` [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Slavomir Kaslev
3 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2019-06-12 18:19 UTC (permalink / raw)
To: linux-trace-devel
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
New kernels will allow function graph tracer to be used in an instance,
which means that the max_graph_depth file will be per instance and not just
the top level file. Make the max_graph_depth associated to the instance and
not part of the trace record context.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/include/trace-local.h | 2 ++
tracecmd/trace-record.c | 27 +++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index a1a06e9196b4..1cad3ccc4de7 100644
--- a/tracecmd/include/trace-local.h
+++ b/tracecmd/include/trace-local.h
@@ -183,6 +183,8 @@ struct buffer_instance {
struct tracecmd_msg_handle *msg_handle;
struct tracecmd_output *network_handle;
+ char *max_graph_depth;
+
int flags;
int tracing_on_init_val;
int tracing_on_fd;
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index ee35ada10d6e..2d716a81acbf 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -207,7 +207,6 @@ struct common_record_context {
struct buffer_instance *instance;
const char *output;
char *date2ts;
- char *max_graph_depth;
int data_flags;
int record_all;
@@ -4892,9 +4891,9 @@ static void parse_record_options(int argc,
ctx->data_flags |= DATA_FL_OFFSET;
break;
case OPT_max_graph_depth:
- free(ctx->max_graph_depth);
- ctx->max_graph_depth = strdup(optarg);
- if (!ctx->max_graph_depth)
+ free(ctx->instance->max_graph_depth);
+ ctx->instance->max_graph_depth = strdup(optarg);
+ if (!ctx->instance->max_graph_depth)
die("Could not allocate option");
break;
case OPT_no_filter:
@@ -5056,10 +5055,12 @@ static void record_trace(int argc, char **argv,
update_plugins(type);
set_options();
- if (ctx->max_graph_depth) {
- for_all_instances(instance)
- set_max_graph_depth(instance, ctx->max_graph_depth);
- free(ctx->max_graph_depth);
+ for_all_instances(instance) {
+ if (instance->max_graph_depth) {
+ set_max_graph_depth(instance, instance->max_graph_depth);
+ free(instance->max_graph_depth);
+ instance->max_graph_depth = NULL;
+ }
}
allocate_seq();
@@ -5155,10 +5156,12 @@ void trace_extract(int argc, char **argv)
update_plugins(type);
set_options();
- if (ctx.max_graph_depth) {
- for_all_instances(instance)
- set_max_graph_depth(instance, ctx.max_graph_depth);
- free(ctx.max_graph_depth);
+ for_all_instances(instance) {
+ if (instance->max_graph_depth) {
+ set_max_graph_depth(instance, instance->max_graph_depth);
+ free(instance->max_graph_depth);
+ instance->max_graph_depth = NULL;
+ }
}
allocate_seq();
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance
2019-06-12 18:19 ` [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance Steven Rostedt
@ 2019-06-13 14:48 ` Tzvetomir Stoyanov
0 siblings, 0 replies; 9+ messages in thread
From: Tzvetomir Stoyanov @ 2019-06-13 14:48 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-trace-devel
On Wed, Jun 12, 2019 at 9:19 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> New kernels will allow function graph tracer to be used in an instance,
> which means that the max_graph_depth file will be per instance and not just
> the top level file. Make the max_graph_depth associated to the instance and
> not part of the trace record context.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
Looks OK.
Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> tracecmd/include/trace-local.h | 2 ++
> tracecmd/trace-record.c | 27 +++++++++++++++------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
> index a1a06e9196b4..1cad3ccc4de7 100644
> --- a/tracecmd/include/trace-local.h
> +++ b/tracecmd/include/trace-local.h
> @@ -183,6 +183,8 @@ struct buffer_instance {
> struct tracecmd_msg_handle *msg_handle;
> struct tracecmd_output *network_handle;
>
> + char *max_graph_depth;
> +
> int flags;
> int tracing_on_init_val;
> int tracing_on_fd;
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index ee35ada10d6e..2d716a81acbf 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -207,7 +207,6 @@ struct common_record_context {
> struct buffer_instance *instance;
> const char *output;
> char *date2ts;
> - char *max_graph_depth;
> int data_flags;
>
> int record_all;
> @@ -4892,9 +4891,9 @@ static void parse_record_options(int argc,
> ctx->data_flags |= DATA_FL_OFFSET;
> break;
> case OPT_max_graph_depth:
> - free(ctx->max_graph_depth);
> - ctx->max_graph_depth = strdup(optarg);
> - if (!ctx->max_graph_depth)
> + free(ctx->instance->max_graph_depth);
> + ctx->instance->max_graph_depth = strdup(optarg);
> + if (!ctx->instance->max_graph_depth)
> die("Could not allocate option");
> break;
> case OPT_no_filter:
> @@ -5056,10 +5055,12 @@ static void record_trace(int argc, char **argv,
> update_plugins(type);
> set_options();
>
> - if (ctx->max_graph_depth) {
> - for_all_instances(instance)
> - set_max_graph_depth(instance, ctx->max_graph_depth);
> - free(ctx->max_graph_depth);
> + for_all_instances(instance) {
> + if (instance->max_graph_depth) {
> + set_max_graph_depth(instance, instance->max_graph_depth);
> + free(instance->max_graph_depth);
> + instance->max_graph_depth = NULL;
> + }
> }
>
> allocate_seq();
> @@ -5155,10 +5156,12 @@ void trace_extract(int argc, char **argv)
> update_plugins(type);
> set_options();
>
> - if (ctx.max_graph_depth) {
> - for_all_instances(instance)
> - set_max_graph_depth(instance, ctx.max_graph_depth);
> - free(ctx.max_graph_depth);
> + for_all_instances(instance) {
> + if (instance->max_graph_depth) {
> + set_max_graph_depth(instance, instance->max_graph_depth);
> + free(instance->max_graph_depth);
> + instance->max_graph_depth = NULL;
> + }
> }
>
> allocate_seq();
> --
> 2.20.1
>
>
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file()
2019-06-12 18:19 [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Steven Rostedt
2019-06-12 18:19 ` [PATCH 1/3] trace-cmd: Fix typo in Makefile bidr to bdir Steven Rostedt
2019-06-12 18:19 ` [PATCH 2/3] trace-cmd: Have --max-graph-depth only be part of instance Steven Rostedt
@ 2019-06-12 18:19 ` Steven Rostedt
2019-06-13 14:51 ` Tzvetomir Stoyanov
2019-06-13 14:51 ` [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Slavomir Kaslev
3 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2019-06-12 18:19 UTC (permalink / raw)
To: linux-trace-devel
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
If get_file_content() returns NULL, because the file does not exist or for
any other reason, it will cause add_reset_file() to trigger a SEGSEGV due to
using a NULL pointer. Only call add_reset_file() if get_file_content()
actually returns something.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/trace-record.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 2d716a81acbf..5dc6f17aa743 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -270,8 +270,10 @@ static void reset_save_file(const char *file, int prio)
char *content;
content = get_file_content(file);
- add_reset_file(file, content, prio);
- free(content);
+ if (content) {
+ add_reset_file(file, content, prio);
+ free(content);
+ }
}
/*
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file()
2019-06-12 18:19 ` [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file() Steven Rostedt
@ 2019-06-13 14:51 ` Tzvetomir Stoyanov
0 siblings, 0 replies; 9+ messages in thread
From: Tzvetomir Stoyanov @ 2019-06-13 14:51 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-trace-devel
On Wed, Jun 12, 2019 at 9:19 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> If get_file_content() returns NULL, because the file does not exist or for
> any other reason, it will cause add_reset_file() to trigger a SEGSEGV due to
> using a NULL pointer. Only call add_reset_file() if get_file_content()
> actually returns something.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
Looks OK.
Reviewed-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> tracecmd/trace-record.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index 2d716a81acbf..5dc6f17aa743 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -270,8 +270,10 @@ static void reset_save_file(const char *file, int prio)
> char *content;
>
> content = get_file_content(file);
> - add_reset_file(file, content, prio);
> - free(content);
> + if (content) {
> + add_reset_file(file, content, prio);
> + free(content);
> + }
> }
>
> /*
> --
> 2.20.1
>
>
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth
2019-06-12 18:19 [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Steven Rostedt
` (2 preceding siblings ...)
2019-06-12 18:19 ` [PATCH 3/3] trace-cmd: Check the return of get_file_content() before calling add_reset_file() Steven Rostedt
@ 2019-06-13 14:51 ` Slavomir Kaslev
2019-06-13 14:56 ` Steven Rostedt
3 siblings, 1 reply; 9+ messages in thread
From: Slavomir Kaslev @ 2019-06-13 14:51 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-trace-devel
On Wed, Jun 12, 2019 at 9:21 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
>
> Some last minute bugs that were found and fixed.
>
> Steven Rostedt (VMware) (3):
> trace-cmd: Fix typo in Makefile bidr to bdir
> trace-cmd: Have --max-graph-depth only be part of instance
> trace-cmd: Check the return of get_file_content() before calling add_reset_file()
>
> ----
> tracecmd/Makefile | 2 +-
> tracecmd/include/trace-local.h | 2 ++
> tracecmd/trace-record.c | 33 +++++++++++++++++++--------------
> 3 files changed, 22 insertions(+), 15 deletions(-)
Looks good to me.
Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com>
Cheers,
--Slavi
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth
2019-06-13 14:51 ` [PATCH 0/3] trace-cmd: Fix some bugs that include issues with --max-graph-depth Slavomir Kaslev
@ 2019-06-13 14:56 ` Steven Rostedt
0 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2019-06-13 14:56 UTC (permalink / raw)
To: Slavomir Kaslev; +Cc: slavomir.kaslev, linux-trace-devel, Tzvetomir Stoyanov
On Thu, 13 Jun 2019 14:51:48 +0000
Slavomir Kaslev <kaslevs@vmware.com> wrote:
> On Wed, Jun 12, 2019 at 9:21 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> >
> > Some last minute bugs that were found and fixed.
> >
> > Steven Rostedt (VMware) (3):
> > trace-cmd: Fix typo in Makefile bidr to bdir
> > trace-cmd: Have --max-graph-depth only be part of instance
> > trace-cmd: Check the return of get_file_content() before calling add_reset_file()
> >
> > ----
> > tracecmd/Makefile | 2 +-
> > tracecmd/include/trace-local.h | 2 ++
> > tracecmd/trace-record.c | 33 +++++++++++++++++++--------------
> > 3 files changed, 22 insertions(+), 15 deletions(-)
>
> Looks good to me.
>
> Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com>
>
Thanks Slavomir and Tzvetomir.
I'll add these patches now with both of your reviewed-bys.
-- Steve
^ permalink raw reply [flat|nested] 9+ messages in thread