1. 26 Aug, 2009 7 commits
    • Xiao Guangrong's avatar
      tracing/events: fix the include file dependencies · 5ac35daa
      Xiao Guangrong authored
      The TRACE_EVENT depends on the include/linux/tracepoint.h first
      and include/trace/ftrace.h later, if we include the ftrace.h early,
      a building error will occur.
      
      Both define TRACE_EVENT in trace_a.h and trace_b.h, if we include
      those in .c file, like this:
      
      #define CREATE_TRACE_POINTS
      include <trace/events/trace_a.h>
      include <trace/events/trace_b.h>
      
      The above will not work, because the TRACE_EVENT was re-defined by
      the previous .h file.
      Reported-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
      Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <4A937F5E.3020802@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5ac35daa
    • Zhaolei's avatar
      ftrace: Move setting of clock-source out of options · 5079f326
      Zhaolei authored
      There are many clock sources for the tracing system but we can only
      enable/disable one at a time with the trace/options file.
      We can move the setting of clock-source out of options and add a separate
      file for it:
       # cat trace_clock
       [local] global
       # echo global > trace_clock
       # cat trace_clock
       local [global]
      Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
      LKML-Reference: <4A939D08.6050604@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5079f326
    • Li Zefan's avatar
      tracing/filters: Support filtering for char * strings · 87a342f5
      Li Zefan authored
      Usually, char * entries are dangerous in traces because the string
      can be released whereas a pointer to it can still wait to be read from
      the ring buffer.
      
      But sometimes we can assume it's safe, like in case of RO data
      (eg: __file__ or __line__, used in bkl trace event). If these RO data
      are in a module and so is the call to the trace event, then it's safe,
      because the ring buffer will be flushed once this module get unloaded.
      
      To allow char * to be treated as a string:
      
      	TRACE_EVENT(...,
      
      		TP_STRUCT__entry(
      			__field_ext(const char *, name, FILTER_PTR_STRING)
      			...
      		)
      
      		...
      	);
      
      The filtering will not dereference "char *" unless the developer
      explicitly sets FILTER_PTR_STR in __field_ext.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B9287.90205@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      87a342f5
    • Li Zefan's avatar
      tracing/filters: Add __field_ext() to TRACE_EVENT · 43b51ead
      Li Zefan authored
      Add __field_ext(), so a field can be assigned to a specific
      filter_type, which matches a corresponding filter function.
      
      For example, a later patch will allow this:
      	__field_ext(const char *, str, FILTER_PTR_STR);
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B9272.60507095@cn.fujitsu.com>
      
      [
        Fixed a -1 to FILTER_OTHER
        Forward ported to latest kernel.
      ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      43b51ead
    • Li Zefan's avatar
      tracing/filters: Add filter_type to struct ftrace_event_field · aa38e9fc
      Li Zefan authored
      The type of a field is stored as a string in @type, and here
      we add @filter_type which is an enum value.
      
      This prepares for later patches, so we can specifically assign
      different @filter_type for the same @type.
      
      For example normally a "char *" field is treated as a ptr,
      but we may want it to be treated as a string when doing filting.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B925E.9030605@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      aa38e9fc
    • Josh Triplett's avatar
      tracing: Add vim script to enable folding for function_graph traces · 6591b493
      Josh Triplett authored
      function_graph traces look like nested function calls, complete with
      braces denoting the start and end of functions.  function-graph-fold.vim
      teaches vim how to fold these functions, to make it more convenient to
      browse them.
      
      To use, :source function-graph-fold.vim while viewing a function_graph
      trace, or use "view -S function-graph-fold.vim some-trace" to load it
      from the command-line together with a trace.  You can then use the usual
      vim fold commands, such as "za", to open and close nested functions.
      While closed, a fold will show the total time taken for a call, as would
      normally appear on the line with the closing brace.  Folded functions
      will not include finish_task_switch(), so folding should remain
      relatively sane even through a context switch.
      
      Note that this will almost certainly only work well with a single-CPU
      trace (e.g. trace-cmd report --cpu 1).  It also takes some time to run
      (a few seconds for a large trace on my laptop).  Nevertheless, I found
      it very handy to get an overview of a trace and then drill down on
      problematic calls.
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      LKML-Reference: <20090806145701.GB7661@feather>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6591b493
    • Steven Rostedt's avatar
      tracing/sched: show CPU task wakes up on in trace event · f0693c8b
      Steven Rostedt authored
      While debugging the scheduler push / pull algorithm, I found
      it very annoying that the sched wake up events did not show
      the CPU that the task was waking on. In order to analyze the
      scheduler, I needed that information.
      
      This patch adds recording of the CPU that a task is waking up
      on.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      f0693c8b
  2. 25 Aug, 2009 1 commit
  3. 20 Aug, 2009 1 commit
    • Li Zefan's avatar
      tracing/syscalls: Fix the output of syscalls with no arguments · 4539f077
      Li Zefan authored
      Before:
      
        # echo 1 > events/syscalls/sys_enter_sync/enable
        # cat events/syscalls/sys_enter_sync/format
        ...
              field:int nr;   offset:12;      size:4;
      
        print fmt: "# sync
        # cat trace
        ...
                  sync-8950  [000]  2366.087670: sys_sync(
      
      After:
      
        # echo 1 > events/syscalls/sys_enter_sync/enable
        # cat events/syscalls/sys_enter_sync/format
        ...
              field:int nr;   offset:12;      size:4;
      
        print fmt: ""
        # sync
        # cat trace
                  sync-2134  [001]   136.780735: sys_sync()
      Reported-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <4A8D05AF.20103@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4539f077
  4. 19 Aug, 2009 6 commits
    • Li Zefan's avatar
      tracing/syscalls: Add filtering support · 540b7b8d
      Li Zefan authored
      Add filtering support for syscall events:
      
       # echo 'mode == 0666' > events/syscalls/sys_enter_open
       # echo 'ret == 0' > events/syscalls/sys_exit_open
       # echo 1 > events/syscalls/sys_enter_open
       # echo 1 > events/syscalls/sys_exit_open
       # cat trace
       ...
         modprobe-3084 [001] 117.463140: sys_open(filename: 917d3e8, flags: 0, mode: 1b6)
         modprobe-3084 [001] 117.463176: sys_open -> 0x0
             less-3086 [001] 117.510455: sys_open(filename: 9c6bdb8, flags: 8000, mode: 1b6)
         sendmail-2574 [001] 122.145840: sys_open(filename: b807a365, flags: 0, mode: 1b6)
       ...
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAFCB.1040006@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      540b7b8d
    • Li Zefan's avatar
      tracing/events: Add trace_define_common_fields() · e647d6b3
      Li Zefan authored
      Extract duplicate code. Also prepare for the later patch.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAFB8.1010304@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e647d6b3
    • Li Zefan's avatar
      tracing/events: Add ftrace_event_call param to define_fields() · 14be96c9
      Li Zefan authored
      This parameter is needed by syscall events to add define_fields()
      handler.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF90.6060801@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      14be96c9
    • Li Zefan's avatar
      tracing/syscalls: Add fields format for exit events · 10a5b66f
      Li Zefan authored
      Add "format" file for syscall exit events:
      
       # cat events/syscalls/sys_exit_open/format
       name: sys_exit_open
       ID: 344
       format:
               field:unsigned short common_type;       offset:0;       size:2;
               field:unsigned char common_flags;       offset:2;       size:1;
               field:unsigned char common_preempt_count;       offset:3;       size:1;
               field:int common_pid;   offset:4;       size:4;
               field:int common_tgid;  offset:8;       size:4;
      
               field:int nr;   offset:12;      size:4;
               field:unsigned long ret;        offset:16;      size:4;
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF61.3060307@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      10a5b66f
    • Li Zefan's avatar
      tracing/syscalls: Fix fields format for enter events · e6971969
      Li Zefan authored
      The "format" file of a trace event is originally for parsers to
      parse ftrace binary output.
      
      But the "format" file of a syscall event can only be used by
      perfcounter, because it describes the format of struct
      syscall_enter_record not struct syscall_trace_enter.
      
      To fix this, we remove struct syscall_enter_record, and then
      struct syscall_trace_enter will be used by both perf profile
      and ftrace.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF39.1030404@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e6971969
    • Ingo Molnar's avatar
      [S390] ftrace: update system call tracer support · 5e9ad7df
      Ingo Molnar authored
      Commit fb34a08c ("tracing: Add trace events for each syscall
      entry/exit") changed the lowlevel API to ftrace syscall tracing
      but did not update s390 which started making use of it recently.
      
      This broke the s390 build, as reported by Paul Mundt.
      
      Update the callbacks with the syscall number and the syscall
      return code values. This allows per syscall tracepoints,
      syscall argument enumeration /debug/tracing/events/syscalls/
      and perfcounters support and integration on s390 too.
      Reported-by: default avatarPaul Mundt <lethal@linux-sh.org>
      Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <tip-fb34a08c@git.kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5e9ad7df
  5. 17 Aug, 2009 5 commits
    • Li Zefan's avatar
      ftrace: Simplify seqfile code · 3be04b47
      Li Zefan authored
      Use seq_release_private().
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A891AAB.8090701@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3be04b47
    • Li Zefan's avatar
      trace_stack: Simplify seqfile code · 2fc5f0cf
      Li Zefan authored
      Extract duplicate code in t_start() and t_next().
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A891A91.4030602@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2fc5f0cf
    • Li Zefan's avatar
      trace_stat: Fix missing entry in stat file · 97d53202
      Li Zefan authored
      One entry is missing in the output of a stat file.
      
      The cause is, when stat_seq_start() is called the 2nd time, we
      should start from the (pos-1)th elem in the rbtree but not pos,
      because pos == 0 is the header.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A891A65.70009@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      97d53202
    • Li Zefan's avatar
      tracing/syscalls: Fix to print parameter types · ba8b3a40
      Li Zefan authored
      When syscall tracing was implemented as a tracer,
      "syscall_arg_type" trace option could be set to enable the
      display of syscall parameter types.
      
      Now this option is gone since it's no longer a tracer, but the
      code is still there but dead.
      
      So we remove dead code and re-enable the printing of paramete
      types via the verbose option:
      
        # echo verbose > trace_options
        # echo syscalls > set_event
        # cat trace
      	...
              bash-3331  [000]    95.348937: sys_fcntl64 -> 0x1
              bash-3331  [000]    95.348942: sys_close(unsigned int fd: a)
      	...
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <4A891AF6.5050102@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ba8b3a40
    • Li Zefan's avatar
      tracing/events: Add module tracepoints · 7ead8b83
      Li Zefan authored
      Add trace points to trace module_load, module_free, module_get,
      module_put and module_request, and use trace_event facility to
      get the trace output.
      
      Here's the sample output:
      
           TASK-PID    CPU#    TIMESTAMP  FUNCTION
              | |       |          |         |
          <...>-42    [000]     1.758380: module_request: fb0 wait=1 call_site=fb_open
          ...
          <...>-60    [000]     3.269403: module_load: scsi_wait_scan
          <...>-60    [000]     3.269432: module_put: scsi_wait_scan call_site=sys_init_module refcnt=0
          <...>-61    [001]     3.273168: module_free: scsi_wait_scan
          ...
          <...>-1021  [000]    13.836081: module_load: sunrpc
          <...>-1021  [000]    13.840589: module_put: sunrpc call_site=sys_init_module refcnt=-1
          <...>-1027  [000]    13.848098: module_get: sunrpc call_site=try_module_get refcnt=0
          <...>-1027  [000]    13.848308: module_get: sunrpc call_site=get_filesystem refcnt=1
          <...>-1027  [000]    13.848692: module_put: sunrpc call_site=put_filesystem refcnt=0
          ...
       modprobe-2587  [001]  1088.437213: module_load: trace_events_sample F
       modprobe-2587  [001]  1088.437786: module_put: trace_events_sample call_site=sys_init_module refcnt=0
      
      Note:
      
      - the taints flag can be 'F', 'C' and/or 'P' if mod->taints != 0
      
      - the module refcnt is percpu, so it can be negative in a
        specific cpu
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <4A891B3C.5030608@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7ead8b83
  6. 13 Aug, 2009 1 commit
    • Ingo Molnar's avatar
      tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures · 60d970c2
      Ingo Molnar authored
      The new syscall_regfunc()/unregfunc() functions rely on
      the existence of TIF_SYSCALL_FTRACE - but that TIF flag
      is only offered by HAVE_FTRACE_SYSCALLS.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      60d970c2
  7. 11 Aug, 2009 17 commits
    • Frederic Weisbecker's avatar
      tracing: Support for syscall events raw records in perfcounters · 19007a67
      Frederic Weisbecker authored
      This bring the support for raw syscall events in perfcounters.
      The arguments or exit value are saved as a raw sample using
      the PERF_SAMPLE_RAW attribute in a perf counter.
      
      Example (for now you must explicitly set the PERF_SAMPLE_RAW flag
      in perf record):
      
      perf record -e syscalls:sys_enter_open -f -F 1 -a
      perf report -D
      
      	0x2cbb8 [0x50]: event: 9
      	.
      	. ... raw event: size 80 bytes
      	.  0000:  09 00 00 00 02 00 50 00 20 e9 39 ab 0a 7f 00 00  ......P. .9....
      	.  0010:  bc 14 00 00 bc 14 00 00 01 00 00 00 00 00 00 00  ...............
      	.  0020:  2c 00 00 00 15 01 01 00 bc 14 00 00 bc 14 00 00  ,..............
                        ^  ^  ^  ^  ^  ^  ^  ..........................
                        Event Size  struct trace_entry
      
      	.  0030:  00 00 00 00 46 98 43 02 00 00 00 00 80 08 00 00  ....F.C........
                        ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
                        ptr to file name        open flags
      
      	.  0040:  00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ...............
                        ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
      	.         open mode               padding
      
      	0x2cbb8 [0x50]: PERF_EVENT_SAMPLE (IP, 2): 5308: 0x7f0aab39e920 period: 1
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      19007a67
    • Frederic Weisbecker's avatar
      tracing: Add fields format definition for syscall events · dc4ddb4c
      Frederic Weisbecker authored
      Define the format of the syscall trace fields to parse the binary
      values from a raw trace using the syscall events "format" file.
      
      This is defined dynamically using the syscalls metadata.
      It prepares the export of syscall event raw records to perf
      counters.
      
      Example:
      
      $ cat /debug/tracing/events/syscalls/sys_enter_sched_getparam/format
      name: sys_enter_sched_getparam
      ID: 39
      format:
      	field:unsigned short common_type;	offset:0;	size:2;
      	field:unsigned char common_flags;	offset:2;	size:1;
      	field:unsigned char common_preempt_count;	offset:3;	size:1;
      	field:int common_pid;	offset:4;	size:4;
      	field:int common_tgid;	offset:8;	size:4;
      
      	field:pid_t pid;	offset:12;	size:8;
      	field:struct sched_param * param;	offset:20;	size:8;
      
      print fmt: "pid: 0x%08lx, param: 0x%08lx", ((unsigned long)(REC->pid)), ((unsigned long)(REC->param))
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      dc4ddb4c
    • Frederic Weisbecker's avatar
      tracing: Add ftrace event call parameter to its field descriptor handler · e8f9f4d7
      Frederic Weisbecker authored
      Add the struct ftrace_event_call as a parameter of its show_format()
      callback. This way we can use it from the syscall trace events to
      retrieve the syscall name from the ftrace event call parameter and
      describe its fields using the syscalls metadata.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      e8f9f4d7
    • Jason Baron's avatar
      tracing: Convert x86_64 mmap and uname to use DEFINE_SYSCALL · 0ac676fb
      Jason Baron authored
      A number of syscalls are not using 'DEFINE_SYSCALL'. I'm not sure why.
      Convert x86_64 uname and mmap to use DEFINE_SYSCALL.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      0ac676fb
    • Jason Baron's avatar
      tracing: Add more namespace area to 'perf list' output · 48c2e17f
      Jason Baron authored
      The new syscall tracepoints names can be too long for the 'perf list'
      output.
      Add a few more characters.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      48c2e17f
    • Jason Baron's avatar
      tracing: Add perf counter support for syscalls tracing · f4b5ffcc
      Jason Baron authored
      The perf counter support is automated for usual trace events. But we
      have to define specific callbacks for this to handle syscalls trace
      events
      
      Make 'perf stat -e syscalls:sys_enter_blah' work with syscall style
      tracepoints.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      f4b5ffcc
    • Jason Baron's avatar
      tracing: Add individual syscalls tracepoint id support · 64c12e04
      Jason Baron authored
      The current state of syscalls tracepoints generates only one event id
      for every syscall events.
      
      This patch associates an id with each syscall trace event, so that we
      can identify each syscall trace event using the 'perf' tool.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      64c12e04
    • Jason Baron's avatar
      tracing: Add trace events for each syscall entry/exit · fb34a08c
      Jason Baron authored
      Layer Frederic's syscall tracer on tracepoints. We create trace events
      via hooking into the SYSCALL_DEFINE macros. This allows us to
      individually toggle syscall entry and exit points on/off.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      fb34a08c
    • Jason Baron's avatar
      tracing: Add ftrace_event_call void * 'data' field · 69fd4f0e
      Jason Baron authored
      add an optional void * pointer to 'ftrace_event_call' that is
      passed in for regfunc and unregfunc.
      
      This prepares for syscall tracepoints creation by passing the name of
      the syscall we want to trace and then retrieve its number through our
      arch syscall table.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      69fd4f0e
    • Jason Baron's avatar
      tracing: Raw_init() bailout in trace event register fail case · f744bd57
      Jason Baron authored
      Allow the return value of raw_init() trace event callback to bail us out
      of creating a trace event file, in case we fail to register our
      event.
      
      Also, we plan to return -ENOSYS for syscall events that don't match any
      syscalls listed in our arch tracing syscall table, we don't want to warn
      in that case, we just want this event to be invisible in debugfs and
      ignored.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      f744bd57
    • Jason Baron's avatar
      tracing: Update FTRACE_SYSCALL_MAX · 9daa77e2
      Jason Baron authored
      update FTRACE_SYSCALL_MAX to the current number of syscalls
      
      FTRACE_SYSCALL_MAX is a temporary solution to get the number of
      syscalls supported by the arch until we find a more dynamic way
      to get this number.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      9daa77e2
    • Jason Baron's avatar
      tracing: Add syscall tracepoints · a871bd33
      Jason Baron authored
      add two tracepoints in syscall exit and entry path, conditioned on
      TIF_SYSCALL_FTRACE. Supports the syscall trace event code.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      a871bd33
    • Jason Baron's avatar
      tracing: Add DECLARE_TRACE_WITH_CALLBACK() macro · 63fbdab3
      Jason Baron authored
      Introduce a new 'DECLARE_TRACE_WITH_CALLBACK()' macro, so that
      tracepoints can associate an external register/unregister function.
      
      This prepares for the syscalls tracer conversion to trace events. We
      will need to perform arch level operations once a syscall event is
      turned on/off, such as TIF flags setting, hence the need of such
      specific callbacks.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      63fbdab3
    • Jason Baron's avatar
      tracing: Call arch_init_ftrace_syscalls at boot · 066e0378
      Jason Baron authored
      Call arch_init_ftrace_syscalls at boot, so we can determine early the
      set of syscalls for the syscall trace events.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      066e0378
    • Jason Baron's avatar
      tracing: Map syscall name to number · eeac19a7
      Jason Baron authored
      Add a new function to support translating a syscall name to number at
      runtime.
      This allows the syscall event tracer to map syscall names to number.
      Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      eeac19a7
    • Zhaolei's avatar
      tracing: Rename set_tracer_flags()'s local variable trace_flags · 7770841e
      Zhaolei authored
      set_tracer_flags() have a local variable named trace_flags which has
      the same name than a global one in the same scope.
      This leads to confusion, using tracer_flags should be better by its
      meaning.
      
      Changelog:
      v1->v2: Simplified another patch in this patchset, no change in this
              patch.
      Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      7770841e
    • Ingo Molnar's avatar
      Merge branch 'linus' into tracing/core · 89034bc2
      Ingo Molnar authored
      Conflicts:
      	kernel/trace/trace_events_filter.c
      
      We use the tracing/core version.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      89034bc2
  8. 10 Aug, 2009 2 commits
    • Linus Torvalds's avatar
      pty: fix data loss when stopped (^S/^Q) · 85dfd81d
      Linus Torvalds authored
      Commit d945cb9c ("pty: Rework the pty layer to use the normal buffering
      logic") dropped the test for 'tty->stopped' in pty_write_room(), which
      then causes the n_tty line discipline thing to not throttle the data
      properly when the tty is stopped.
      
      So instead of pausing the write due to the tty being stopped, the ldisc
      layer would go ahead and push it down to the pty.  The pty write()
      routine would then refuse to take the data (because it _did_ check
      'stopped'), and the data wouldn't actually be written.
      
      This whole stopped test should eventually be moved into the tty ldisc
      layer rather than have low-level tty drivers care about these things,
      but right now the fix is to just re-instate the missing pty 'stopped'
      handling.
      Reported-and-tested-by: default avatarArtur Skawina <art.08.09@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      85dfd81d
    • Linus Torvalds's avatar
      Merge branch 'perfcounters-fixes-for-linus' of... · d00aa669
      Linus Torvalds authored
      Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
      
      * 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (27 commits)
        perf_counter: Zero dead bytes from ftrace raw samples size alignment
        perf_counter: Subtract the buffer size field from the event record size
        perf_counter: Require CAP_SYS_ADMIN for raw tracepoint data
        perf_counter: Correct PERF_SAMPLE_RAW output
        perf tools: callchain: Fix bad rounding of minimum rate
        perf_counter tools: Fix libbfd detection for systems with libz dependency
        perf: "Longum est iter per praecepta, breve et efficax per exempla"
        perf_counter: Fix a race on perf_counter_ctx
        perf_counter: Fix tracepoint sampling to be part of generic sampling
        perf_counter: Work around gcc warning by initializing tracepoint record unconditionally
        perf tools: callchain: Fix sum of percentages to be 100% by displaying amount of ignored chains in fractal mode
        perf tools: callchain: Fix 'perf report' display to be callchain by default
        perf tools: callchain: Fix spurious 'perf report' warnings: ignore empty callchains
        perf record: Fix the -A UI for empty or non-existent perf.data
        perf util: Fix do_read() to fail on EOF instead of busy-looping
        perf list: Fix the output to not include tracepoints without an id
        perf_counter/powerpc: Fix oops on cpus without perf_counter hardware support
        perf stat: Fix tool option consistency: rename -S/--scale to -c/--scale
        perf report: Add debug help for the finding of symbol bugs - show the symtab origin (DSO, build-id, kernel, etc)
        perf report: Fix per task mult-counter stat reporting
        ...
      d00aa669