From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: "Pekka Paalanen" <pq@iki.fi>
Cc: mingo@elte.hu, rostedt@goodmis.org, linux-kernel@vger.kernel.org
Subject: Re: trace_pipe tentative fix (Re: [PATCH -tip 2/3] Tracing/ftrace: Adapt mmiotrace to the new type of print_line)
Date: Mon, 29 Sep 2008 11:20:59 +0200 [thread overview]
Message-ID: <c62985530809290220p646e0839iec6068c03b6eaf9f@mail.gmail.com> (raw)
In-Reply-To: <20080928201259.09bbac54@daedalus.pq.iki.fi>
2008/9/28 Pekka Paalanen <pq@iki.fi>:
> On Sat, 27 Sep 2008 14:17:47 +0200
> "Frédéric Weisbecker" <fweisbec@gmail.com> wrote:
>
>> 2008/9/26 Pekka Paalanen <pq@iki.fi>:
>> > Yes, I do disagree about printing stuff that doesn't belong there.
>> > First, I doubt printing bogus text is a right way to fix the
>> > early pipe EOF problem. Second, if you really have to do that,
>> > do it so that it obeys the mmiotrace log format specification.
>> > (I'd recommend a MARK entry.) The spec is in
>> > Documentation/tracers/mmiotrace.txt.
>>
>> No problem, I have one other option: ignoring and sleep again before
>> receiving another entries.
>> I can do another patch this week end to implement that.
>> The third patch only concerns the boot tracer. It relays to other
>> output functions.
>>
>> Just tell me if you agree with the ignoring...
>
> If I understand you suggestion, it looks like the right thing to do.
> Here is a tentative fix, which has not even been compile-tested.
>
> Is it so that the problem is triggered by consuming a trace entry
> which does not produce any output? If that entry is all there is
> in the ring at a time of a read call, then the last call to
> trace_seq_to_user() returns -EBUSY, because there is nothing to
> copy to user. What I failed to understand when I wrote that
> piece of code, is that returning 0 means EOF. The only cases
> when we do want to return an EOF are near the
> while (trace_empty(iter)) {
> loop.
>
> Frederic, could you test the fix, and if it works, send it to Ingo?
>
>
> Thanks.
>
> ---
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 6ada059..d85659a 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2616,6 +2616,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
> goto out;
> }
>
> +waitagain:
> while (trace_empty(iter)) {
>
> if ((filp->f_flags & O_NONBLOCK)) {
> @@ -2749,8 +2750,13 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
> sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
> if (iter->seq.readpos >= iter->seq.len)
> trace_seq_reset(&iter->seq);
> +
> + /*
> + * If there was nothing to send to user, inspite of consuming trace
> + * entries, go back to wait for more entries.
> + */
> if (sret == -EBUSY)
> - sret = 0;
> + goto waitagain;
>
> out:
> mutex_unlock(&trace_types_lock);
>
Ok I will test it this evening.
next prev parent reply other threads:[~2008-09-29 9:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 15:44 [PATCH -tip 2/3] Tracing/ftrace: Adapt mmiotrace to the new type of print_line Frederic Weisbecker
2008-09-26 21:21 ` Pekka Paalanen
2008-09-27 12:17 ` Frédéric Weisbecker
2008-09-27 16:19 ` Ingo Molnar
2008-09-28 17:12 ` trace_pipe tentative fix (Re: [PATCH -tip 2/3] Tracing/ftrace: Adapt mmiotrace to the new type of print_line) Pekka Paalanen
2008-09-28 18:58 ` trace_pipe tentative fix Pekka Paalanen
2008-09-29 17:49 ` Frédéric Weisbecker
2008-09-29 9:20 ` Frédéric Weisbecker [this message]
2008-09-28 16:29 ` [PATCH -tip 2/3] Tracing/ftrace: Adapt mmiotrace to the new type of print_line Pekka Paalanen
2008-09-29 9:02 ` Ingo Molnar
2008-09-29 9:28 ` Frédéric Weisbecker
2008-09-29 9:47 ` Ingo Molnar
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=c62985530809290220p646e0839iec6068c03b6eaf9f@mail.gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=pq@iki.fi \
--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
all inboxes | Powered by JetHome®