public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: Fix preempt count leak
@ 2010-12-09  7:47 Li Zefan
  2010-12-21  0:55 ` Li Zefan
  2011-01-09 21:11 ` [tip:perf/urgent] " tip-bot for Li Zefan
  0 siblings, 2 replies; 4+ messages in thread
From: Li Zefan @ 2010-12-09  7:47 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, Jiri Olsa, LKML, Hiroyuki KAMEZAWA

While running my ftrace stress test, this showed up:

BUG: sleeping function called from invalid context at mm/mmap.c:233
...
note: cat[3293] exited with preempt_count 1

The bug was introduced by commit 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e
("tracing: Fix recursive user stack trace")

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/trace/trace.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c380612..5767457 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 
 	__this_cpu_inc(user_stack_count);
 
-
-
 	event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
 					  sizeof(*entry), flags, pc);
 	if (!event)
-		return;
+		goto out_drop_count;
 	entry	= ring_buffer_event_data(event);
 
 	entry->tgid		= current->tgid;
@@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 	if (!filter_check_discard(call, entry, buffer, event))
 		ring_buffer_unlock_commit(buffer, event);
 
+ out_drop_count:
 	__this_cpu_dec(user_stack_count);
-
  out:
 	preempt_enable();
 }
-- 
1.6.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracing: Fix preempt count leak
  2010-12-09  7:47 [PATCH] tracing: Fix preempt count leak Li Zefan
@ 2010-12-21  0:55 ` Li Zefan
  2010-12-21  1:33   ` Steven Rostedt
  2011-01-09 21:11 ` [tip:perf/urgent] " tip-bot for Li Zefan
  1 sibling, 1 reply; 4+ messages in thread
From: Li Zefan @ 2010-12-21  0:55 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, Jiri Olsa, LKML, Hiroyuki KAMEZAWA

Any comment?

15:47, Li Zefan wrote:
> While running my ftrace stress test, this showed up:
> 
> BUG: sleeping function called from invalid context at mm/mmap.c:233
> ...
> note: cat[3293] exited with preempt_count 1
> 
> The bug was introduced by commit 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e
> ("tracing: Fix recursive user stack trace")
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
>  kernel/trace/trace.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index c380612..5767457 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
>  
>  	__this_cpu_inc(user_stack_count);
>  
> -
> -
>  	event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
>  					  sizeof(*entry), flags, pc);
>  	if (!event)
> -		return;
> +		goto out_drop_count;
>  	entry	= ring_buffer_event_data(event);
>  
>  	entry->tgid		= current->tgid;
> @@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
>  	if (!filter_check_discard(call, entry, buffer, event))
>  		ring_buffer_unlock_commit(buffer, event);
>  
> + out_drop_count:
>  	__this_cpu_dec(user_stack_count);
> -
>   out:
>  	preempt_enable();
>  }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracing: Fix preempt count leak
  2010-12-21  0:55 ` Li Zefan
@ 2010-12-21  1:33   ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2010-12-21  1:33 UTC (permalink / raw)
  To: Li Zefan; +Cc: Frederic Weisbecker, Jiri Olsa, LKML, Hiroyuki KAMEZAWA

On Tue, 2010-12-21 at 08:55 +0800, Li Zefan wrote:
> Any comment?

oops, this was buried in my email. I'll look at it tomorrow.

-- Steve

> 
> 15:47, Li Zefan wrote:
> > While running my ftrace stress test, this showed up:
> > 
> > BUG: sleeping function called from invalid context at mm/mmap.c:233
> > ...
> > note: cat[3293] exited with preempt_count 1
> > 
> > The bug was introduced by commit 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e
> > ("tracing: Fix recursive user stack trace")
> > 
> > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> > ---
> >  kernel/trace/trace.c |    6 ++----
> >  1 files changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index c380612..5767457 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
> >  
> >  	__this_cpu_inc(user_stack_count);
> >  
> > -
> > -
> >  	event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
> >  					  sizeof(*entry), flags, pc);
> >  	if (!event)
> > -		return;
> > +		goto out_drop_count;
> >  	entry	= ring_buffer_event_data(event);
> >  
> >  	entry->tgid		= current->tgid;
> > @@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
> >  	if (!filter_check_discard(call, entry, buffer, event))
> >  		ring_buffer_unlock_commit(buffer, event);
> >  
> > + out_drop_count:
> >  	__this_cpu_dec(user_stack_count);
> > -
> >   out:
> >  	preempt_enable();
> >  }



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] tracing: Fix preempt count leak
  2010-12-09  7:47 [PATCH] tracing: Fix preempt count leak Li Zefan
  2010-12-21  0:55 ` Li Zefan
@ 2011-01-09 21:11 ` tip-bot for Li Zefan
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Li Zefan @ 2011-01-09 21:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, lizf, stable, tglx

Commit-ID:  1dbd1951f39e13da579ffe879cce19586d0462de
Gitweb:     http://git.kernel.org/tip/1dbd1951f39e13da579ffe879cce19586d0462de
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Thu, 9 Dec 2010 15:47:56 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Fri, 7 Jan 2011 23:20:02 -0500

tracing: Fix preempt count leak

While running my ftrace stress test, this showed up:

BUG: sleeping function called from invalid context at mm/mmap.c:233
...
note: cat[3293] exited with preempt_count 1

The bug was introduced by commit 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e
("tracing: Fix recursive user stack trace")

Cc: <stable@kernel.org>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4D0089AC.1020802@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f8cf959..dc53ecb 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 
 	__this_cpu_inc(user_stack_count);
 
-
-
 	event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
 					  sizeof(*entry), flags, pc);
 	if (!event)
-		return;
+		goto out_drop_count;
 	entry	= ring_buffer_event_data(event);
 
 	entry->tgid		= current->tgid;
@@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 	if (!filter_check_discard(call, entry, buffer, event))
 		ring_buffer_unlock_commit(buffer, event);
 
+ out_drop_count:
 	__this_cpu_dec(user_stack_count);
-
  out:
 	preempt_enable();
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-09 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09  7:47 [PATCH] tracing: Fix preempt count leak Li Zefan
2010-12-21  0:55 ` Li Zefan
2010-12-21  1:33   ` Steven Rostedt
2011-01-09 21:11 ` [tip:perf/urgent] " tip-bot for Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox