27 Jan, 2010

1 commit

  • Lockdep has found the real bug, but the output doesn't look right to me:

    > =========================================================
    > [ INFO: possible irq lock inversion dependency detected ]
    > 2.6.33-rc5 #77
    > ---------------------------------------------------------
    > emacs/1609 just changed the state of lock:
    > (&(&tty->ctrl_lock)->rlock){+.....}, at: [] tty_fasync+0xe8/0x190
    > but this lock took another, HARDIRQ-unsafe lock in the past:
    > (&(&sighand->siglock)->rlock){-.....}

    "HARDIRQ-unsafe" and "this lock took another" looks wrong, afaics.

    > ... key at: [] __key.46539+0x0/0x8
    > ... acquired at:
    > [] __lock_acquire+0x1056/0x15a0
    > [] lock_acquire+0x9f/0x120
    > [] _raw_spin_lock_irqsave+0x52/0x90
    > [] __proc_set_tty+0x3e/0x150
    > [] tty_open+0x51d/0x5e0

    The stack-trace shows that this lock (ctrl_lock) was taken under
    ->siglock (which is hopefully irq-safe).

    This is a clear typo in check_usage_backwards() where we tell the print a
    fancy routine we're forwards.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     

15 Dec, 2009

4 commits

  • Name space cleanup. No functional change.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org

    Thomas Gleixner
     
  • Further name space cleanup. No functional change

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org

    Thomas Gleixner
     
  • The raw_spin* namespace was taken by lockdep for the architecture
    specific implementations. raw_spin_* would be the ideal name space for
    the spinlocks which are not converted to sleeping locks in preempt-rt.

    Linus suggested to convert the raw_ to arch_ locks and cleanup the
    name space instead of using an artifical name like core_spin,
    atomic_spin or whatever

    No functional change.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org

    Thomas Gleixner
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (34 commits)
    m68k: rename global variable vmalloc_end to m68k_vmalloc_end
    percpu: add missing per_cpu_ptr_to_phys() definition for UP
    percpu: Fix kdump failure if booted with percpu_alloc=page
    percpu: make misc percpu symbols unique
    percpu: make percpu symbols in ia64 unique
    percpu: make percpu symbols in powerpc unique
    percpu: make percpu symbols in x86 unique
    percpu: make percpu symbols in xen unique
    percpu: make percpu symbols in cpufreq unique
    percpu: make percpu symbols in oprofile unique
    percpu: make percpu symbols in tracer unique
    percpu: make percpu symbols under kernel/ and mm/ unique
    percpu: remove some sparse warnings
    percpu: make alloc_percpu() handle array types
    vmalloc: fix use of non-existent percpu variable in put_cpu_var()
    this_cpu: Use this_cpu_xx in trace_functions_graph.c
    this_cpu: Use this_cpu_xx for ftrace
    this_cpu: Use this_cpu_xx in nmi handling
    this_cpu: Use this_cpu operations in RCU
    this_cpu: Use this_cpu ops for VM statistics
    ...

    Fix up trivial (famous last words) global per-cpu naming conflicts in
    arch/x86/kvm/svm.c
    mm/slab.c

    Linus Torvalds
     

10 Dec, 2009

1 commit

  • ia64 found this the hard way (because we currently have a stub
    for save_stack_trace() that does nothing). But it would be a
    good idea to be cautious in case a real save_stack_trace()
    bailed out with an error before it set trace->nr_entries.

    Signed-off-by: Tony Luck
    Acked-by: Peter Zijlstra
    Cc: luming.yu@intel.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Luck, Tony
     

06 Dec, 2009

1 commit

  • Fix min, max times in /proc/lock_stats

    (1) When collecting lock hold and wait times, if the current minimum
    time is zero, it will be replaced by the next time.

    (2) When aggregating minimum and maximum lock hold and wait times
    accross cpus, the values are added, instead of selecting the
    minimum and maximum.

    Signed-off-by: Frank Rowand
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frank Rowand
     

13 Nov, 2009

1 commit

  • Lockdep events subsystem gathers various locking related events
    such as a request, release, contention or acquisition of a lock.

    The name of this event subsystem is a bit of a misnomer since
    these events are not quite related to lockdep but more generally
    to locking, ie: these events are not reporting lock dependencies
    or possible deadlock scenario but pure locking events.

    Hence this rename.

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

    Frederic Weisbecker
     

29 Oct, 2009

1 commit

  • This patch updates percpu related symbols under kernel/ and mm/ such
    that percpu symbols are unique and don't clash with local symbols.
    This serves two purposes of decreasing the possibility of global
    percpu symbol collision and allowing dropping per_cpu__ prefix from
    percpu symbols.

    * kernel/lockdep.c: s/lock_stats/cpu_lock_stats/

    * kernel/sched.c: s/init_rq_rt/init_rt_rq_var/ (any better idea?)
    s/sched_group_cpus/sched_groups/

    * kernel/softirq.c: s/ksoftirqd/run_ksoftirqd/a

    * kernel/softlockup.c: s/(*)_timestamp/softlockup_\1_ts/
    s/watchdog_task/softlockup_watchdog/
    s/timestamp/ts/ for local variables

    * kernel/time/timer_stats: s/lookup_lock/tstats_lookup_lock/

    * mm/slab.c: s/reap_work/slab_reap_work/
    s/reap_node/slab_reap_node/

    * mm/vmstat.c: local variable changed to avoid collision with vmstat_work

    Partly based on Rusty Russell's "alloc_percpu: rename percpu vars
    which cause name clashes" patch.

    Signed-off-by: Tejun Heo
    Acked-by: (slab/vmstat) Christoph Lameter
    Reviewed-by: Christoph Lameter
    Cc: Rusty Russell
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Andrew Morton
    Cc: Nick Piggin

    Tejun Heo
     

09 Oct, 2009

1 commit

  • Some tracepoint magic (TRACE_EVENT(lock_acquired)) relies on
    the fact that lock hold times are positive and uses div64 on
    that. That triggered a build warning on MIPS, and probably
    causes bad output in certain circumstances as well.

    Make it truly positive.

    Reported-by: Andrew Morton
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

23 Sep, 2009

1 commit

  • This allows lockdep to locate symbols that are in arch-specific data
    sections (such as data in Blackfin on-chip SRAM regions).

    Signed-off-by: Mike Frysinger
    Cc: Ingo Molnar
    Cc: Robin Getz
    Cc: Sam Ravnborg
    Cc: Peter Zijlstra
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

29 Aug, 2009

1 commit

  • Since lockdep has introduced BFS to avoid recursion, statistics
    for recursion does not make any sense now. So remove them.

    Signed-off-by: Ming Lei
    Cc: a.p.zijlstra@chello.nl
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     

02 Aug, 2009

6 commits

  • The unit is KB, so sizeof(struct circular_queue) should be
    divided by 1024.

    Signed-off-by: Ming Lei
    Cc: akpm@linux-foundation.org
    Cc: torvalds@linux-foundation.org
    Cc: davem@davemloft.net
    Cc: Ming Lei
    Cc: a.p.zijlstra@chello.nl
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • We still can apply DaveM's generation count optimization to
    BFS, based on the following idea:

    - before doing each BFS, increase the global generation id
    by 1

    - if one node in the graph has been visited, mark it as
    visited by storing the current global generation id into
    the node's dep_gen_id field

    - so we can decide if one node has been visited already, by
    comparing the node's dep_gen_id with the global generation id.

    By applying DaveM's generation count optimization to current
    implementation of BFS, we gain the following advantages:

    - we save MAX_LOCKDEP_ENTRIES/8 bytes memory;

    - we remove the bitmap_zero(bfs_accessed, MAX_LOCKDEP_ENTRIES);
    in each BFS, which is very time-consuming since
    MAX_LOCKDEP_ENTRIES may be very large.(16384UL)

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    Cc: "David S. Miller"
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • spin_lock_nest_lock() allows to take many instances of the same
    class, this can easily lead to overflow of MAX_LOCK_DEPTH.

    To avoid this overflow, we'll stop accounting instances but
    start reference counting the class in the held_lock structure.

    [ We could maintain a list of instances, if we'd move the hlock
    stuff into __lock_acquired(), but that would require
    significant modifications to the current code. ]

    We restrict this mode to spin_lock_nest_lock() only, because it
    degrades the lockdep quality due to lost of instance.

    For lockstat this means we don't track lock statistics for any
    but the first lock in the series.

    Currently nesting is limited to 11 bits because that was the
    spare space available in held_lock. This yields a 2048
    instances maximium.

    Signed-off-by: Peter Zijlstra
    Cc: Marcelo Tosatti
    Cc: Linus Torvalds
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Add a lockdep helper to validate that we indeed are the owner
    of a lock.

    Signed-off-by: Peter Zijlstra
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • fixes a few comments and whitespaces that annoyed me.

    Signed-off-by: Peter Zijlstra
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Truncate stupid -1 entries in backtraces.

    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

24 Jul, 2009

10 commits

  • Some cleanups of the lockdep code after the BFS series:

    - Remove the last traces of the generation id
    - Fixup comment style
    - Move the bfs routines into lockdep.c
    - Cleanup the bfs routines

    [ tom.leiming@gmail.com: Fix crash ]
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Add BFS statistics to the existing lockdep stats.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • Also account the BFS memory usage.

    Signed-off-by: Ming Lei
    [ fix build for !PROVE_LOCKING ]
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • Implement lockdep_count_{for,back}ward using BFS.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • Since the shortest lock dependencies' path may be obtained by BFS,
    we print the shortest one by print_shortest_lock_dependencies().

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • This patch uses BFS to implement find_usage_*wards(),which
    was originally writen by DFS.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • This patch uses BFS to implement check_noncircular() and
    prints the generated shortest circle if exists.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • 1,introduce match() to BFS in order to make it usable to
    match different pattern;

    2,also rename some functions to make them more suitable.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • 1,replace %MAX_CIRCULAR_QUE_SIZE with &(MAX_CIRCULAR_QUE_SIZE-1)
    since we define MAX_CIRCULAR_QUE_SIZE as power of 2;

    2,use bitmap to mark if a lock is accessed in BFS in order to
    clear it quickly, because we may search a graph many times.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     
  • Currently lockdep will print the 1st circle detected if it
    exists when acquiring a new (next) lock.

    This patch prints the shortest path from the next lock to be
    acquired to the previous held lock if a circle is found.

    The patch still uses the current method to check circle, and
    once the circle is found, breadth-first search algorithem is
    used to compute the shortest path from the next lock to the
    previous lock in the forward lock dependency graph.

    Printing the shortest path will shorten the dependency chain,
    and make troubleshooting for possible circular locking easier.

    Signed-off-by: Ming Lei
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ming Lei
     

07 May, 2009

1 commit


18 Apr, 2009

1 commit

  • Steven Rostedt reported:

    > OK, I think I figured this bug out. This is a lockdep issue with respect
    > to tracepoints.
    >
    > The trace points in lockdep are called all the time. Outside the lockdep
    > logic. But if lockdep were to trigger an error / warning (which this run
    > did) we might be in trouble. For new locks, like the dentry->d_lock, that
    > are created, they will not get a name:
    >
    > void lockdep_init_map(struct lockdep_map *lock, const char *name,
    > struct lock_class_key *key, int subclass)
    > {
    > if (unlikely(!debug_locks))
    > return;
    >
    > When a problem is found by lockdep, debug_locks becomes false. Thus we
    > stop allocating names for locks. This dentry->d_lock I had, now has no
    > name. Worse yet, I have CONFIG_DEBUG_VM set, that scrambles non
    > initialized memory. Thus, when the trace point was hit, it had junk for
    > the lock->name, and the machine crashed.

    Ah, nice catch. I think we should put at least the name in regardless.

    Ensure we at least initialize the trivial entries of the depmap so that
    they can be relied upon, even when lockdep itself decided to pack up and
    go home.

    [ Impact: fix lock tracing after lockdep warnings. ]

    Reported-by: Steven Rostedt
    Signed-off-by: Peter Zijlstra
    Acked-by: Steven Rostedt
    Cc: Andrew Morton
    Cc: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

15 Apr, 2009

2 commits

  • 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
    Cc: Thomas Gleixner
    Cc: Neil Horman
    Cc: Zhao Lei
    Cc: Eduard - Gabriel Munteanu
    Cc: Pekka Enberg
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • 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/.h
    file, but the one C file must also add a define before the including
    of that file.

    #define CREATE_TRACE_POINTS
    #include

    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/.h is used to create the C code
    it is best to list them all together.

    #define CREATE_TRACE_POINTS
    #include
    #include
    #include

    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
    method.

    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Neil Horman
    Cc: Zhao Lei
    Cc: Eduard - Gabriel Munteanu
    Cc: Pekka Enberg
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

10 Apr, 2009

1 commit

  • While trying to optimize the new lock on reiserfs to replace
    the bkl, I find the lock tracing very useful though it lacks
    something important for performance (and latency) instrumentation:
    the time a task waits for a lock.

    That's what this patch implements:

    bash-4816 [000] 202.652815: lock_contended: lock_contended: &sb->s_type->i_mutex_key
    bash-4816 [000] 202.652819: lock_acquired: &rq->lock (0.000 us)
    -4787 [000] 202.652825: lock_acquired: &rq->lock (0.000 us)
    -4787 [000] 202.652829: lock_acquired: &rq->lock (0.000 us)
    bash-4816 [000] 202.652833: lock_acquired: &sb->s_type->i_mutex_key (16.005 us)

    As shown above, the "lock acquired" field is followed by the time
    it has been waiting for the lock. Usually, a lock contended entry
    is followed by a near lock_acquired entry with a non-zero time waited.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Peter Zijlstra
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

07 Apr, 2009

1 commit


02 Apr, 2009

1 commit


31 Mar, 2009

3 commits


13 Mar, 2009

1 commit


05 Mar, 2009

1 commit