30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

14 Mar, 2010

1 commit

  • …/git/tip/linux-2.6-tip

    * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    locking: Make sparse work with inline spinlocks and rwlocks
    x86/mce: Fix RCU lockdep splats
    rcu: Increase RCU CPU stall timeouts if PROVE_RCU
    ftrace: Replace read_barrier_depends() with rcu_dereference_raw()
    rcu: Suppress RCU lockdep warnings during early boot
    rcu, ftrace: Fix RCU lockdep splat in ftrace_perf_buf_prepare()
    rcu: Suppress __mpol_dup() false positive from RCU lockdep
    rcu: Make rcu_read_lock_sched_held() handle !PREEMPT
    rcu: Add control variables to lockdep_rcu_dereference() diagnostics
    rcu, cgroup: Relax the check in task_subsys_state() as early boot is now handled by lockdep-RCU
    rcu: Use wrapper function instead of exporting tasklist_lock
    sched, rcu: Fix rcu_dereference() for RCU-lockdep
    rcu: Make task_subsys_state() RCU-lockdep checks handle boot-time use
    rcu: Fix holdoff for accelerated GPs for last non-dynticked CPU
    x86/gart: Unexport gart_iommu_aperture

    Fix trivial conflicts in kernel/trace/ftrace.c

    Linus Torvalds
     

13 Mar, 2010

1 commit

  • If the graph tracer is active, and a task is forked but the allocating of
    the processes graph stack fails, it can cause crash later on.

    This is due to the temporary stack being NULL, but the curr_ret_stack
    variable is copied from the parent. If it is not -1, then in
    ftrace_graph_probe_sched_switch() the following:

    for (index = next->curr_ret_stack; index >= 0; index--)
    next->ret_stack[index].calltime += timestamp;

    Will cause a kernel OOPS.

    Found with Li Zefan's ftrace_stress_test.

    Cc: stable@kernel.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

11 Mar, 2010

2 commits

  • …/rostedt/linux-2.6-trace into tracing/urgent

    Ingo Molnar
     
  • Replace the calls to read_barrier_depends() in
    ftrace_list_func() with rcu_dereference_raw() to improve
    readability. The reason that we use rcu_dereference_raw() here
    is that removed entries are never freed, instead they are simply
    leaked. This is one of a very few cases where use of
    rcu_dereference_raw() is the long-term right answer. And I
    don't yet know of any others. ;-)

    Signed-off-by: Paul E. McKenney
    Acked-by: Steven Rostedt
    Cc: Frederic Weisbecker
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

06 Mar, 2010

1 commit

  • The declaration of ftrace_set_func() is at the start of the ftrace.c file
    and wrapped with a #ifdef CONFIG_FUNCTION_GRAPH condition. If function
    graph tracing is enabled but CONFIG_DYNAMIC_FTRACE is not, a warning
    about that function being declared static and unused is given.

    This really should have been placed within the CONFIG_FUNCTION_GRAPH
    condition that uses ftrace_set_func().

    Moving the declaration down fixes the warning and makes the code cleaner.

    Reported-by: Peter Zijlstra
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

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
     

26 Feb, 2010

1 commit


12 Feb, 2010

1 commit

  • I don't see why we can only clear all functions from the filter.

    After patching:

    # echo sys_open > set_graph_function
    # echo sys_close >> set_graph_function
    # cat set_graph_function
    sys_open
    sys_close
    # echo '!sys_close' >> set_graph_function
    # cat set_graph_function
    sys_open

    Signed-off-by: Li Zefan
    LKML-Reference:
    Signed-off-by: Steven Rostedt

    Li Zefan
     

04 Feb, 2010

2 commits

  • Remove record freezing. Because kprobes never puts probe on
    ftrace's mcount call anymore, it doesn't need ftrace to check
    whether kprobes on it.

    Signed-off-by: Masami Hiramatsu
    Cc: systemtap
    Cc: DLE
    Cc: Steven Rostedt
    Cc: przemyslaw@pawelczyk.it
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     
  • Introducing *_text_reserved functions for checking the text
    address range is partially reserved or not. This patch provides
    checking routines for x86 smp alternatives and dynamic ftrace.
    Since both functions modify fixed pieces of kernel text, they
    should reserve and protect those from other dynamic text
    modifier, like kprobes.

    This will also be extended when introducing other subsystems
    which modify fixed pieces of kernel text. Dynamic text modifiers
    should avoid those.

    Signed-off-by: Masami Hiramatsu
    Cc: systemtap
    Cc: DLE
    Cc: Steven Rostedt
    Cc: przemyslaw@pawelczyk.it
    Cc: Frederic Weisbecker
    Cc: Ananth N Mavinakayanahalli
    Cc: Jim Keniston
    Cc: Mathieu Desnoyers
    Cc: Jason Baron
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

15 Jan, 2010

1 commit

  • For '*foo' pattern, we should allow any string ending with
    'foo', but ftrace filter incorrectly disallows strings
    like bar_foo_foo:

    # echo '*io' > set_ftrace_filter
    # cat set_ftrace_filter | grep 'req_bio_endio'
    # cat available_filter_functions | grep 'req_bio_endio'
    req_bio_endio

    Signed-off-by: Li Zefan
    LKML-Reference:
    Acked-by: Frederic Weisbecker
    Signed-off-by: Steven Rostedt

    Li Zefan
     

14 Dec, 2009

3 commits

  • # echo 'do_open' > set_graph_function
    # echo 'do_open' >> set_graph_function
    bash: echo: write error: Invalid argument

    Make it valid to write the same value to set_graph_function,
    which is consistent with set_ftrace_filter interface.

    Signed-off-by: Li Zefan
    Acked-by: Steven Rostedt
    LKML-reference:
    Signed-off-by: Frederic Weisbecker

    Li Zefan
     
  • I found a weird behavior:

    # echo 'fuse:*' > set_ftrace_filter
    bash: echo: write error: Invalid argument
    # cat set_ftrace_filter
    fuse_dev_fasync
    fuse_dev_poll
    fuse_copy_do

    We should call trace_parser_clear() no matter ftrace_process_regex()
    returns 0 or -errno, otherwise we will actually take the unaccepted
    records from ftrace_regex_release().

    Signed-off-by: Li Zefan
    Acked-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Li Zefan
     
  • Currently it doesn't warn user on invald value:

    # echo nonexist_symbol > set_ftrace_filter
    or:
    # echo 'nonexist_symbol:mod:fuse' > set_ftrace_filter

    Better make it return failure.

    Signed-off-by: Li Zefan
    Acked-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Frederic Weisbecker

    Li Zefan
     

06 Dec, 2009

1 commit

  • …el/git/tip/linux-2.6-tip

    * 'tracing-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (40 commits)
    tracing: Separate raw syscall from syscall tracer
    ring-buffer-benchmark: Add parameters to set produce/consumer priorities
    tracing, function tracer: Clean up strstrip() usage
    ring-buffer benchmark: Run producer/consumer threads at nice +19
    tracing: Remove the stale include/trace/power.h
    tracing: Only print objcopy version warning once from recordmcount
    tracing: Prevent build warning: 'ftrace_graph_buf' defined but not used
    ring-buffer: Move access to commit_page up into function used
    tracing: do not disable interrupts for trace_clock_local
    ring-buffer: Add multiple iterations between benchmark timestamps
    kprobes: Sanitize struct kretprobe_instance allocations
    tracing: Fix to use __always_unused attribute
    compiler: Introduce __always_unused
    tracing: Exit with error if a weak function is used in recordmcount.pl
    tracing: Move conditional into update_funcs() in recordmcount.pl
    tracing: Add regex for weak functions in recordmcount.pl
    tracing: Move mcount section search to front of loop in recordmcount.pl
    tracing: Fix objcopy revision check in recordmcount.pl
    tracing: Check absolute path of input file in recordmcount.pl
    tracing: Correct the check for number of arguments in recordmcount.pl
    ...

    Linus Torvalds
     

23 Nov, 2009

1 commit

  • Clean up strstrip() usage - which also addresses this build warning:

    kernel/trace/ftrace.c: In function 'ftrace_pid_write':
    kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result

    Cc: Steven Rostedt
    Cc: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

18 Nov, 2009

1 commit


04 Nov, 2009

1 commit

  • When a command is passed to the set_ftrace_filter, then
    the ftrace_regex_lock is still held going back to user space.

    # echo 'do_open : foo' > set_ftrace_filter
    (still holding ftrace_regex_lock when returning to user space!)

    Signed-off-by: Li Zefan
    LKML-Reference:
    Signed-off-by: Steven Rostedt

    Li Zefan
     

29 Oct, 2009

1 commit


24 Oct, 2009

1 commit

  • Instead of directly updating filp->f_pos we should update the *ppos
    argument. The filp->f_pos gets updated within the file_pos_write()
    function called from sys_write().

    Signed-off-by: Jiri Olsa
    Signed-off-by: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Jiri Olsa
     

15 Oct, 2009

1 commit

  • We are using strncpy in the wrong way to copy the ftrace_graph_filter
    boot param because we pass the buffer size instead of the max string
    size it can contain (buffer size - 1). The end result might not be
    NULL terminated as we are abusing the max string size.

    Lets use strlcpy() instead.

    Reported-by: Li Zefan
    Signed-off-by: Frederic Weisbecker
    Cc: Steven Rostedt

    Frederic Weisbecker
     

14 Oct, 2009

2 commits

  • I was debuging some module using "function" and "function_graph"
    tracers and noticed, that if you load module after you enabled
    tracing, the module's hooks will convert only to NOP instructions.

    The attached patch enables modules' hooks if there's function trace
    allready on, thus allowing to trace module functions.

    Signed-off-by: Jiri Olsa
    Cc: Frederic Weisbecker
    Signed-off-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Jiri Olsa
     
  • Adding the possibility to set more than 1 pid in the set_pid_ftrace
    file, thus allowing to trace more than 1 independent processes.

    Usage:

    sh-4.0# echo 284 > ./set_ftrace_pid
    sh-4.0# cat ./set_ftrace_pid
    284
    sh-4.0# echo 1 >> ./set_ftrace_pid
    sh-4.0# echo 0 >> ./set_ftrace_pid
    sh-4.0# cat ./set_ftrace_pid
    swapper tasks
    1
    284
    sh-4.0# echo 4 > ./set_ftrace_pid
    sh-4.0# cat ./set_ftrace_pid
    4
    sh-4.0# echo > ./set_ftrace_pid
    sh-4.0# cat ./set_ftrace_pid
    no pid
    sh-4.0#

    Signed-off-by: Jiri Olsa
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    jolsa@redhat.com
     

13 Oct, 2009

3 commits


09 Oct, 2009

1 commit

  • …nel/git/tip/linux-2.6-tip

    * 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    tracing: user local buffer variable for trace branch tracer
    tracing: fix warning on kernel/trace/trace_branch.c andtrace_hw_branches.c
    ftrace: check for failure for all conversions
    tracing: correct module boundaries for ftrace_release
    tracing: fix transposed numbers of lock_depth and preempt_count
    trace: Fix missing assignment in trace_ctxwake_*
    tracing: Use free_percpu instead of kfree
    tracing: Check total refcount before releasing bufs in profile_enable failure

    Linus Torvalds
     

08 Oct, 2009

2 commits

  • Due to legacy code from back when the dynamic tracer used a daemon,
    only core kernel code was checking for failures. This is no longer
    the case. We must check for failures any time we perform text modifications.

    Cc: stable@kernel.org
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • When the module is about the unload we release its call records.
    The ftrace_release function was given wrong values representing
    the module core boundaries, thus not releasing its call records.

    Plus making ftrace_release function module specific.

    Signed-off-by: Jiri Olsa
    LKML-Reference:
    Cc: stable@kernel.org
    Signed-off-by: Steven Rostedt

    jolsa@redhat.com
     

01 Oct, 2009

2 commits

  • Merge reason: Pick up latest fixes and update to latest upstream.

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • When CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST is enabled
    __ftrace_trace_function contains the current trace function, not
    ftrace_trace_function.

    In ftrace_update_pid_func() we currently incorrectly assign the
    value of ftrace_trace_function to __ftrace_trace_funcion before
    returning.

    Without this patch it is possible to execute an infinite recursion
    whereby ftrace_test_stop_func() calls __ftrace_trace_function,
    which was assigned ftrace_test_stop_func() in
    ftrace_update_pid_func().

    Signed-off-by: Matt Fleming
    Acked-by: Steven Rostedt
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Matt Fleming
     

27 Sep, 2009

1 commit

  • …nel/git/tip/linux-2.6-tip

    * 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    modules, tracing: Remove stale struct marker signature from module_layout()
    tracing/workqueue: Use %pf in workqueue trace events
    tracing: Fix a comment and a trivial format issue in tracepoint.h
    tracing: Fix failure path in ftrace_regex_open()
    tracing: Fix failure path in ftrace_graph_write()
    tracing: Check the return value of trace_get_user()
    tracing: Fix off-by-one in trace_get_user()

    Linus Torvalds
     

25 Sep, 2009

1 commit

  • The filter code has stolen the regex parsing function from ftrace to
    get the regex support.
    We have duplicated this code, so factorize it in the filter area and
    make it generally available, as the filter code is the most suited to
    host this feature.

    Signed-off-by: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Tom Zanussi
    Cc: Li Zefan

    Frederic Weisbecker
     

24 Sep, 2009

1 commit

  • It's unused.

    It isn't needed -- read or write flag is already passed and sysctl
    shouldn't care about the rest.

    It _was_ used in two places at arch/frv for some reason.

    Signed-off-by: Alexey Dobriyan
    Cc: David Howells
    Cc: "Eric W. Biederman"
    Cc: Al Viro
    Cc: Ralf Baechle
    Cc: Martin Schwidefsky
    Cc: Ingo Molnar
    Cc: "David S. Miller"
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

23 Sep, 2009

1 commit

  • Make all seq_operations structs const, to help mitigate against
    revectoring user-triggerable function pointers.

    This is derived from the grsecurity patch, although generated from scratch
    because it's simpler than extracting the changes from there.

    Signed-off-by: James Morris
    Acked-by: Serge Hallyn
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Morris
     

22 Sep, 2009

3 commits


19 Sep, 2009

1 commit