mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [tip:tracing/urgent] tracing: Add pipe_close interface
       [not found] <tip-c521efd1700a8c0f7ce26f011f5eaecca17fabfa@git.kernel.org>
@ 2009-12-09  6:35 ` KOSAKI Motohiro
  2009-12-09 14:08   ` Steven Rostedt
  2009-12-10  7:48   ` [tip:tracing/core] tracing: Only call pipe_close if pipe_close is defined tip-bot for Steven Rostedt
  0 siblings, 2 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2009-12-09  6:35 UTC (permalink / raw)
  To: linux-kernel, mingo, hpa, rostedt, srostedt, tglx
  Cc: kosaki.motohiro, linux-tip-commits, hpa, mingo, rostedt, srostedt, tglx

> Commit-ID:  c521efd1700a8c0f7ce26f011f5eaecca17fabfa
> Gitweb:     http://git.kernel.org/tip/c521efd1700a8c0f7ce26f011f5eaecca17fabfa
> Author:     Steven Rostedt <srostedt@redhat.com>
> AuthorDate: Mon, 7 Dec 2009 09:06:24 -0500
> Committer:  Steven Rostedt <rostedt@goodmis.org>
> CommitDate: Mon, 7 Dec 2009 12:01:35 -0500
> 
> tracing: Add pipe_close interface
> 
> An ftrace plugin can add a pipe_open interface when the user opens
> trace_pipe. But if the plugin allocates something within the pipe_open
> it can not free it because there exists no pipe_close. The hook to
> the trace file open has a corresponding close. The closing of the
> trace_pipe file should also have a corresponding close.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  kernel/trace/trace.c |    4 ++++
>  kernel/trace/trace.h |    2 ++
>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 874f289..f804b40 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2898,6 +2898,10 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
>  	else
>  		cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
>  
> +
> +	if (iter->trace->pipe_open)
> +		iter->trace->pipe_close(iter);
> +

What's happen if pipe_close is NULL? Wny following straightforward check
is wrong?
I mean the above description explain pipe_close is only useful if plugin
allocate something at pipe_open. then allowing NULL seems natural.

	if (iter->trace->pipe_close)
		iter->trace->pipe_close(iter);

just nit.





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

* Re: [tip:tracing/urgent] tracing: Add pipe_close interface
  2009-12-09  6:35 ` [tip:tracing/urgent] tracing: Add pipe_close interface KOSAKI Motohiro
@ 2009-12-09 14:08   ` Steven Rostedt
  2009-12-09 14:16     ` Ingo Molnar
  2009-12-10  7:48   ` [tip:tracing/core] tracing: Only call pipe_close if pipe_close is defined tip-bot for Steven Rostedt
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2009-12-09 14:08 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: linux-kernel, mingo, hpa, srostedt, tglx, linux-tip-commits

On Wed, 2009-12-09 at 15:35 +0900, KOSAKI Motohiro wrote:

> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > index 874f289..f804b40 100644
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -2898,6 +2898,10 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
> >  	else
> >  		cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
> >  
> > +
> > +	if (iter->trace->pipe_open)
> > +		iter->trace->pipe_close(iter);
> > +
> 
> What's happen if pipe_close is NULL? Wny following straightforward check
> is wrong?
> I mean the above description explain pipe_close is only useful if plugin
> allocate something at pipe_open. then allowing NULL seems natural.
> 
> 	if (iter->trace->pipe_close)
> 		iter->trace->pipe_close(iter);

Ug, good point (stupid cut & paste should be illegal).

Ingo, I'll fix this up too in the next patch set. Want me to rebase it
or just start with this fix?

-- Steve





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

* Re: [tip:tracing/urgent] tracing: Add pipe_close interface
  2009-12-09 14:08   ` Steven Rostedt
@ 2009-12-09 14:16     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-12-09 14:16 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: KOSAKI Motohiro, linux-kernel, mingo, hpa, srostedt, tglx,
	linux-tip-commits


* Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 2009-12-09 at 15:35 +0900, KOSAKI Motohiro wrote:
> 
> > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> > > index 874f289..f804b40 100644
> > > --- a/kernel/trace/trace.c
> > > +++ b/kernel/trace/trace.c
> > > @@ -2898,6 +2898,10 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
> > >  	else
> > >  		cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
> > >  
> > > +
> > > +	if (iter->trace->pipe_open)
> > > +		iter->trace->pipe_close(iter);
> > > +
> > 
> > What's happen if pipe_close is NULL? Wny following straightforward check
> > is wrong?
> > I mean the above description explain pipe_close is only useful if plugin
> > allocate something at pipe_open. then allowing NULL seems natural.
> > 
> > 	if (iter->trace->pipe_close)
> > 		iter->trace->pipe_close(iter);
> 
> Ug, good point (stupid cut & paste should be illegal).
> 
> Ingo, I'll fix this up too in the next patch set. Want me to rebase it 
> or just start with this fix?

I'd suggest to start with a fix. Thanks,

	Ingo

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

* [tip:tracing/core] tracing: Only call pipe_close if pipe_close is defined
  2009-12-09  6:35 ` [tip:tracing/urgent] tracing: Add pipe_close interface KOSAKI Motohiro
  2009-12-09 14:08   ` Steven Rostedt
@ 2009-12-10  7:48   ` tip-bot for Steven Rostedt
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Steven Rostedt @ 2009-12-10  7:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, rostedt, srostedt, tglx, kosaki.motohiro

Commit-ID:  29bf4a5e3fed3dde3eb629a0cb1762c1e9217458
Gitweb:     http://git.kernel.org/tip/29bf4a5e3fed3dde3eb629a0cb1762c1e9217458
Author:     Steven Rostedt <srostedt@redhat.com>
AuthorDate: Wed, 9 Dec 2009 12:37:43 -0500
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Wed, 9 Dec 2009 12:47:35 -0500

tracing: Only call pipe_close if pipe_close is defined

This fixes a cut and paste error that had pipe_close get called
if pipe_open was defined (not pipe_close).

Reported-by: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
LKML-Reference: <20091209153204.F4CD.A69D9226@jp.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f804b40..dc937e1 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2899,7 +2899,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
 		cpumask_clear_cpu(iter->cpu_file, tracing_reader_cpumask);
 
 
-	if (iter->trace->pipe_open)
+	if (iter->trace->pipe_close)
 		iter->trace->pipe_close(iter);
 
 	mutex_unlock(&trace_types_lock);

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

end of thread, other threads:[~2009-12-10  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tip-c521efd1700a8c0f7ce26f011f5eaecca17fabfa@git.kernel.org>
2009-12-09  6:35 ` [tip:tracing/urgent] tracing: Add pipe_close interface KOSAKI Motohiro
2009-12-09 14:08   ` Steven Rostedt
2009-12-09 14:16     ` Ingo Molnar
2009-12-10  7:48   ` [tip:tracing/core] tracing: Only call pipe_close if pipe_close is defined tip-bot for Steven Rostedt

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

Powered by JetHome