mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shan Hai <shan.hai@windriver.com>
To: <rostedt@goodmis.org>, <fweisbec@gmail.com>, <mingo@redhat.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 0/1] ftrace/ring_buffer: reset reader page after consuming read
Date: Mon, 28 Apr 2014 10:37:39 +0800	[thread overview]
Message-ID: <1398652660-4560-1-git-send-email-shan.hai@windriver.com> (raw)


Reading from the 'trace' file after force stopping (by signal) consuming
read reveals there are stale trace entries in the output, this patch fixes
the bug by resetting read/write pointers of reader page after the consuming
read is stopped by force.

The issue can be reproduced as below:

echo 0 > tracing_on
echo function > current_tracer
echo 1 > tracing_on

1, read the trace file as normal
        cat trace | head -n 20
        ...
        cat trace | head -n 20

        The trace entries are changing at the head of the output.
        NOTE:
        If it's not changing at the start please repeat the reading
        several times because the tracer need time to fill up the
        whole buffer.

2, read the trace file after stopping 'cat trace_pipe' by Ctrl-C
        cat trace_pipe
        Ctrl-C
        cat trace | head -n 200
        ...
        cat trace | head -n 200

        The trace entries at the head of the output stop changing,
        followed by changing trace entries.
        NOTE:
        Please carefully check the time stamps of the trace entries,
        the time stamps of some of them at the head stop changing
        in the consecutive read.

        The results of test 1 and 2 are not consistent with respect to the
        updating of trace buffers, some part of the trace buffers are
        not updated in the test 2 while all of them are updated in the
        test 1.

        And the result of test 1 is correct because the trace entries
        supposed to be changed for the reason the tracer works under
        overwrite mode by default.

Thanks
Shan Hai


             reply	other threads:[~2014-04-28  2:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28  2:37 Shan Hai [this message]
2014-04-28  2:37 ` [PATCH 1/1] ftrace/ring_buffer: reset reader page after consuming read was performed to the page Shan Hai
2014-04-28 14:27   ` Steven Rostedt

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=1398652660-4560-1-git-send-email-shan.hai@windriver.com \
    --to=shan.hai@windriver.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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®