public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tracing - avoid soft lockup in trace_pipe
@ 2011-03-12 22:59 Jiri Olsa
  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
  0 siblings, 2 replies; 18+ messages in thread
From: Jiri Olsa @ 2011-03-12 22:59 UTC (permalink / raw)
  To: rostedt, fweisbec, mingo; +Cc: linux-kernel, oleg

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(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-04-27 15:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-12 22:59 [PATCH 0/2] tracing - avoid soft lockup in trace_pipe Jiri Olsa
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox