From: Jiri Olsa <jolsa@redhat.com>
To: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com
Cc: linux-kernel@vger.kernel.org, oleg@redhat.com
Subject: [PATCH 0/2] tracing - avoid soft lockup in trace_pipe
Date: Sat, 12 Mar 2011 23:59:44 +0100 [thread overview]
Message-ID: <1299970786-8075-1-git-send-email-jolsa@redhat.com> (raw)
hi,
running following commands:
echo 1 > ./options/bin
echo 0 > ./options/context-info
echo 1 > ./events/enable
cat trace_pipe
is causing soft lockup inside tracing_read_pipe function.
The reason is, that bin/hex/raw output functions for events
are set to trace_nop_print function, which prints nothing
and returns TRACE_TYPE_HANDLED value.
So, choosing:
- NON preemptive kernel
- trace only events
- enable bin/hex options
(raw option traces new line always, so it will get out eventually).
- disable all other output (context-info option)
will cause the tracing_read_pipe to loop forever, because the only
loop escapes are:
1) ring buffer is empty
2) TRACE_TYPE_PARTIAL_LINE returned from trace output function
3) trace_seq buffer limit is reached
ad 1)
with all events enabled, the other CPU(s) keep ring buffer full
(did not try on single CPU machine)
ad 2)
with all other output disabled, the only called trace function
is trace_nop_print, which returns TRACE_TYPE_HANDLED
ad 3)
the only traced information is LOST EVENT trace, but it's
without the check for the trace_seq limit crossing, so
we stay in the loop
The attached patch (1/2) fixies handling of lost event trace.
This change will also make the soft lockup practically disappear,
since I think there will allways be some lost events, which will
cause the trace_seq buffer overflow and escape the loop.
To improve the latency and make sure we won't stuck if there are no
lost events, I added to the loop (patch 2/2):
- cond_resched call
- check for signal to leave the loop
Attached patches:
1/2 - tracing - trace lost events properly
2/2 - tracing - putting cond_resched into tace_pipe loop
Thanks a lot to Oleg Nestorov for helping me to nail this down.
..hopefully I haven't missed anything ;)
wbr,
jirka
---
kernel/trace/trace.c | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
next reply other threads:[~2011-03-12 22:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-12 22:59 Jiri Olsa [this message]
2011-03-12 22:59 ` [PATCH 1/2] tracing - trace lost events properly Jiri Olsa
2011-03-12 22:59 ` [PATCH 2/2] tracing - putting cond_resched into tace_pipe loop Jiri Olsa
2011-03-13 14:58 ` Oleg Nesterov
2011-03-14 14:07 ` Steven Rostedt
2011-03-14 14:18 ` Jiri Olsa
2011-03-14 14:28 ` Steven Rostedt
2011-03-14 15:07 ` Jiri Olsa
2011-03-14 15:20 ` Steven Rostedt
2011-03-14 18:06 ` [PATCHv2] tracing - avoid soft lockup in trace_pipe Jiri Olsa
2011-03-21 12:10 ` Jiri Olsa
2011-03-25 2:23 ` Steven Rostedt
2011-03-25 3:14 ` Steven Rostedt
2011-03-25 11:05 ` [PATCHv3] " Jiri Olsa
2011-03-25 15:46 ` Steven Rostedt
2011-03-25 15:49 ` Steven Rostedt
2011-03-25 15:53 ` Jiri Olsa
2011-04-27 15:22 ` [tip:perf/core] tracing: Avoid " tip-bot for Jiri Olsa
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=1299970786-8075-1-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@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®