linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] ftrace: Add initialization check in trace_printk for *puts paths
Date: Mon, 12 Aug 2013 18:01:55 +0800	[thread overview]
Message-ID: <5208B293.2030906@huawei.com> (raw)
In-Reply-To: <1376300045-3956-1-git-send-email-jolsa@redhat.com>

On 2013/8/12 17:34, Jiri Olsa wrote:
> Adding initialization check in trace_printk for *puts
> paths, plus unifying the check for all related cases.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> ---
Missed Signed-off-by tag?

>  kernel/trace/trace.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 882ec1d..cb7cf96 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -126,6 +126,9 @@ static char *default_bootup_tracer;
>  
>  static bool allocate_snapshot;
>  
> +#define TRACE_PRINTK_DENIED \
> +	unlikely(tracing_selftest_running || tracing_disabled)
> +
>  static int __init set_cmdline_ftrace(char *str)
>  {
>  	strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
> @@ -430,6 +433,9 @@ int __trace_puts(unsigned long ip, const char *str, int size)
>  	unsigned long irq_flags;
>  	int alloc;
>  
> +	if (TRACE_PRINTK_DENIED)
> +		return 0;
> +
>  	alloc = sizeof(*entry) + size + 2; /* possible \n added */
>  
>  	local_save_flags(irq_flags);
> @@ -470,6 +476,9 @@ int __trace_bputs(unsigned long ip, const char *str)
>  	unsigned long irq_flags;
>  	int size = sizeof(struct bputs_entry);
>  
> +	if (TRACE_PRINTK_DENIED)
> +		return 0;
> +
>  	local_save_flags(irq_flags);
>  	buffer = global_trace.trace_buffer.buffer;
>  	event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
> @@ -1757,7 +1766,7 @@ void trace_dump_stack(int skip)
>  {
>  	unsigned long flags;
>  
> -	if (tracing_disabled || tracing_selftest_running)
> +	if (TRACE_PRINTK_DENIED)
>  		return;
>  
>  	local_save_flags(flags);
> @@ -1976,7 +1985,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
>  	char *tbuffer;
>  	int len = 0, size, pc;
>  
> -	if (unlikely(tracing_selftest_running || tracing_disabled))
> +	if (TRACE_PRINTK_DENIED)
>  		return 0;
>  
>  	/* Don't pollute graph traces with trace_vprintk internals */
> @@ -2032,7 +2041,7 @@ __trace_array_vprintk(struct ring_buffer *buffer,
>  	unsigned long flags;
>  	char *tbuffer;
>  
> -	if (tracing_disabled || tracing_selftest_running)
> +	if (TRACE_PRINTK_DENIED)
>  		return 0;
>  
>  	/* Don't pollute graph traces with trace_vprintk internals */
> 



  reply	other threads:[~2013-08-12 10:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12  9:34 [PATCH] ftrace: Add initialization check in trace_printk for *puts paths Jiri Olsa
2013-08-12 10:01 ` zhangwei(Jovi) [this message]
2013-08-12 10:06   ` Jiri Olsa
2013-08-12 13:07 ` Steven Rostedt
2013-08-12 14:10   ` [PATCHv2] " Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5208B293.2030906@huawei.com \
    --to=jovi.zhangwei@huawei.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).