29 Jun, 2010

1 commit


15 May, 2010

2 commits

  • Multiple events may use the same method to print their data.
    Instead of having all events have a pointer to their print funtions,
    the trace_event structure now points to a trace_event_functions structure
    that will hold the way to print ouf the event.

    The event itself is now passed to the print function to let the print
    function know what kind of event it should print.

    This opens the door to consolidating the way several events print
    their output.

    text data bss dec hex filename
    4913961 1088356 861512 6863829 68bbd5 vmlinux.orig
    4900382 1048964 861512 6810858 67ecea vmlinux.init
    4900446 1049028 861512 6810986 67ed6a vmlinux.preprint

    This change slightly increases the size but is needed for the next change.

    v3: Fix the branch tracer events to handle this change.

    v2: Fix the new function graph tracer event calls to handle this change.

    Acked-by: Mathieu Desnoyers
    Acked-by: Masami Hiramatsu
    Acked-by: Frederic Weisbecker
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • Move the defined fields from the event to the class structure.
    Since the fields of the event are defined by the class they belong
    to, it makes sense to have the class hold the information instead
    of the individual events. The events of the same class would just
    hold duplicate information.

    After this change the size of the kernel dropped another 3K:

    text data bss dec hex filename
    4913961 1088356 861512 6863829 68bbd5 vmlinux.orig
    4900252 1057412 861512 6819176 680d68 vmlinux.regs
    4900375 1053380 861512 6815267 67fe23 vmlinux.fields

    Although the text increased, this was mainly due to the C files
    having to adapt to the change. This is a constant increase, where
    new tracepoints will not increase the Text. But the big drop is
    in the data size (as well as needed allocations to hold the fields).
    This will give even more savings as more tracepoints are created.

    Note, if just TRACE_EVENT()s are used and not DECLARE_EVENT_CLASS()
    with several DEFINE_EVENT()s, then the savings will be lost. But
    we are pushing developers to consolidate events with DEFINE_EVENT()
    so this should not be an issue.

    The kprobes define a unique class to every new event, but are dynamic
    so it should not be a issue.

    The syscalls however have a single class but the fields for the individual
    events are different. The syscalls use a metadata to define the
    fields. I moved the fields list from the event to the metadata and
    added a "get_fields()" function to the class. This function is used
    to find the fields. For normal events and kprobes, get_fields() just
    returns a pointer to the fields list_head in the class. For syscall
    events, it returns the fields list_head in the metadata for the event.

    v2: Fixed the syscall fields. The syscall metadata needs a list
    of fields for both enter and exit.

    Acked-by: Frederic Weisbecker
    Acked-by: Mathieu Desnoyers
    Acked-by: Masami Hiramatsu
    Cc: Tom Zanussi
    Cc: Peter Zijlstra
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

10 Mar, 2010

1 commit


01 Mar, 2010

1 commit

  • …git/tip/linux-2.6-tip

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (172 commits)
    perf_event, amd: Fix spinlock initialization
    perf_event: Fix preempt warning in perf_clock()
    perf tools: Flush maps on COMM events
    perf_events, x86: Split PMU definitions into separate files
    perf annotate: Handle samples not at objdump output addr boundaries
    perf_events, x86: Remove superflous MSR writes
    perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in()
    perf_events, x86: AMD event scheduling
    perf_events: Add new start/stop PMU callbacks
    perf_events: Report the MMAP pgoff value in bytes
    perf annotate: Defer allocating sym_priv->hist array
    perf symbols: Improve debugging information about symtab origins
    perf top: Use a macro instead of a constant variable
    perf symbols: Check the right return variable
    perf/scripts: Tag syscall_name helper as not yet available
    perf/scripts: Add perf-trace-python Documentation
    perf/scripts: Remove unnecessary PyTuple resizes
    perf/scripts: Add syscall tracing scripts
    perf/scripts: Add Python scripting engine
    perf/scripts: Remove check-perf-trace from listed scripts
    ...

    Fix trivial conflict in tools/perf/util/probe-event.c

    Linus Torvalds
     

07 Jan, 2010

1 commit

  • The previous patches added the use of print_fmt string and changes
    the trace_define_field() function to also create the fields and
    format output for the event format files.

    text data bss dec hex filename
    5857201 1355780 9336808 16549789 fc879d vmlinux
    5884589 1351684 9337896 16574169 fce6d9 vmlinux-orig

    The above shows the size of the vmlinux after this patch set
    compared to the vmlinux-orig which is before the patch set.

    This saves us 27k on text, 1k on bss and adds just 4k of data.

    The total savings of 24k in size.

    Signed-off-by: Lai Jiangshan
    LKML-Reference:
    Acked-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Lai Jiangshan
     

28 Dec, 2009

1 commit

  • Quoted from Ingo:

    | This reminds me - i think we should eliminate CONFIG_EVENT_PROFILE -
    | it's an unnecessary Kconfig complication. If both PERF_EVENTS and
    | EVENT_TRACING is enabled we should expose generic tracepoints.
    |
    | Nor is it limited to event 'profiling', so it has become a misnomer as
    | well.

    Signed-off-by: Li Zefan
    Cc: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     

02 Dec, 2009

6 commits


23 Oct, 2009

1 commit


14 Oct, 2009

1 commit

  • Most of the syscalls metadata processing is done from arch.
    But these operations are mostly generic accross archs. Especially now
    that we have a common variable name that expresses the number of
    syscalls supported by an arch: NR_syscalls, the only remaining bits
    that need to reside in arch is the syscall nr to addr translation.

    v2: Compare syscalls symbols only after the "sys" prefix so that we
    avoid spurious mismatches with archs that have syscalls wrappers,
    in which case syscalls symbols have "SyS" prefixed aliases.
    (Reported by: Heiko Carstens)

    Signed-off-by: Frederic Weisbecker
    Acked-by: Heiko Carstens
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Cc: Jason Baron
    Cc: Lai Jiangshan
    Cc: Martin Schwidefsky
    Cc: Paul Mundt

    Frederic Weisbecker
     

27 Aug, 2009

1 commit

  • Add dynamic ftrace_event_call support to ftrace. Trace engines can add
    new ftrace_event_call to ftrace on the fly. Each operator function of
    the call takes an ftrace_event_call data structure as an argument,
    because these functions may be shared among several ftrace_event_calls.

    Changes from v13:
    - Define remove_subsystem_dir() always (revirt a2ca5e03), because
    trace_remove_event_call() uses it.
    - Modify syscall tracer because of ftrace_event_call change.

    [fweisbec@gmail.com: Fixed conflict against latest tracing/core]

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Avi Kivity
    Cc: Andi Kleen
    Cc: Christoph Hellwig
    Cc: Frank Ch. Eigler
    Cc: H. Peter Anvin
    Cc: Ingo Molnar
    Cc: Jason Baron
    Cc: Jim Keniston
    Cc: K.Prasad
    Cc: Lai Jiangshan
    Cc: Li Zefan
    Cc: Przemysław Pawełczyk
    Cc: Roland McGrath
    Cc: Sam Ravnborg
    Cc: Srikar Dronamraju
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    Cc: Vegard Nossum
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Masami Hiramatsu
     

26 Aug, 2009

3 commits

  • This converts the syscall_enter/exit tracepoints into TRACE_EVENTs, so
    you can have generic ftrace events that capture all system calls with
    arguments and return values. These generic events are also renamed to
    sys_enter/exit, so they're more closely aligned to the specific
    sys_enter_foo events.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    Cc: Paul Mundt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     
  • It's not strictly correct for the tracepoint reg/unreg callbacks to
    occur when a client is hooking up, because the actual tracepoint may not
    be present yet. This happens to be fine for syscall, since that's in
    the core kernel, but it would cause problems for tracepoints defined in
    a module that hasn't been loaded yet. It also means the reg/unreg has
    to be EXPORTed for any modules to use the tracepoint (as in SystemTap).

    This patch removes DECLARE_TRACE_WITH_CALLBACK, and instead introduces
    DEFINE_TRACE_FN which stores the callbacks in struct tracepoint. The
    callbacks are used now when the active state of the tracepoint changes
    in set_tracepoint & disable_tracepoint.

    This also introduces TRACE_EVENT_FN, so ftrace events can also provide
    registration callbacks if needed.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    Cc: Paul Mundt
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     
  • The syscall enter/exit tracepoints are only supported on archs that
    HAVE_SYSCALL_TRACEPOINTS, so the declarations should be #ifdef'ed.
    Also, the definition of syscall_regfunc and syscall_unregfunc should
    depend on this same config, rather than the ftrace-specific one.

    Signed-off-by: Josh Stone
    Cc: Jason Baron
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Li Zefan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Lai Jiangshan
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Josh Stone
     

19 Aug, 2009

2 commits

  • 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: Li Zefan
    Cc: Jason Baron
    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     
  • 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: Li Zefan
    Cc: Jason Baron
    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Li Zefan
     

12 Aug, 2009

6 commits

  • 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: Frederic Weisbecker
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Cc: Jason Baron

    Frederic Weisbecker
     
  • 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: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron
     
  • 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: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron
     
  • 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: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron
     
  • add two tracepoints in syscall exit and entry path, conditioned on
    TIF_SYSCALL_FTRACE. Supports the syscall trace event code.

    Signed-off-by: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron
     
  • Call arch_init_ftrace_syscalls at boot, so we can determine early the
    set of syscalls for the syscall trace events.

    Signed-off-by: Jason Baron
    Cc: Lai Jiangshan
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Mathieu Desnoyers
    Cc: Jiaying Zhang
    Cc: Martin Bligh
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Signed-off-by: Frederic Weisbecker

    Jason Baron
     

09 Apr, 2009

1 commit

  • Impact: fix build warnings and possibe compat misbehavior on IA64

    Building a kernel on ia64 might trigger these ugly build warnings:

    CC arch/ia64/ia32/sys_ia32.o
    In file included from arch/ia64/ia32/sys_ia32.c:55:
    arch/ia64/ia32/ia32priv.h:290:1: warning: "elf_check_arch" redefined
    In file included from include/linux/elf.h:7,
    from include/linux/module.h:14,
    from include/linux/ftrace.h:8,
    from include/linux/syscalls.h:68,
    from arch/ia64/ia32/sys_ia32.c:18:
    arch/ia64/include/asm/elf.h:19:1: warning: this is the location of the previous definition
    [...]

    sys_ia32.c includes linux/syscalls.h which in turn includes linux/ftrace.h
    to import the syscalls tracing prototypes.

    But including ftrace.h can pull too much things for a low level file,
    especially on ia64 where the ia32 private headers conflict with higher
    level headers.

    Now we isolate the syscall tracing headers in their own lightweight file.

    Reported-by: Tony Luck
    Tested-by: Tony Luck
    Signed-off-by: Frederic Weisbecker
    Acked-by: Tony Luck
    Signed-off-by: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Jason Baron
    Cc: "Frank Ch. Eigler"
    Cc: Mathieu Desnoyers
    Cc: KOSAKI Motohiro
    Cc: Lai Jiangshan
    Cc: Jiaying Zhang
    Cc: Michael Rubin
    Cc: Martin Bligh
    Cc: Michael Davidson
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker