public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ftrace and debugfs weird interaction
@ 2008-04-26 18:54 Mathieu Desnoyers
  2008-04-27  0:36 ` Greg KH
  2008-04-28 15:39 ` Ingo Molnar
  0 siblings, 2 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2008-04-26 18:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ingo Molnar; +Cc: linux-kernel

Hi,

When trying to figure out what was going on with the sched tracer
"tracing_enabled" file (sched-devel.git tree), I fell on this strange
behavior :

echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write
callback. However, sending garbage, e.g. echo s> tracing_enabled,
correctly sends the 's' character down the chain. echo 0>tracing_enabled
sometimes results in the callback not even being called.

The debugfs file has been created with

        entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
                                    &global_trace, &tracing_ctrl_fops);
        if (!entry)
                pr_warning("Could not create debugfs 'tracing_enabled' entry\n");

I wonder what kind of weird debugfs interaction we might have here ?

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

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

* Re: ftrace and debugfs weird interaction
  2008-04-26 18:54 ftrace and debugfs weird interaction Mathieu Desnoyers
@ 2008-04-27  0:36 ` Greg KH
  2008-04-28 15:39 ` Ingo Molnar
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2008-04-27  0:36 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: Ingo Molnar, linux-kernel

On Sat, Apr 26, 2008 at 02:54:03PM -0400, Mathieu Desnoyers wrote:
> Hi,
> 
> When trying to figure out what was going on with the sched tracer
> "tracing_enabled" file (sched-devel.git tree), I fell on this strange
> behavior :
> 
> echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write
> callback. However, sending garbage, e.g. echo s> tracing_enabled,
> correctly sends the 's' character down the chain. echo 0>tracing_enabled
> sometimes results in the callback not even being called.
> 
> The debugfs file has been created with
> 
>         entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
>                                     &global_trace, &tracing_ctrl_fops);
>         if (!entry)
>                 pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
> 
> I wonder what kind of weird debugfs interaction we might have here ?

I don't know.  Are you sure your _fops is not getting called at all?

How about using a "default" operation for such a simple file, like
debugfs_create_bool() as that is all you care about for this kind of
value?

That should save you some code at the very least :)

thanks,

greg k-h

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

* Re: ftrace and debugfs weird interaction
  2008-04-26 18:54 ftrace and debugfs weird interaction Mathieu Desnoyers
  2008-04-27  0:36 ` Greg KH
@ 2008-04-28 15:39 ` Ingo Molnar
  2008-04-28 19:27   ` Steven Rostedt
  2008-04-28 19:35   ` Pekka Paalanen
  1 sibling, 2 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-04-28 15:39 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Greg Kroah-Hartman, linux-kernel, Steven Rostedt, Pekka Paalanen


* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> Hi,
> 
> When trying to figure out what was going on with the sched tracer
> "tracing_enabled" file (sched-devel.git tree), I fell on this strange
> behavior :
> 
> echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write
> callback. However, sending garbage, e.g. echo s> tracing_enabled,
> correctly sends the 's' character down the chain. echo 0>tracing_enabled
> sometimes results in the callback not even being called.
> 
> The debugfs file has been created with
> 
>         entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
>                                     &global_trace, &tracing_ctrl_fops);
>         if (!entry)
>                 pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
> 
> I wonder what kind of weird debugfs interaction we might have here ?

hm. Cc:-ed more ftrace developers.

	Ingo

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

* Re: ftrace and debugfs weird interaction
  2008-04-28 15:39 ` Ingo Molnar
@ 2008-04-28 19:27   ` Steven Rostedt
  2008-04-28 19:35   ` Pekka Paalanen
  1 sibling, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2008-04-28 19:27 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mathieu Desnoyers, Greg Kroah-Hartman, linux-kernel,
	Pekka Paalanen

5BOn Mon, 28 Apr 2008, Ingo Molnar wrote:

>
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
>
> > Hi,
> >
> > When trying to figure out what was going on with the sched tracer
> > "tracing_enabled" file (sched-devel.git tree), I fell on this strange
> > behavior :
> >
> > echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write

It should actually send "1" and not 1 (and technically "1\n") ;-)

> > callback. However, sending garbage, e.g. echo s> tracing_enabled,
> > correctly sends the 's' character down the chain. echo 0>tracing_enabled
> > sometimes results in the callback not even being called.

I haven't seen this. Perhaps I'm confused about what you are seeing.

> >
> > The debugfs file has been created with
> >
> >         entry = debugfs_create_file("tracing_enabled", 0644, d_tracer,
> >                                     &global_trace, &tracing_ctrl_fops);
> >         if (!entry)
> >                 pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
> >
> > I wonder what kind of weird debugfs interaction we might have here ?

This looks normal to me. Could you provide a bit more detail to what you
are doing, what the results are, and what you expect the restults to be?

>
> hm. Cc:-ed more ftrace developers.

Thanks,

-- Steve

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

* Re: ftrace and debugfs weird interaction
  2008-04-28 15:39 ` Ingo Molnar
  2008-04-28 19:27   ` Steven Rostedt
@ 2008-04-28 19:35   ` Pekka Paalanen
  2008-04-28 20:34     ` Mathieu Desnoyers
  1 sibling, 1 reply; 6+ messages in thread
From: Pekka Paalanen @ 2008-04-28 19:35 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Ingo Molnar, Greg Kroah-Hartman, linux-kernel, Steven Rostedt

> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Hi,
> > 
> > When trying to figure out what was going on with the sched tracer
> > "tracing_enabled" file (sched-devel.git tree), I fell on this strange
> > behavior :
> > 
> > echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write

Wait a minute, are you literally running the command:
echo 1>tracing_enabled

If you are, you just echoed only a newline and directed stdout, stream 1,
to the file. No? :-)

Could you try with a space:
echo 1 > tracing_enabled

> > callback. However, sending garbage, e.g. echo s> tracing_enabled,
> > correctly sends the 's' character down the chain. echo 0>tracing_enabled
> > sometimes results in the callback not even being called.

Stream 0 is stdin, so... not sure what this would do. Probably nothing,
just like you experienced.


Thanks.

-- 
Pekka Paalanen
http://www.iki.fi/pq/

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

* Re: ftrace and debugfs weird interaction
  2008-04-28 19:35   ` Pekka Paalanen
@ 2008-04-28 20:34     ` Mathieu Desnoyers
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2008-04-28 20:34 UTC (permalink / raw)
  To: Pekka Paalanen
  Cc: Ingo Molnar, Greg Kroah-Hartman, linux-kernel, Steven Rostedt

* Pekka Paalanen (pq@iki.fi) wrote:
> > * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> > 
> > > Hi,
> > > 
> > > When trying to figure out what was going on with the sched tracer
> > > "tracing_enabled" file (sched-devel.git tree), I fell on this strange
> > > behavior :
> > > 
> > > echo 1>tracing_enabled seems _not_ to send 1 to the tracing_ctrl_write
> 
> Wait a minute, are you literally running the command:
> echo 1>tracing_enabled
> 
> If you are, you just echoed only a newline and directed stdout, stream 1,
> to the file. No? :-)
> 
> Could you try with a space:
> echo 1 > tracing_enabled
> 
> > > callback. However, sending garbage, e.g. echo s> tracing_enabled,
> > > correctly sends the 's' character down the chain. echo 0>tracing_enabled
> > > sometimes results in the callback not even being called.
> 
> Stream 0 is stdin, so... not sure what this would do. Probably nothing,
> just like you experienced.
> 

*duh*. Ok. That wasn't smart. You spotted the problem. Thanks a lot :)

Mathieu

> 
> Thanks.
> 
> -- 
> Pekka Paalanen
> http://www.iki.fi/pq/

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

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

end of thread, other threads:[~2008-04-28 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 18:54 ftrace and debugfs weird interaction Mathieu Desnoyers
2008-04-27  0:36 ` Greg KH
2008-04-28 15:39 ` Ingo Molnar
2008-04-28 19:27   ` Steven Rostedt
2008-04-28 19:35   ` Pekka Paalanen
2008-04-28 20:34     ` Mathieu Desnoyers

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