Tracing/ftrace: trouble with trace_entries and trace_pipe

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pekka Paalanen
Date: Monday, September 15, 2008 - 12:47 pm

Hi Steven and others,

first a minor bug: it seems the units of /debug/tracing/trace_entries
is different for read and write. This is confusing for the users, since
I can't say "if you have problems, double it". If I read from it
something like 16422, then write back 16422, next I read 214. I can't
recall the exact numbers, but the difference really is two orders of
magnitude. I have 1 GB RAM in this box, so that shouldn't be an issue.

My other problem is with trace_pipe. It is again making 'cat' quit too
early. The condition triggered is
	if (!tracer_enabled && iter->pos) {
in tracing_read_pipe(), and it is followed by triggering
        /* stop when tracing is finished */
        if (trace_empty(iter)) {
and then sret=0, so read returns 0 and 'cat' exits.

Now, I am trying my mmiotrace marker patches, but as far as I can tell,
nothing I modified is the reason for this. I didn't yet explicitly test
for it, though. I'll send these patches after I hear from Frederic.

The cat-quit problem is not a constant state. After boot, I could play
with my markers and testmmiotrace without cat quitting. Then something
happens, and cat starts the quitting behaviour, and won't get to normal
by disabling and enabling mmiotrace.

I have a couple of wild guesses of what might be related:
- ring buffer wrap-around
- ring buffer overflow (at first try I hit these, the second try
after putting debug-pr_info's in place I don't hit this)
- ring buffer resize (after playing with trace_entries, cat-quit
problem was present, though it might have been present before)

After viewing the git history, I have some more guesses, mainly
related to setting tracer_enabled to 0.
- commit 2b1bce1787700768cbc87c8509851c6f49d252dc
I don't see where tracer_enabled would be set to 1, when
mmiotrace is enabled. It used to default to 1 and mmiotrace was happy.
- __tracing_open() sets it to 0 (not called for the pipe)
- tracing_release() sets it to 1
- tracing_ctrl_write() toggles it
- tracing_read_pipe() tests it
- tracer_alloc_buffers() uses it
And other tracers seem to use it a lot.

Mmiotrace does use the tracer::ctrl_update hook, and allow/disallow
calls to __trace_mmiotrace_{rw,map}() via enabling/disabling the whole
mmiotrace core. Is this not enough, or is it inappropriate?

It seems tracer_enabled is used by the trace framework itself to
enable/disable... what? Hmm, maybe nothing I care about.

Should mmiotrace simply do
	tracer_enabled = 1;
in mmio_trace_init()?

Should mmiotrace test tracer_enabled, and if so, when?


Thanks.

-- 
Pekka Paalanen
http://www.iki.fi/pq/
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Patch] Tracing/ftrace: Adds a marker to allow user comments, Frédéric Weisbecker, (Sun Aug 24, 2:42 pm)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Mon Aug 25, 6:59 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Mon Aug 25, 10:52 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Wed Aug 27, 2:59 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Aug 28, 3:04 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Aug 28, 9:03 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Thu Sep 4, 9:20 am)
Re: [Patch] Tracing/ftrace: Adds a marker to allow user co ..., Frédéric Weisbecker, (Sat Sep 6, 4:39 am)
Tracing/ftrace: trouble with trace_entries and trace_pipe, Pekka Paalanen, (Mon Sep 15, 12:47 pm)
Re: Tracing/ftrace: trouble with trace_entries and trace_pipe, Frédéric Weisbecker, (Tue Sep 16, 1:57 am)
[PATCH 1/7] x86 mmiotrace: fix a rare memory leak., Pekka Paalanen, (Tue Sep 16, 11:54 am)
[PATCH 2/7] ftrace: move mmiotrace functions out of trace.c., Pekka Paalanen, (Tue Sep 16, 11:56 am)
[PATCH 3/7] ftrace: add trace_vprintk(), Pekka Paalanen, (Tue Sep 16, 11:58 am)
[PATCH 4/7] x86 mmiotrace: implement mmiotrace_printk()., Pekka Paalanen, (Tue Sep 16, 12:00 pm)
[PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Pekka Paalanen, (Tue Sep 16, 12:02 pm)
[PATCH 6/7] mmiotrace: remove left-over marker cruft., Pekka Paalanen, (Tue Sep 16, 12:03 pm)
[PATCH 7/7] ftrace: inject markers via trace_marker file., Pekka Paalanen, (Tue Sep 16, 12:06 pm)
Re: [PATCH 3/7] ftrace: add trace_vprintk(), Steven Rostedt, (Tue Sep 16, 1:06 pm)
Re: [PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Steven Rostedt, (Tue Sep 16, 1:11 pm)
Re: [PATCH 5/7] mmiotrace: handle TRACE_PRINT entries., Pekka Paalanen, (Tue Sep 16, 2:24 pm)
Re: [PATCH 3/7] ftrace: add trace_vprintk(), Ingo Molnar, (Wed Sep 17, 4:42 am)
Re: Tracing/ftrace: trouble with trace_entries and trace_pipe, Frédéric Weisbecker, (Wed Sep 17, 5:41 am)