2014-11-14 01:19:15

by Steven Rostedt

[permalink] [raw]
Subject: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

From: "Steven Rostedt (Red Hat)" <[email protected]>

The functions trace_seq_printf() and friends will soon no longer have
return values. Using trace_seq_has_overflowed() and trace_handle_return()
should be used instead.

Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Srikar Dronamraju <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
---
kernel/trace/trace_uprobe.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 33ff6a24b802..bd6007b13b52 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -852,31 +852,26 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
tu = container_of(event, struct trace_uprobe, tp.call.event);

if (is_ret_probe(tu)) {
- if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
- ftrace_event_name(&tu->tp.call),
- entry->vaddr[1], entry->vaddr[0]))
- goto partial;
+ trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
+ ftrace_event_name(&tu->tp.call),
+ entry->vaddr[1], entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, true);
} else {
- if (!trace_seq_printf(s, "%s: (0x%lx)",
- ftrace_event_name(&tu->tp.call),
- entry->vaddr[0]))
- goto partial;
+ trace_seq_printf(s, "%s: (0x%lx)",
+ ftrace_event_name(&tu->tp.call),
+ entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, false);
}

for (i = 0; i < tu->tp.nr_args; i++) {
struct probe_arg *parg = &tu->tp.args[i];

- if (!parg->type->print(s, parg->name, data + parg->offset, entry))
- goto partial;
+ parg->type->print(s, parg->name, data + parg->offset, entry);
}

- if (trace_seq_puts(s, "\n"))
- return TRACE_TYPE_HANDLED;
+ trace_seq_puts(s, "\n");

-partial:
- return TRACE_TYPE_PARTIAL_LINE;
+ return trace_handle_return(s);
}

typedef bool (*filter_func_t)(struct uprobe_consumer *self,
--
2.1.1


2014-11-14 05:24:07

by Srikar Dronamraju

[permalink] [raw]
Subject: Re: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

* Steven Rostedt <[email protected]> [2014-11-13 20:12:54]:

> From: "Steven Rostedt (Red Hat)" <[email protected]>
>
> The functions trace_seq_printf() and friends will soon no longer have
> return values. Using trace_seq_has_overflowed() and trace_handle_return()
> should be used instead.
>
> Cc: Masami Hiramatsu <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Cc: Srikar Dronamraju <[email protected]>
> Signed-off-by: Steven Rostedt <[email protected]>

Looks good to me.

Reviewed-by: Srikar Dronamraju <[email protected]>

--
Thanks and Regards
Srikar Dronamraju

Subject: Re: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

(2014/11/14 10:12), Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <[email protected]>
>
> The functions trace_seq_printf() and friends will soon no longer have
> return values. Using trace_seq_has_overflowed() and trace_handle_return()
> should be used instead.
>
> Cc: Masami Hiramatsu <[email protected]>
> Cc: Namhyung Kim <[email protected]>
> Cc: Srikar Dronamraju <[email protected]>
> Signed-off-by: Steven Rostedt <[email protected]>
> ---
> kernel/trace/trace_uprobe.c | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 33ff6a24b802..bd6007b13b52 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -852,31 +852,26 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
> tu = container_of(event, struct trace_uprobe, tp.call.event);
>
> if (is_ret_probe(tu)) {
> - if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
> - ftrace_event_name(&tu->tp.call),
> - entry->vaddr[1], entry->vaddr[0]))
> - goto partial;
> + trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
> + ftrace_event_name(&tu->tp.call),
> + entry->vaddr[1], entry->vaddr[0]);
> data = DATAOF_TRACE_ENTRY(entry, true);
> } else {
> - if (!trace_seq_printf(s, "%s: (0x%lx)",
> - ftrace_event_name(&tu->tp.call),
> - entry->vaddr[0]))
> - goto partial;
> + trace_seq_printf(s, "%s: (0x%lx)",
> + ftrace_event_name(&tu->tp.call),
> + entry->vaddr[0]);
> data = DATAOF_TRACE_ENTRY(entry, false);
> }
>
> for (i = 0; i < tu->tp.nr_args; i++) {
> struct probe_arg *parg = &tu->tp.args[i];
>
> - if (!parg->type->print(s, parg->name, data + parg->offset, entry))
> - goto partial;
> + parg->type->print(s, parg->name, data + parg->offset, entry);

In 7/23 you've left loop canceling path, why don't you do same thing here?

Thank you,

> }
>
> - if (trace_seq_puts(s, "\n"))
> - return TRACE_TYPE_HANDLED;
> + trace_seq_puts(s, "\n");
>
> -partial:
> - return TRACE_TYPE_PARTIAL_LINE;
> + return trace_handle_return(s);
> }
>
> typedef bool (*filter_func_t)(struct uprobe_consumer *self,



--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]

2014-11-14 15:37:57

by Steven Rostedt

[permalink] [raw]
Subject: Re: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

On Sat, 15 Nov 2014 00:35:15 +0900
Masami Hiramatsu <[email protected]> wrote:

> > for (i = 0; i < tu->tp.nr_args; i++) {
> > struct probe_arg *parg = &tu->tp.args[i];
> >
> > - if (!parg->type->print(s, parg->name, data + parg->offset, entry))
> > - goto partial;
> > + parg->type->print(s, parg->name, data + parg->offset, entry);
>
> In 7/23 you've left loop canceling path, why don't you do same thing here?

While rebasing this series on my latest code, this patch conflicted. I
notice the difference too (just two minutes ago!).

I agree, it should break out still.

Srikar, can I still have your Reviewed-by if I do that?

-- Steve

>
> Thank you,
>
> > }
> >
> > - if (trace_seq_puts(s, "\n"))
> > - return TRACE_TYPE_HANDLED;
> > + trace_seq_puts(s, "\n");
> >
> > -partial:
> > - return TRACE_TYPE_PARTIAL_LINE;
> > + return trace_handle_return(s);
> > }
> >
> > typedef bool (*filter_func_t)(struct uprobe_consumer *self,
>
>
>

2014-11-14 18:14:43

by Steven Rostedt

[permalink] [raw]
Subject: Re: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

On Fri, 14 Nov 2014 10:37:33 -0500
Steven Rostedt <[email protected]> wrote:

> On Sat, 15 Nov 2014 00:35:15 +0900
> Masami Hiramatsu <[email protected]> wrote:
>
> > > for (i = 0; i < tu->tp.nr_args; i++) {
> > > struct probe_arg *parg = &tu->tp.args[i];
> > >
> > > - if (!parg->type->print(s, parg->name, data + parg->offset, entry))
> > > - goto partial;
> > > + parg->type->print(s, parg->name, data + parg->offset, entry);
> >
> > In 7/23 you've left loop canceling path, why don't you do same thing here?
>
> While rebasing this series on my latest code, this patch conflicted. I
> notice the difference too (just two minutes ago!).
>
> I agree, it should break out still.
>
> Srikar, can I still have your Reviewed-by if I do that?
>

Here's the new patch:

-- Steve

>From cd883b4c2d5d68ec598d6c6a3b5dce4dd99a4cc1 Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (Red Hat)" <[email protected]>
Date: Wed, 12 Nov 2014 17:26:57 -0500
Subject: [PATCH] tracing/uprobes: Do not use return values of
trace_seq_printf()

The functions trace_seq_printf() and friends will soon no longer have
return values. Using trace_seq_has_overflowed() and trace_handle_return()
should be used instead.

Link: http://lkml.kernel.org/r/[email protected]

Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Srikar Dronamraju <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
---
kernel/trace/trace_uprobe.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index e35327c787f7..fd76f8e108ef 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -852,16 +852,14 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
tu = container_of(event, struct trace_uprobe, tp.call.event);

if (is_ret_probe(tu)) {
- if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
- ftrace_event_name(&tu->tp.call),
- entry->vaddr[1], entry->vaddr[0]))
- goto partial;
+ trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
+ ftrace_event_name(&tu->tp.call),
+ entry->vaddr[1], entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, true);
} else {
- if (!trace_seq_printf(s, "%s: (0x%lx)",
- ftrace_event_name(&tu->tp.call),
- entry->vaddr[0]))
- goto partial;
+ trace_seq_printf(s, "%s: (0x%lx)",
+ ftrace_event_name(&tu->tp.call),
+ entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, false);
}

@@ -869,14 +867,13 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
struct probe_arg *parg = &tu->tp.args[i];

if (!parg->type->print(s, parg->name, data + parg->offset, entry))
- goto partial;
+ goto out;
}

- if (trace_seq_putc(s, '\n'))
- return TRACE_TYPE_HANDLED;
+ trace_seq_putc(s, '\n');

-partial:
- return TRACE_TYPE_PARTIAL_LINE;
+ out:
+ return trace_handle_return(s);
}

typedef bool (*filter_func_t)(struct uprobe_consumer *self,
--
1.8.1.4

2014-11-18 00:32:43

by Namhyung Kim

[permalink] [raw]
Subject: Re: [RFC][PATCH 10/23 v4] tracing/uprobes: Do not use return values of trace_seq_printf()

On Fri, 14 Nov 2014 13:14:29 -0500, Steven Rostedt wrote:
> Here's the new patch:
>
> -- Steve
>
> From cd883b4c2d5d68ec598d6c6a3b5dce4dd99a4cc1 Mon Sep 17 00:00:00 2001
> From: "Steven Rostedt (Red Hat)" <[email protected]>
> Date: Wed, 12 Nov 2014 17:26:57 -0500
> Subject: [PATCH] tracing/uprobes: Do not use return values of
> trace_seq_printf()
>
> The functions trace_seq_printf() and friends will soon no longer have
> return values. Using trace_seq_has_overflowed() and trace_handle_return()
> should be used instead.
>
> Link: http://lkml.kernel.org/r/[email protected]
>
> Cc: Masami Hiramatsu <[email protected]>
> Cc: Srikar Dronamraju <[email protected]>
> Signed-off-by: Steven Rostedt <[email protected]>

Acked-by: Namhyung Kim <[email protected]>

Thanks,
Namhyung


> ---
> kernel/trace/trace_uprobe.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index e35327c787f7..fd76f8e108ef 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -852,16 +852,14 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
> tu = container_of(event, struct trace_uprobe, tp.call.event);
>
> if (is_ret_probe(tu)) {
> - if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
> - ftrace_event_name(&tu->tp.call),
> - entry->vaddr[1], entry->vaddr[0]))
> - goto partial;
> + trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
> + ftrace_event_name(&tu->tp.call),
> + entry->vaddr[1], entry->vaddr[0]);
> data = DATAOF_TRACE_ENTRY(entry, true);
> } else {
> - if (!trace_seq_printf(s, "%s: (0x%lx)",
> - ftrace_event_name(&tu->tp.call),
> - entry->vaddr[0]))
> - goto partial;
> + trace_seq_printf(s, "%s: (0x%lx)",
> + ftrace_event_name(&tu->tp.call),
> + entry->vaddr[0]);
> data = DATAOF_TRACE_ENTRY(entry, false);
> }
>
> @@ -869,14 +867,13 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
> struct probe_arg *parg = &tu->tp.args[i];
>
> if (!parg->type->print(s, parg->name, data + parg->offset, entry))
> - goto partial;
> + goto out;
> }
>
> - if (trace_seq_putc(s, '\n'))
> - return TRACE_TYPE_HANDLED;
> + trace_seq_putc(s, '\n');
>
> -partial:
> - return TRACE_TYPE_PARTIAL_LINE;
> + out:
> + return trace_handle_return(s);
> }
>
> typedef bool (*filter_func_t)(struct uprobe_consumer *self,