1. 14 Aug, 2013 1 commit
  2. 12 Apr, 2013 1 commit
    • Thomas Gleixner's avatar
      kthread: Prevent unpark race which puts threads on the wrong cpu · f2530dc7
      Thomas Gleixner authored
      The smpboot threads rely on the park/unpark mechanism which binds per
      cpu threads on a particular core. Though the functionality is racy:
      CPU0	       	 	CPU1  	     	    CPU2
      unpark(T)				    wake_up_process(T)
        clear(SHOULD_PARK)	T runs
      			leave parkme() due to !SHOULD_PARK  
        bind_to(CPU2)		BUG_ON(wrong CPU)						    
      We cannot let the tasks move themself to the target CPU as one of
      those tasks is actually the migration thread itself, which requires
      that it starts running on the target cpu right away.
      The solution to this problem is to prevent wakeups in park mode which
      are not from unpark(). That way we can guarantee that the association
      of the task to the target cpu is working correctly.
      Add a new task state (TASK_PARKED) which prevents other wakeups and
      use this state explicitly for the unpark wakeup.
      Peter noticed: Also, since the task state is visible to userspace and
      all the parked tasks are still in the PID space, its a good hint in ps
      and friends that these tasks aren't really there for the moment.
      The migration thread has another related issue.
      CPU0	      	     	 CPU1
      Bring up CPU2
      The sched_set_stop_task() call is issued while the task is on the
      runqueue of CPU1 and that confuses the hell out of the stop_task class
      on that cpu. So we need the same synchronizaion before
      Reported-by: default avatarDave Jones <davej@redhat.com>
      Reported-and-tested-by: default avatarDave Hansen <dave@sr71.net>
      Reported-and-tested-by: default avatarBorislav Petkov <bp@alien8.de>
      Acked-by: default avatarPeter Ziljstra <peterz@infradead.org>
      Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: dhillf@gmail.com
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1304091635430.21884@ionos
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
  3. 31 Jul, 2012 1 commit
  4. 31 Mar, 2012 1 commit
    • Oleg Nesterov's avatar
      tracing, sched, vfs: Fix 'old_pid' usage in trace_sched_process_exec() · 6308191f
      Oleg Nesterov authored
      1. TRACE_EVENT(sched_process_exec) forgets to actually use the
         old pid argument, it sets ->old_pid = p->pid.
      2. search_binary_handler() uses the wrong pid number. tracepoint
         needs the global pid_t from the root namespace, while old_pid
         is the virtual pid number as it seen by the tracer/parent.
      With this patch we have two pid_t's in search_binary_handler(),
      not really nice. Perhaps we should switch to "struct pid*", but
      in this case it would be better to cleanup the current code
      first and move the "depth == 0" code outside.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: David Smith <dsmith@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Link: http://lkml.kernel.org/r/20120330162636.GA4857@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
  5. 23 Feb, 2012 1 commit
    • David Smith's avatar
      tracepoint, vfs, sched: Add exec() tracepoint · 4ff16c25
      David Smith authored
      Added a minimal exec tracepoint. Exec is an important major event
      in the life of a task, like fork(), clone() or exit(), all of
      which we already trace.
      [ We also do scheduling re-balancing during exec() - so it's useful
        from a scheduler instrumentation POV as well. ]
      If you want to watch a task start up, when it gets exec'ed is a good place
      to start.  With the addition of this tracepoint, exec's can be monitored
      and better picture of general system activity can be obtained. This
      tracepoint will also enable better process life tracking, allowing you to
      answer questions like "what process keeps starting up binary X?".
      This tracepoint can also be useful in ftrace filtering and trigger
      conditions: i.e. starting or stopping filtering when exec is called.
      Signed-off-by: default avatarDavid Smith <dsmith@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/4F314D19.7030504@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  6. 22 Feb, 2012 1 commit
    • Peter Zijlstra's avatar
      sched/events: Revert trace_sched_stat_sleeptime() · 8c79a045
      Peter Zijlstra authored
      Commit 1ac9bc69
       ("sched/tracing: Add a new tracepoint for sleeptime")
      added a new sched:sched_stat_sleeptime tracepoint.
      It's broken: the first sample we get on a task might be bad because
      of a stale sleep_start value that wasn't reset at the last task switch
      because the tracepoint was not active.
      It also breaks the existing schedstat samples due to the side
      effects of:
      -               se->statistics.sleep_start = 0;
      -               se->statistics.block_start = 0;
      Nor do I see means to fix it without adding overhead to the scheduler
      fast path, which I'm not willing to for the sake of redundant
      Most importantly, sleep time information can already be constructed
      by tracing context switches and wakeups, and taking the timestamp
      difference between the schedule-out, the wakeup and the schedule-in.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Andrew Vagin <avagin@openvz.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Link: http://lkml.kernel.org/n/tip-pc4c9qhl8q6vg3bs4j6k0rbd@git.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  7. 23 Dec, 2011 1 commit
  8. 06 Dec, 2011 1 commit
  9. 26 Sep, 2011 1 commit
  10. 21 Sep, 2010 1 commit
  11. 28 Jun, 2010 1 commit
  12. 01 Jun, 2010 1 commit
  13. 07 May, 2010 1 commit
  14. 26 Nov, 2009 3 commits
    • Masami Hiramatsu's avatar
      tracepoint: Move signal sending tracepoint to events/signal.h · d1eb650f
      Masami Hiramatsu authored
      Move signal sending event to events/signal.h. This patch also
      renames sched_signal_send event to signal_generate.
      Changes in v4:
       - Fix a typo of task_struct pointer.
      Changes in v3:
       - Add docbook style comments
      Changes in v2:
       - Add siginfo argument
       - Add siginfo storing macro
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Reviewed-by: default avatarJason Baron <jbaron@redhat.com>
      Acked-by: default avatarRoland McGrath <roland@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Oleg Nesterov <oleg@redhat.com>
      LKML-Reference: <20091124215645.30449.60208.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Li Zefan's avatar
      tracing: Restore original format of sched events · 470dda74
      Li Zefan authored
      The original format for sched_stat_iowait and sched_stat_sleep:
        $ cat events/sched/sched_stat_iowait/format
        print fmt: "comm=%s pid=%d delay=%Lu [ns]", ...
        $ cat events/sched/sched_stat_sleep/format
        print fmt: "comm=%s pid=%d delay=%Lu [ns]", ...
      But commit commit 75ec29ab
      ("tracing: Convert some sched trace events to DEFINE_EVENT and
      _PRINT") broke the format:
        $ cat events/sched/sched_stat_iowait/format
        print fmt: "task: %s:%d iowait: %Lu [ns]", ...
        $ cat events/sched/sched_stat_sleep/format
        print fmt: "task: %s:%d sleep: %Lu [ns]", ...
      No change in functionality.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4B0E2951.9050800@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Ingo Molnar's avatar
      events: Rename TRACE_EVENT_TEMPLATE() to DECLARE_EVENT_CLASS() · 091ad365
      Ingo Molnar authored
      It is not quite obvious at first sight what TRACE_EVENT_TEMPLATE
      does: does it define an event as well beyond defining a template?
      To clarify this, rename it to DECLARE_EVENT_CLASS, which follows
      the various 'DECLARE_*()' idioms we already have in the kernel:
          DEFINE_EVENT(class, event1)
          DEFINE_EVENT(class, event2)
          DEFINE_EVENT(class, event3)
      To complete this logic we should also rename TRACE_EVENT() to:
      ... but in a more quiet moment of the kernel cycle.
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4B0E286A.2000405@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  15. 24 Nov, 2009 1 commit
    • Steven Rostedt's avatar
      tracing: Convert some sched trace events to DEFINE_EVENT and _PRINT · 75ec29ab
      Steven Rostedt authored
      Converting some of the scheduler trace events to use the
      save some space:
      $ size kernel/sched.o-*
         text	   data	    bss	    dec	    hex	filename
        79299	   6776	   2520	  88595	  15a13	kernel/sched.o-notrace
       101941	  11896	   2584	 116421	  1c6c5	kernel/sched.o-templ
       104779	  11896	   2584	 119259	  1d1db	kernel/sched.o-trace
      sched.o-notrace is without any tracepoints compiled
      sched.o-templ is with this patch
      sched.o-trace is the tracepoints before this patch
      The trace events converted to DEFINE_EVENT:
      sched_wakeup, sched_wakeup_new, sched_process_free, sched_process_exit,
      and sched_stat_wait.
      The trace events converted to DEFINE_EVENT_PRINT:
      sched_stat_sleep and sched_stat_iowait.
      Note, since the TRACE_EVENT_TEMPLATE always uses a print, the
      sched_stat_wait print format is defined in the template and this
      template is used by sched_stat_sleep and sched_stat_iowait. But the
      later two override the print format.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  16. 15 Oct, 2009 1 commit
    • Ingo Molnar's avatar
      events: Harmonize event field names and print output names · 434a83c3
      Ingo Molnar authored
      Now that we can filter based on fields via perf record, people
      will start using filter expressions and will expect them to
      be obvious.
      The primary way to see which fields are available is by looking
      at the trace output, such as:
        gcc-18676 [000]   343.011728: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.012727: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.032692: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.033690: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.034687: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.035686: irq_handler_entry: irq=0 handler=timer
        cc1-18677 [000]   343.036684: irq_handler_entry: irq=0 handler=timer
      While 'irq==0' filters work, the 'handler==<x>' filter expression
      does not work:
        $ perf record -R -f -a -e irq:irq_handler_entry --filter handler=timer sleep 1
         Error: failed to set filter with 22 (Invalid argument)
      The problem is that while an 'irq' field exists and is recognized
      as a filter field - 'handler' does not exist - its name is 'name'
      in the output.
      To solve this, we need to synchronize the printout and the field
      names, wherever possible.
      In cases where the printout prints a non-field, we enclose
      that information in square brackets, such as:
        perf-1380  [013]   724.903505: softirq_exit: vec=9 [action=RCU]
        perf-1380  [013]   724.904482: softirq_exit: vec=1 [action=TIMER]
      This way users can use filter expressions more intuitively: all
      fields that show up as 'primary' (non-bracketed) information is
      This patch harmonizes the field names for all irq, bkl, power,
      sched and timer events.
      We might in fact think about dropping the print format bit of
      generic tracepoints altogether, and just print the fields that
      are being recorded.
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  17. 13 Sep, 2009 1 commit
    • Ingo Molnar's avatar
      perf_counter, sched: Add sched_stat_runtime tracepoint · f977bb49
      Ingo Molnar authored
      This allows more precise tracking of how the scheduler accounts
      (and acts upon) a task having spent N nanoseconds of CPU time.
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  18. 02 Sep, 2009 1 commit
  19. 26 Aug, 2009 1 commit
  20. 13 Jul, 2009 1 commit
    • Li Zefan's avatar
      tracing/events: Move TRACE_SYSTEM outside of include guard · d0b6e04a
      Li Zefan authored
      If TRACE_INCLDUE_FILE is defined, <trace/events/TRACE_INCLUDE_FILE.h>
      will be included and compiled, otherwise it will be
      So TRACE_SYSTEM should be defined outside of #if proctection,
      just like TRACE_INCLUDE_FILE.
      Imaging this scenario:
       #include <trace/events/foo.h>
          -> TRACE_SYSTEM == foo
       #include <trace/events/bar.h>
          -> TRACE_SYSTEM == bar
       #define CREATE_TRACE_POINTS
       #include <trace/events/foo.h>
          -> TRACE_SYSTEM == bar !!!
      and then bar.h will be included and compiled.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A5A9CF1.2010007@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  21. 26 May, 2009 1 commit
  22. 06 May, 2009 1 commit
  23. 15 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      tracing/events: move trace point headers into include/trace/events · ad8d75ff
      Steven Rostedt authored
      Impact: clean up
      Create a sub directory in include/trace called events to keep the
      trace point headers in their own separate directory. Only headers that
      declare trace points should be defined in this directory.
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
      Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  24. 14 Apr, 2009 2 commits
    • Steven Rostedt's avatar
      tracing: create automated trace defines · a8d154b0
      Steven Rostedt authored
      This patch lowers the number of places a developer must modify to add
      new tracepoints. The current method to add a new tracepoint
      into an existing system is to write the trace point macro in the
      trace header with one of the macros TRACE_EVENT, TRACE_FORMAT or
      DECLARE_TRACE, then they must add the same named item into the C file
      with the macro DEFINE_TRACE(name) and then add the trace point.
      This change cuts out the needing to add the DEFINE_TRACE(name).
      Every file that uses the tracepoint must still include the trace/<type>.h
      file, but the one C file must also add a define before the including
      of that file.
       #define CREATE_TRACE_POINTS
       #include <trace/mytrace.h>
      This will cause the trace/mytrace.h file to also produce the C code
      necessary to implement the trace point.
      Note, if more than one trace/<type>.h is used to create the C code
      it is best to list them all together.
       #define CREATE_TRACE_POINTS
       #include <trace/foo.h>
       #include <trace/bar.h>
       #include <trace/fido.h>
      Thanks to Mathieu Desnoyers and Christoph Hellwig for coming up with
      the cleaner solution of the define above the includes over my first
      design to have the C code include a "special" header.
      This patch converts sched, irq and lockdep and skb to use this new
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
      Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    • Steven Rostedt's avatar
      tracing: consolidate trace and trace_event headers · ea20d929
      Steven Rostedt authored
      Impact: clean up
      Neil Horman (et. al.) criticized the way the trace events were broken up
      into two files. The reason for that was that ftrace needed to separate out
      the declarations from where the #include <linux/tracepoint.h> was used.
      It then dawned on me that the tracepoint.h header only needs to define the
      TRACE_EVENT macro if it is not already defined.
      The solution is simply to test if TRACE_EVENT is defined, and if it is not
      then the linux/tracepoint.h header can define it. This change consolidates
      all the <traces>.h and <traces>_event_types.h into the <traces>.h file.
      Reported-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Reported-by: default avatarTheodore Tso <tytso@mit.edu>
      Reported-by: default avatarJiaying Zhang <jiayingz@google.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
  25. 25 Feb, 2009 1 commit
  26. 25 Dec, 2008 1 commit
  27. 19 Dec, 2008 1 commit
    • Ingo Molnar's avatar
      tracing: fix warnings in kernel/trace/trace_sched_switch.c · c71dd42d
      Ingo Molnar authored
      these warnings:
        kernel/trace/trace_sched_switch.c: In function ‘tracing_sched_register’:
        kernel/trace/trace_sched_switch.c:96: warning: passing argument 1 of ‘register_trace_sched_wakeup_new’ from incompatible pointer type
        kernel/trace/trace_sched_switch.c:112: warning: passing argument 1 of ‘unregister_trace_sched_wakeup_new’ from incompatible pointer type
        kernel/trace/trace_sched_switch.c: In function ‘tracing_sched_unregister’:
        kernel/trace/trace_sched_switch.c:121: warning: passing argument 1 of ‘unregister_trace_sched_wakeup_new’ from incompatible pointer type
      Trigger because sched_wakeup_new tracepoints need the same trace
      signature as sched_wakeup - which was changed recently.
      Fix it.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  28. 12 Dec, 2008 1 commit
  29. 16 Nov, 2008 1 commit
    • Mathieu Desnoyers's avatar
      tracepoints: add DECLARE_TRACE() and DEFINE_TRACE() · 7e066fb8
      Mathieu Desnoyers authored
      Impact: API *CHANGE*. Must update all tracepoint users.
      Add DEFINE_TRACE() to tracepoints to let them declare the tracepoint
      structure in a single spot for all the kernel. It helps reducing memory
      consumption, especially when declaring a lot of tracepoints, e.g. for
      kmalloc tracing.
      *API CHANGE WARNING*: now, DECLARE_TRACE() must be used in headers for
      tracepoint declarations rather than DEFINE_TRACE(). This is the sane way
      to do it. The name previously used was misleading.
      Updates scheduler instrumentation to follow this API change.
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  30. 14 Oct, 2008 2 commits
    • Ingo Molnar's avatar
      sched: clean up tracepoints · cf569a93
      Ingo Molnar authored
      make it a bit more structured hence more readable.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Mathieu Desnoyers's avatar
      tracing, sched: LTTng instrumentation - scheduler · 0a16b607
      Mathieu Desnoyers authored
      Instrument the scheduler activity (sched_switch, migration, wakeups,
      wait for a task, signal delivery) and process/thread
      creation/destruction (fork, exit, kthread stop). Actually, kthread
      creation is not instrumented in this patch because it is architecture
      dependent. It allows to connect tracers such as ftrace which detects
      scheduling latencies, good/bad scheduler decisions. Tools like LTTng can
      export this scheduler information along with instrumentation of the rest
      of the kernel activity to perform post-mortem analysis on the scheduler
      About the performance impact of tracepoints (which is comparable to
      markers), even without immediate values optimizations, tests done by
      Hideo Aoki on ia64 show no regression. His test case was using hackbench
      on a kernel where scheduler instrumentation (about 5 events in code
      scheduler code) was added. See the "Tracepoints" patch header for
      performance result detail.
      Changelog :
      - Change instrumentation location and parameter to match ftrace
        instrumentation, previously done with kernel markers.
      [ mingo@elte.hu: conflict resolutions ]
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Acked-by: default avatar'Peter Zijlstra' <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>