* [PATCH -tip] ftrace: fix trace_output
@ 2009-01-12 3:06 Lai Jiangshan
2009-01-14 18:24 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Lai Jiangshan @ 2009-01-12 3:06 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar, Linux Kernel Mailing List
Impact: fix bug for handling partial line
trace_seq_printf(), seq_print_userip_objs(), ... return
0 -- partial line was written
other(>0) -- success
duplicate output is also removed in trace_print_raw().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index df0c25c..c688c16 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -443,9 +443,9 @@ trace_fn_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
if (trace_seq_printf(s, "%x %x\n",
field->ip,
field->parent_ip))
- return TRACE_TYPE_PARTIAL_LINE;
+ return 0;
- return 0;
+ return TRACE_TYPE_PARTIAL_LINE;
}
static int
@@ -505,9 +505,9 @@ trace_ctxwake_print(struct trace_seq *s, struct trace_entry *entry, int flags,
field->next_pid,
field->next_prio,
T, comm))
- return TRACE_TYPE_PARTIAL_LINE;
+ return 0;
- return 0;
+ return TRACE_TYPE_PARTIAL_LINE;
}
static int
@@ -542,9 +542,9 @@ trace_ctxwake_raw(struct trace_seq *s, struct trace_entry *entry, int flags,
field->next_pid,
field->next_prio,
T))
- return TRACE_TYPE_PARTIAL_LINE;
+ return 0;
- return 0;
+ return TRACE_TYPE_PARTIAL_LINE;
}
static int
@@ -643,9 +643,9 @@ trace_special_print(struct trace_seq *s, struct trace_entry *entry, int flags)
field->arg1,
field->arg2,
field->arg3))
- return TRACE_TYPE_PARTIAL_LINE;
+ return 0;
- return 0;
+ return TRACE_TYPE_PARTIAL_LINE;
}
static int
@@ -697,13 +697,13 @@ trace_stack_print(struct trace_seq *s, struct trace_entry *entry, int flags)
for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
if (i) {
- if (trace_seq_puts(s, " <= "))
+ if (!trace_seq_puts(s, " <= "))
goto partial;
- if (seq_print_ip_sym(s, field->caller[i], flags))
+ if (!seq_print_ip_sym(s, field->caller[i], flags))
goto partial;
}
- if (trace_seq_puts(s, "\n"))
+ if (!trace_seq_puts(s, "\n"))
goto partial;
}
@@ -731,10 +731,10 @@ trace_user_stack_print(struct trace_seq *s, struct trace_entry *entry,
trace_assign_type(field, entry);
- if (seq_print_userip_objs(field, s, flags))
+ if (!seq_print_userip_objs(field, s, flags))
goto partial;
- if (trace_seq_putc(s, '\n'))
+ if (!trace_seq_putc(s, '\n'))
goto partial;
return 0;
@@ -760,10 +760,10 @@ trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (seq_print_ip_sym(s, field->ip, flags))
+ if (!seq_print_ip_sym(s, field->ip, flags))
goto partial;
- if (trace_seq_printf(s, ": %s", field->buf))
+ if (!trace_seq_printf(s, ": %s", field->buf))
goto partial;
return 0;
@@ -779,10 +779,7 @@ trace_print_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (seq_print_ip_sym(s, field->ip, flags))
- goto partial;
-
- if (trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
+ if (!trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
goto partial;
return 0;
diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
index ecab4ea..b2c1461 100644
--- a/kernel/trace/trace_output.h
+++ b/kernel/trace/trace_output.h
@@ -45,14 +45,14 @@ trace_nop_print(struct trace_seq *s, struct trace_entry *entry, int flags);
#define SEQ_PUT_FIELD_RET(s, x) \
do { \
if (!trace_seq_putmem(s, &(x), sizeof(x))) \
- return 0; \
+ return TRACE_TYPE_PARTIAL_LINE; \
} while (0)
#define SEQ_PUT_HEX_FIELD_RET(s, x) \
do { \
BUILD_BUG_ON(sizeof(x) > MAX_MEMHEX_BYTES); \
if (!trace_seq_putmem_hex(s, &(x), sizeof(x))) \
- return 0; \
+ return TRACE_TYPE_PARTIAL_LINE; \
} while (0)
#endif
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -tip] ftrace: fix trace_output
2009-01-12 3:06 [PATCH -tip] ftrace: fix trace_output Lai Jiangshan
@ 2009-01-14 18:24 ` Steven Rostedt
2009-01-15 10:05 ` Lai Jiangshan
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2009-01-14 18:24 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Ingo Molnar, Linux Kernel Mailing List
Hi Lai,
On Mon, 12 Jan 2009, Lai Jiangshan wrote:
>
> Impact: fix bug for handling partial line
>
> trace_seq_printf(), seq_print_userip_objs(), ... return
> 0 -- partial line was written
> other(>0) -- success
>
> duplicate output is also removed in trace_print_raw().
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index df0c25c..c688c16 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -443,9 +443,9 @@ trace_fn_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
> if (trace_seq_printf(s, "%x %x\n",
> field->ip,
> field->parent_ip))
> - return TRACE_TYPE_PARTIAL_LINE;
> + return 0;
Actually, could you change it to match the rest of the file.
That is to add the missing "!" instead of changing the two returns.
>
> - return 0;
> + return TRACE_TYPE_PARTIAL_LINE;
> }
>
> static int
> @@ -505,9 +505,9 @@ trace_ctxwake_print(struct trace_seq *s, struct trace_entry *entry, int flags,
> field->next_pid,
> field->next_prio,
> T, comm))
> - return TRACE_TYPE_PARTIAL_LINE;
> + return 0;
Here too.
>
> - return 0;
> + return TRACE_TYPE_PARTIAL_LINE;
> }
>
> static int
> @@ -542,9 +542,9 @@ trace_ctxwake_raw(struct trace_seq *s, struct trace_entry *entry, int flags,
> field->next_pid,
> field->next_prio,
> T))
> - return TRACE_TYPE_PARTIAL_LINE;
> + return 0;
and here.
>
> - return 0;
> + return TRACE_TYPE_PARTIAL_LINE;
> }
>
> static int
> @@ -643,9 +643,9 @@ trace_special_print(struct trace_seq *s, struct trace_entry *entry, int flags)
> field->arg1,
> field->arg2,
> field->arg3))
> - return TRACE_TYPE_PARTIAL_LINE;
> + return 0;
and here.
>
> - return 0;
> + return TRACE_TYPE_PARTIAL_LINE;
> }
>
> static int
> @@ -697,13 +697,13 @@ trace_stack_print(struct trace_seq *s, struct trace_entry *entry, int flags)
>
> for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
> if (i) {
> - if (trace_seq_puts(s, " <= "))
> + if (!trace_seq_puts(s, " <= "))
> goto partial;
This is good.
>
> - if (seq_print_ip_sym(s, field->caller[i], flags))
> + if (!seq_print_ip_sym(s, field->caller[i], flags))
> goto partial;
> }
> - if (trace_seq_puts(s, "\n"))
> + if (!trace_seq_puts(s, "\n"))
> goto partial;
> }
>
> @@ -731,10 +731,10 @@ trace_user_stack_print(struct trace_seq *s, struct trace_entry *entry,
>
> trace_assign_type(field, entry);
>
> - if (seq_print_userip_objs(field, s, flags))
> + if (!seq_print_userip_objs(field, s, flags))
> goto partial;
This is also good.
>
> - if (trace_seq_putc(s, '\n'))
> + if (!trace_seq_putc(s, '\n'))
> goto partial;
also good.
>
> return 0;
> @@ -760,10 +760,10 @@ trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags)
>
> trace_assign_type(field, entry);
>
> - if (seq_print_ip_sym(s, field->ip, flags))
> + if (!seq_print_ip_sym(s, field->ip, flags))
> goto partial;
>
> - if (trace_seq_printf(s, ": %s", field->buf))
> + if (!trace_seq_printf(s, ": %s", field->buf))
> goto partial;
>
> return 0;
> @@ -779,10 +779,7 @@ trace_print_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
>
> trace_assign_type(field, entry);
>
> - if (seq_print_ip_sym(s, field->ip, flags))
> - goto partial;
> -
> - if (trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
> + if (!trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
> goto partial;
The above looks good.
>
> return 0;
> diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
> index ecab4ea..b2c1461 100644
> --- a/kernel/trace/trace_output.h
> +++ b/kernel/trace/trace_output.h
> @@ -45,14 +45,14 @@ trace_nop_print(struct trace_seq *s, struct trace_entry *entry, int flags);
> #define SEQ_PUT_FIELD_RET(s, x) \
> do { \
> if (!trace_seq_putmem(s, &(x), sizeof(x))) \
> - return 0; \
> + return TRACE_TYPE_PARTIAL_LINE; \
> } while (0)
>
> #define SEQ_PUT_HEX_FIELD_RET(s, x) \
> do { \
> BUILD_BUG_ON(sizeof(x) > MAX_MEMHEX_BYTES); \
> if (!trace_seq_putmem_hex(s, &(x), sizeof(x))) \
> - return 0; \
> + return TRACE_TYPE_PARTIAL_LINE; \
> } while (0)
Ah, that is correct as well.
Thanks,
-- Steve
>
> #endif
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -tip] ftrace: fix trace_output
2009-01-14 18:24 ` Steven Rostedt
@ 2009-01-15 10:05 ` Lai Jiangshan
0 siblings, 0 replies; 3+ messages in thread
From: Lai Jiangshan @ 2009-01-15 10:05 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, Linux Kernel Mailing List
Impact: fix bug for handling partial line
trace_seq_printf(), seq_print_userip_objs(), ... return
0 -- partial line was written
other(>0) -- success
duplicate output is also removed in trace_print_raw().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index df0c25c..4e3ad36 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -440,9 +440,9 @@ trace_fn_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (trace_seq_printf(s, "%x %x\n",
- field->ip,
- field->parent_ip))
+ if (!trace_seq_printf(s, "%x %x\n",
+ field->ip,
+ field->parent_ip))
return TRACE_TYPE_PARTIAL_LINE;
return 0;
@@ -497,14 +497,14 @@ trace_ctxwake_print(struct trace_seq *s, struct trace_entry *entry, int flags,
T = task_state_char(field->next_state);
S = task_state_char(field->prev_state);
comm = trace_find_cmdline(field->next_pid);
- if (trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
- field->prev_pid,
- field->prev_prio,
- S, delim,
- field->next_cpu,
- field->next_pid,
- field->next_prio,
- T, comm))
+ if (!trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
+ field->prev_pid,
+ field->prev_prio,
+ S, delim,
+ field->next_cpu,
+ field->next_pid,
+ field->next_prio,
+ T, comm))
return TRACE_TYPE_PARTIAL_LINE;
return 0;
@@ -534,14 +534,14 @@ trace_ctxwake_raw(struct trace_seq *s, struct trace_entry *entry, int flags,
if (!S)
task_state_char(field->prev_state);
T = task_state_char(field->next_state);
- if (trace_seq_printf(s, "%d %d %c %d %d %d %c\n",
- field->prev_pid,
- field->prev_prio,
- S,
- field->next_cpu,
- field->next_pid,
- field->next_prio,
- T))
+ if (!trace_seq_printf(s, "%d %d %c %d %d %d %c\n",
+ field->prev_pid,
+ field->prev_prio,
+ S,
+ field->next_cpu,
+ field->next_pid,
+ field->next_prio,
+ T))
return TRACE_TYPE_PARTIAL_LINE;
return 0;
@@ -639,10 +639,10 @@ trace_special_print(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (trace_seq_printf(s, "# %ld %ld %ld\n",
- field->arg1,
- field->arg2,
- field->arg3))
+ if (!trace_seq_printf(s, "# %ld %ld %ld\n",
+ field->arg1,
+ field->arg2,
+ field->arg3))
return TRACE_TYPE_PARTIAL_LINE;
return 0;
@@ -697,13 +697,13 @@ trace_stack_print(struct trace_seq *s, struct trace_entry *entry, int flags)
for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
if (i) {
- if (trace_seq_puts(s, " <= "))
+ if (!trace_seq_puts(s, " <= "))
goto partial;
- if (seq_print_ip_sym(s, field->caller[i], flags))
+ if (!seq_print_ip_sym(s, field->caller[i], flags))
goto partial;
}
- if (trace_seq_puts(s, "\n"))
+ if (!trace_seq_puts(s, "\n"))
goto partial;
}
@@ -731,10 +731,10 @@ trace_user_stack_print(struct trace_seq *s, struct trace_entry *entry,
trace_assign_type(field, entry);
- if (seq_print_userip_objs(field, s, flags))
+ if (!seq_print_userip_objs(field, s, flags))
goto partial;
- if (trace_seq_putc(s, '\n'))
+ if (!trace_seq_putc(s, '\n'))
goto partial;
return 0;
@@ -760,10 +760,10 @@ trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (seq_print_ip_sym(s, field->ip, flags))
+ if (!seq_print_ip_sym(s, field->ip, flags))
goto partial;
- if (trace_seq_printf(s, ": %s", field->buf))
+ if (!trace_seq_printf(s, ": %s", field->buf))
goto partial;
return 0;
@@ -779,10 +779,7 @@ trace_print_raw(struct trace_seq *s, struct trace_entry *entry, int flags)
trace_assign_type(field, entry);
- if (seq_print_ip_sym(s, field->ip, flags))
- goto partial;
-
- if (trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
+ if (!trace_seq_printf(s, "# %lx %s", field->ip, field->buf))
goto partial;
return 0;
diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
index ecab4ea..b2c1461 100644
--- a/kernel/trace/trace_output.h
+++ b/kernel/trace/trace_output.h
@@ -45,14 +45,14 @@ trace_nop_print(struct trace_seq *s, struct trace_entry *entry, int flags);
#define SEQ_PUT_FIELD_RET(s, x) \
do { \
if (!trace_seq_putmem(s, &(x), sizeof(x))) \
- return 0; \
+ return TRACE_TYPE_PARTIAL_LINE; \
} while (0)
#define SEQ_PUT_HEX_FIELD_RET(s, x) \
do { \
BUILD_BUG_ON(sizeof(x) > MAX_MEMHEX_BYTES); \
if (!trace_seq_putmem_hex(s, &(x), sizeof(x))) \
- return 0; \
+ return TRACE_TYPE_PARTIAL_LINE; \
} while (0)
#endif
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-15 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-12 3:06 [PATCH -tip] ftrace: fix trace_output Lai Jiangshan
2009-01-14 18:24 ` Steven Rostedt
2009-01-15 10:05 ` Lai Jiangshan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox