[lkml]   [2008]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subjecttrace_pipe tentative fix (Re: [PATCH -tip 2/3] Tracing/ftrace: Adapt mmiotrace to the new type of print_line)
    On Sat, 27 Sep 2008 14:17:47 +0200
    "Frédéric Weisbecker" <> wrote:

    > 2008/9/26 Pekka Paalanen <>:
    > > 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)) {

    Frederic, could you test the fix, and if it works, send it to Ingo?



    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;

    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)
    + /*
    + * 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;

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at
     \ /
      Last update: 2008-09-28 19:15    [W:7.001 / U:0.276 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site