15 Dec, 2009

2 commits

  • kernel_lock.c emits a warning because a raw spinlock function is used
    with a spinlock. Convert BKL to raw_spinlock.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: Ingo Molnar

    Thomas Gleixner
     
  • The name space hierarchy for the internal lock functions is now a bit
    backwards. raw_spin* functions map to _spin* which use __spin*, while
    we would like to have _raw_spin* and __raw_spin*.

    _raw_spin* is already used by lock debugging, so rename those funtions
    to do_raw_spin* to free up the _raw_spin* name space.

    No functional change.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: Ingo Molnar

    Thomas Gleixner
     

13 Dec, 2009

1 commit

  • As shown by the previous patch (6698e3472: "tty: Fix BKL taken under a
    spinlock bug introduced in the BKL split") the BKL removal is prone to
    some subtle issues, where removing the BKL in one place may in fact make
    a previously nested BKL call the new outer call, and then prone to nasty
    deadlocks with other spinlocks.

    In general, we should never take the BKL while we're holding a spinlock,
    so let's just add a "might_sleep()" to it (even though the BKL doesn't
    technically sleep - at least not yet), and we'll get nice warnings the
    next time this kind of problem happens during BKL removal.

    Acked-and-Tested-by: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

29 Sep, 2009

1 commit

  • Currently we are calling the bkl tracepoint callbacks just before the
    bkl lock/unlock operations, ie the tracepoint call is not inside a
    lock_kernel() function but inside a lock_kernel() macro. Hence the
    bkl trace event header must be included from smp_lock.h. This raises
    some nasty circular header dependencies:

    linux/smp_lock.h -> trace/events/bkl.h -> trace/define_trace.h
    -> trace/ftrace.h -> linux/ftrace_event.h -> linux/hardirq.h
    -> linux/smp_lock.h

    This results in incomplete event declarations, spurious event
    definitions and other kind of funny behaviours.

    This is hardly fixable without ugly workarounds. So instead, we push
    the file name, line number and function name as lock_kernel()
    parameters, so that we only deal with the trace event header from
    lib/kernel_lock.c

    This adds two parameters to lock_kernel() and unlock_kernel() but
    it should be fine wrt to performances because this pair dos not seem
    to be called in fast paths.

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

    Frederic Weisbecker
     

24 Sep, 2009

1 commit

  • Add two events lock_kernel and unlock_kernel() to trace the bkl uses.
    This opens the door for userspace tools to perform statistics about
    the callsites that use it, dependencies with other locks (by pairing
    the trace with lock events), use with recursivity and so on...

    The {__reacquire,release}_kernel_lock() events are not traced because
    these are called from schedule, thus the sched events are sufficient
    to trace them.

    Example of a trace:

    hald-addon-stor-4152 [000] 165.875501: unlock_kernel: depth: 0, fs/block_dev.c:1358 __blkdev_put()
    hald-addon-stor-4152 [000] 167.832974: lock_kernel: depth: 0, fs/block_dev.c:1167 __blkdev_get()

    How to get the callsites that acquire it recursively:

    cd /debug/tracing/events/bkl
    echo "lock_depth > 0" > filter

    firefox-4951 [001] 206.276967: unlock_kernel: depth: 1, fs/reiserfs/super.c:575 reiserfs_dirty_inode()

    You can also filter by file and/or line.

    v2: Use of FILTER_PTR_STRING attribute for files and lines fields to
    make them traceable.

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

    Frederic Weisbecker
     

06 Mar, 2009

1 commit


11 May, 2008

1 commit

  • The generic semaphore rewrite had a huge performance regression on AIM7
    (and potentially other BKL-heavy benchmarks) because the generic
    semaphores had been rewritten to be simple to understand and fair. The
    latter, in particular, turns a semaphore-based BKL implementation into a
    mess of scheduling.

    The attempt to fix the performance regression failed miserably (see the
    previous commit 00b41ec2611dc98f87f30753ee00a53db648d662 'Revert
    "semaphore: fix"'), and so for now the simple and sane approach is to
    instead just go back to the old spinlock-based BKL implementation that
    never had any issues like this.

    This patch also has the advantage of being reported to fix the
    regression completely according to Yanmin Zhang, unlike the semaphore
    hack which still left a couple percentage point regression.

    As a spinlock, the BKL obviously has the potential to be a latency
    issue, but it's not really any different from any other spinlock in that
    respect. We do want to get rid of the BKL asap, but that has been the
    plan for several years.

    These days, the biggest users are in the tty layer (open/release in
    particular) and Alan holds out some hope:

    "tty release is probably a few months away from getting cured - I'm
    afraid it will almost certainly be the very last user of the BKL in
    tty to get fixed as it depends on everything else being sanely locked."

    so while we're not there yet, we do have a plan of action.

    Tested-by: Yanmin Zhang
    Cc: Ingo Molnar
    Cc: Andi Kleen
    Cc: Matthew Wilcox
    Cc: Alexander Viro
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

19 Apr, 2008

1 commit


17 Apr, 2008

1 commit


26 Jan, 2008

1 commit


20 Oct, 2007

1 commit


04 Jul, 2006

1 commit


27 Jun, 2006

1 commit

  • acquired (aquired)
    contiguous (contigious)
    successful (succesful, succesfull)
    surprise (suprise)
    whether (weather)
    some other misspellings

    Signed-off-by: Andreas Mohr
    Signed-off-by: Adrian Bunk

    Andreas Mohr
     

11 Sep, 2005

1 commit

  • This patch (written by me and also containing many suggestions of Arjan van
    de Ven) does a major cleanup of the spinlock code. It does the following
    things:

    - consolidates and enhances the spinlock/rwlock debugging code

    - simplifies the asm/spinlock.h files

    - encapsulates the raw spinlock type and moves generic spinlock
    features (such as ->break_lock) into the generic code.

    - cleans up the spinlock code hierarchy to get rid of the spaghetti.

    Most notably there's now only a single variant of the debugging code,
    located in lib/spinlock_debug.c. (previously we had one SMP debugging
    variant per architecture, plus a separate generic one for UP builds)

    Also, i've enhanced the rwlock debugging facility, it will now track
    write-owners. There is new spinlock-owner/CPU-tracking on SMP builds too.
    All locks have lockup detection now, which will work for both soft and hard
    spin/rwlock lockups.

    The arch-level include files now only contain the minimally necessary
    subset of the spinlock code - all the rest that can be generalized now
    lives in the generic headers:

    include/asm-i386/spinlock_types.h | 16
    include/asm-x86_64/spinlock_types.h | 16

    I have also split up the various spinlock variants into separate files,
    making it easier to see which does what. The new layout is:

    SMP | UP
    ----------------------------|-----------------------------------
    asm/spinlock_types_smp.h | linux/spinlock_types_up.h
    linux/spinlock_types.h | linux/spinlock_types.h
    asm/spinlock_smp.h | linux/spinlock_up.h
    linux/spinlock_api_smp.h | linux/spinlock_api_up.h
    linux/spinlock.h | linux/spinlock.h

    /*
    * here's the role of the various spinlock/rwlock related include files:
    *
    * on SMP builds:
    *
    * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
    * initializers
    *
    * linux/spinlock_types.h:
    * defines the generic type and initializers
    *
    * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel
    * implementations, mostly inline assembly code
    *
    * (also included on UP-debug builds:)
    *
    * linux/spinlock_api_smp.h:
    * contains the prototypes for the _spin_*() APIs.
    *
    * linux/spinlock.h: builds the final spin_*() APIs.
    *
    * on UP builds:
    *
    * linux/spinlock_type_up.h:
    * contains the generic, simplified UP spinlock type.
    * (which is an empty structure on non-debug builds)
    *
    * linux/spinlock_types.h:
    * defines the generic type and initializers
    *
    * linux/spinlock_up.h:
    * contains the __raw_spin_*()/etc. version of UP
    * builds. (which are NOPs on non-debug, non-preempt
    * builds)
    *
    * (included on UP-non-debug builds:)
    *
    * linux/spinlock_api_up.h:
    * builds the _spin_*() APIs.
    *
    * linux/spinlock.h: builds the final spin_*() APIs.
    */

    All SMP and UP architectures are converted by this patch.

    arm, i386, ia64, ppc, ppc64, s390/s390x, x64 was build-tested via
    crosscompilers. m32r, mips, sh, sparc, have not been tested yet, but should
    be mostly fine.

    From: Grant Grundler

    Booted and lightly tested on a500-44 (64-bit, SMP kernel, dual CPU).
    Builds 32-bit SMP kernel (not booted or tested). I did not try to build
    non-SMP kernels. That should be trivial to fix up later if necessary.

    I converted bit ops atomic_hash lock to raw_spinlock_t. Doing so avoids
    some ugly nesting of linux/*.h and asm/*.h files. Those particular locks
    are well tested and contained entirely inside arch specific code. I do NOT
    expect any new issues to arise with them.

    If someone does ever need to use debug/metrics with them, then they will
    need to unravel this hairball between spinlocks, atomic ops, and bit ops
    that exist only because parisc has exactly one atomic instruction: LDCW
    (load and clear word).

    From: "Luck, Tony"

    ia64 fix

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Grant Grundler
    Cc: Matthew Wilcox
    Signed-off-by: Hirokazu Takata
    Signed-off-by: Mikael Pettersson
    Signed-off-by: Benoit Boissinot
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

22 Jun, 2005

1 commit

  • This patch implements a number of smp_processor_id() cleanup ideas that
    Arjan van de Ven and I came up with.

    The previous __smp_processor_id/_smp_processor_id/smp_processor_id API
    spaghetti was hard to follow both on the implementational and on the
    usage side.

    Some of the complexity arose from picking wrong names, some of the
    complexity comes from the fact that not all architectures defined
    __smp_processor_id.

    In the new code, there are two externally visible symbols:

    - smp_processor_id(): debug variant.

    - raw_smp_processor_id(): nondebug variant. Replaces all existing
    uses of _smp_processor_id() and __smp_processor_id(). Defined
    by every SMP architecture in include/asm-*/smp.h.

    There is one new internal symbol, dependent on DEBUG_PREEMPT:

    - debug_smp_processor_id(): internal debug variant, mapped to
    smp_processor_id().

    Also, i moved debug_smp_processor_id() from lib/kernel_lock.c into a new
    lib/smp_processor_id.c file. All related comments got updated and/or
    clarified.

    I have build/boot tested the following 8 .config combinations on x86:

    {SMP,UP} x {PREEMPT,!PREEMPT} x {DEBUG_PREEMPT,!DEBUG_PREEMPT}

    I have also build/boot tested x64 on UP/PREEMPT/DEBUG_PREEMPT. (Other
    architectures are untested, but should work just fine.)

    Signed-off-by: Ingo Molnar
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds