public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Li Zefan <lizf@cn.fujitsu.com>, Jason Baron <jbaron@redhat.com>,
	Masami Hiramatsu <mhiramat@redhat.com>
Subject: Re: [PATCH 2/2] tracing: Allocate the ftrace event profile buffer dynamically
Date: Fri, 18 Sep 2009 06:31:44 +0200	[thread overview]
Message-ID: <20090918043143.GA5186@nowhere> (raw)
In-Reply-To: <1253247854-5496-3-git-send-email-fweisbec@gmail.com>

On Fri, Sep 18, 2009 at 06:24:14AM +0200, Frederic Weisbecker wrote:
>  static void prof_syscall_enter(struct pt_regs *regs, long id)
>  {
> -	struct syscall_trace_enter *rec;
>  	struct syscall_metadata *sys_data;
> +	struct syscall_trace_enter *rec;
> +	char *raw_data;
>  	int syscall_nr;
>  	int size;
> +	int cpu;
>  
>  	syscall_nr = syscall_get_nr(current, regs);
>  	if (!test_bit(syscall_nr, enabled_prof_enter_syscalls))
> @@ -402,20 +404,39 @@ static void prof_syscall_enter(struct pt_regs *regs, long id)
>  	size = ALIGN(size + sizeof(u32), sizeof(u64));
>  	size -= sizeof(u32);
>  
> -	do {
> -		char raw_data[size];
> +	if (WARN_ONCE(size > FTRACE_MAX_PROFILE_SIZE,
> +		      "profile buffer not large enough"))
> +		return;
> +
> +	/*
> +	 * We are not in nmi. Also we can't be preempted by a sysenter event
> +	 * from interrupt, so we can safely take this buffer without
> +	 * masking interrupts. But we still need rcu_read_lock to protect
> +	 * against concurrent buffer release.
> +	 */
> +	rcu_read_lock();



Oh...now that we use a global buffer, the buffer is not safe anymore against
interrupts or NMIs.

Looks like I will need a third iteration.

Sorry for the noise...


      reply	other threads:[~2009-09-18  4:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18  1:33 [PATCH 0/2] tracing: Tracing event profiling updates Frederic Weisbecker
2009-09-18  1:33 ` [PATCH 1/2] tracing: Factorize the events profile accounting Frederic Weisbecker
2009-09-18  2:15   ` Steven Rostedt
2009-09-18  3:45   ` Li Zefan
2009-09-18  1:33 ` [PATCH 2/2] tracing: Allocate the ftrace event profile buffer dynamically Frederic Weisbecker
2009-09-18  2:15   ` Steven Rostedt
2009-09-18  2:23     ` Frederic Weisbecker
2009-09-18  4:24 ` [PATCH 0/2 v2] tracing: Tracing event profiling updates Frederic Weisbecker
2009-09-18  5:36   ` [PATCH 0/2 v3] " Frederic Weisbecker
2009-09-19  7:34     ` Ingo Molnar
2009-09-19  8:03       ` Frederic Weisbecker
2009-09-18  5:36   ` [PATCH 2/2 v3] tracing: Allocate the ftrace event profile buffer dynamically Frederic Weisbecker
2009-09-18  4:24 ` [PATCH 1/2] tracing: Factorize the events profile accounting Frederic Weisbecker
2009-09-18  4:24 ` [PATCH 2/2] tracing: Allocate the ftrace event profile buffer dynamically Frederic Weisbecker
2009-09-18  4:31   ` Frederic Weisbecker [this message]

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=20090918043143.GA5186@nowhere \
    --to=fweisbec@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --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