* [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs
@ 2013-07-18 8:31 zhangwei(Jovi)
2013-08-05 3:07 ` zhangwei(Jovi)
2014-07-09 18:40 ` Steven Rostedt
0 siblings, 2 replies; 3+ messages in thread
From: zhangwei(Jovi) @ 2013-07-18 8:31 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel
Currently trace option stacktrace is not applicable for
trace_printk with constant string argument, the reason is
there missed ftrace_trace_stack in __trace_puts/__trace_bputs.
In contrast, when using trace_printk with not constant string
argument(will call into __trace_printk/__trace_bprintk), then
trace option stacktrace is workable, this inconstant result
will confusing user a lot.
Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
---
kernel/trace/trace.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 3d5a931..4d70cc5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -363,13 +363,16 @@ int __trace_puts(unsigned long ip, const char *str, int size)
struct print_entry *entry;
unsigned long irq_flags;
int alloc;
+ int pc;
+
+ pc = preempt_count();
alloc = sizeof(*entry) + size + 2; /* possible \n added */
local_save_flags(irq_flags);
buffer = global_trace.trace_buffer.buffer;
event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
- irq_flags, preempt_count());
+ irq_flags, pc);
if (!event)
return 0;
@@ -386,6 +389,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
entry->buf[size] = '\0';
__buffer_unlock_commit(buffer, event);
+ ftrace_trace_stack(buffer, irq_flags, 4, pc);
return size;
}
@@ -403,11 +407,14 @@ int __trace_bputs(unsigned long ip, const char *str)
struct bputs_entry *entry;
unsigned long irq_flags;
int size = sizeof(struct bputs_entry);
+ int pc;
+
+ pc = preempt_count();
local_save_flags(irq_flags);
buffer = global_trace.trace_buffer.buffer;
event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
- irq_flags, preempt_count());
+ irq_flags, pc);
if (!event)
return 0;
@@ -416,6 +423,7 @@ int __trace_bputs(unsigned long ip, const char *str)
entry->str = str;
__buffer_unlock_commit(buffer, event);
+ ftrace_trace_stack(buffer, irq_flags, 4, pc);
return 1;
}
--
1.7.9.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs
2013-07-18 8:31 [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs zhangwei(Jovi)
@ 2013-08-05 3:07 ` zhangwei(Jovi)
2014-07-09 18:40 ` Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: zhangwei(Jovi) @ 2013-08-05 3:07 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel
On 2013/7/18 16:31, zhangwei(Jovi) wrote:
> Currently trace option stacktrace is not applicable for
> trace_printk with constant string argument, the reason is
> there missed ftrace_trace_stack in __trace_puts/__trace_bputs.
>
> In contrast, when using trace_printk with not constant string
> argument(will call into __trace_printk/__trace_bprintk), then
> trace option stacktrace is workable, this inconstant result
> will confusing user a lot.
>
Hi steven,
How about this patch?
and [PATCH 2/3] "tracing: add TRACE_ITER_PRINTK flag check in __trace_puts/__trace_bputs"
Thanks.
jovi.
> Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
> ---
> kernel/trace/trace.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 3d5a931..4d70cc5 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -363,13 +363,16 @@ int __trace_puts(unsigned long ip, const char *str, int size)
> struct print_entry *entry;
> unsigned long irq_flags;
> int alloc;
> + int pc;
> +
> + pc = preempt_count();
>
> alloc = sizeof(*entry) + size + 2; /* possible \n added */
>
> local_save_flags(irq_flags);
> buffer = global_trace.trace_buffer.buffer;
> event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
> - irq_flags, preempt_count());
> + irq_flags, pc);
> if (!event)
> return 0;
>
> @@ -386,6 +389,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
> entry->buf[size] = '\0';
>
> __buffer_unlock_commit(buffer, event);
> + ftrace_trace_stack(buffer, irq_flags, 4, pc);
>
> return size;
> }
> @@ -403,11 +407,14 @@ int __trace_bputs(unsigned long ip, const char *str)
> struct bputs_entry *entry;
> unsigned long irq_flags;
> int size = sizeof(struct bputs_entry);
> + int pc;
> +
> + pc = preempt_count();
>
> local_save_flags(irq_flags);
> buffer = global_trace.trace_buffer.buffer;
> event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
> - irq_flags, preempt_count());
> + irq_flags, pc);
> if (!event)
> return 0;
>
> @@ -416,6 +423,7 @@ int __trace_bputs(unsigned long ip, const char *str)
> entry->str = str;
>
> __buffer_unlock_commit(buffer, event);
> + ftrace_trace_stack(buffer, irq_flags, 4, pc);
>
> return 1;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs
2013-07-18 8:31 [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs zhangwei(Jovi)
2013-08-05 3:07 ` zhangwei(Jovi)
@ 2014-07-09 18:40 ` Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2014-07-09 18:40 UTC (permalink / raw)
To: zhangwei(Jovi); +Cc: Frederic Weisbecker, Ingo Molnar, linux-kernel
Wow! I some how missed your emails. I'm cleaning up my inbox and just
stumbled over them now.
I tell people, they can either ping me a few times (keep doing it until
you see a response, but spread them out). Otherwise, I will still get
to their email. Just a year later ;-)
Yeah, this looks fine. I can queue it up for 3.17.
-- Steve
On Thu, 18 Jul 2013 16:31:05 +0800
"zhangwei(Jovi)" <jovi.zhangwei@huawei.com> wrote:
> Currently trace option stacktrace is not applicable for
> trace_printk with constant string argument, the reason is
> there missed ftrace_trace_stack in __trace_puts/__trace_bputs.
>
> In contrast, when using trace_printk with not constant string
> argument(will call into __trace_printk/__trace_bprintk), then
> trace option stacktrace is workable, this inconstant result
> will confusing user a lot.
>
> Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
> ---
> kernel/trace/trace.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 3d5a931..4d70cc5 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -363,13 +363,16 @@ int __trace_puts(unsigned long ip, const char *str, int size)
> struct print_entry *entry;
> unsigned long irq_flags;
> int alloc;
> + int pc;
> +
> + pc = preempt_count();
>
> alloc = sizeof(*entry) + size + 2; /* possible \n added */
>
> local_save_flags(irq_flags);
> buffer = global_trace.trace_buffer.buffer;
> event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
> - irq_flags, preempt_count());
> + irq_flags, pc);
> if (!event)
> return 0;
>
> @@ -386,6 +389,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
> entry->buf[size] = '\0';
>
> __buffer_unlock_commit(buffer, event);
> + ftrace_trace_stack(buffer, irq_flags, 4, pc);
>
> return size;
> }
> @@ -403,11 +407,14 @@ int __trace_bputs(unsigned long ip, const char *str)
> struct bputs_entry *entry;
> unsigned long irq_flags;
> int size = sizeof(struct bputs_entry);
> + int pc;
> +
> + pc = preempt_count();
>
> local_save_flags(irq_flags);
> buffer = global_trace.trace_buffer.buffer;
> event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
> - irq_flags, preempt_count());
> + irq_flags, pc);
> if (!event)
> return 0;
>
> @@ -416,6 +423,7 @@ int __trace_bputs(unsigned long ip, const char *str)
> entry->str = str;
>
> __buffer_unlock_commit(buffer, event);
> + ftrace_trace_stack(buffer, irq_flags, 4, pc);
>
> return 1;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-09 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-18 8:31 [PATCH 1/3] tracing: add ftrace_trace_stack into __trace_puts/__trace_bputs zhangwei(Jovi)
2013-08-05 3:07 ` zhangwei(Jovi)
2014-07-09 18:40 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).