1. 23 10月, 2010 17 次提交
    • J
      debug_core: refactor locking for master/slave cpus · dfee3a7b
      Jason Wessel 提交于
      For quite some time there have been problems with memory barriers and
      various races with NMI on multi processor systems using the kernel
      debugger.  The algorithm for entering the kernel debug core and
      resuming kernel execution was racy and had several known edge case
      problems with attempting to debug something on a heavily loaded system
      using breakpoints that are hit repeatedly and quickly.
      
      The prior "locking" design entry worked as follows:
      
        * The atomic counter kgdb_active was used with atomic exchange in
          order to elect a master cpu out of all the cpus that may have
          taken a debug exception.
        * The master cpu increments all elements of passive_cpu_wait[].
        * The master cpu issues the round up cpus message.
        * Each "slave cpu" that enters the debug core increments its own
          element in cpu_in_kgdb[].
        * Each "slave cpu" spins on passive_cpu_wait[] until it becomes 0.
        * The master cpu debugs the system.
      
      The new scheme removes the two arrays of atomic counters and replaces
      them with 2 single counters.  One counter is used to count the number
      of cpus waiting to become a master cpu (because one or more hit an
      exception). The second counter is use to indicate how many cpus have
      entered as slave cpus.
      
      The new entry logic works as follows:
      
        * One or more cpus enters via kgdb_handle_exception() and increments
          the masters_in_kgdb. Each cpu attempts to get the spin lock called
          dbg_master_lock.
        * The master cpu sets kgdb_active to the current cpu.
        * The master cpu takes the spinlock dbg_slave_lock.
        * The master cpu asks to round up all the other cpus.
        * Each slave cpu that is not already in kgdb_handle_exception()
          will enter and increment slaves_in_kgdb.  Each slave will now spin
          try_locking on dbg_slave_lock.
        * The master cpu waits for the sum of masters_in_kgdb and slaves_in_kgdb
          to be equal to the sum of the online cpus.
        * The master cpu debugs the system.
      
      In the new design the kgdb_active can only be changed while holding
      dbg_master_lock.  Stress testing has not turned up any further
      entry/exit races that existed in the prior locking design.  The prior
      locking design suffered from atomic variables not being truly atomic
      (in the capacity as used by kgdb) along with memory barrier races.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Acked-by: NDongdong Deng <dongdong.deng@windriver.com>
      dfee3a7b
    • D
      x86,kgdb: remove unnecessary call to kgdb_correct_hw_break() · 39a0715f
      Dongdong Deng 提交于
      The kernel debug_core invokes hw breakpoint install and removal via
      call backs.  The architecture specific kgdb stubs only need to
      implement the call backs and not actually call the functions.
      Signed-off-by: NDongdong Deng <dongdong.deng@windriver.com>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      CC: x86@kernel.org
      CC: Thomas Gleixner <tglx@linutronix.de>
      CC: Ingo Molnar <mingo@redhat.com>
      CC: H. Peter Anvin <hpa@zytor.com>
      39a0715f
    • D
      debug_core: disable hw_breakpoints on all cores in kgdb_cpu_enter() · c1bb9a9c
      Dongdong Deng 提交于
      The slave cpus do not have the hw breakpoints disabled upon entry to
      the debug_core and as a result could cause unrecoverable recursive
      faults on badly placed breakpoints, or get out of sync with the arch
      specific hw breakpoint operations.
      
      This patch addresses the problem by invoking kgdb_disable_hw_debug()
      earlier in kgdb_enter_cpu for each cpu that enters the debug core.
      
      The hw breakpoint dis/enable flow should be:
      
      master_debug_cpu   slave_debug_cpu
               \              /
                kgdb_cpu_enter
                      |
              kgdb_disable_hw_debug --> uninstall pre-enabled hw_breakpoint
                      |
       do add/rm dis/enable operates to hw_breakpoints on master_debug_cpu..
                      |
              correct_hw_break --> correct/install the enabled hw_breakpoint
                      |
                 leave_kgdb
      Signed-off-by: NDongdong Deng <dongdong.deng@windriver.com>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      c1bb9a9c
    • J
      kdb,kgdb: fix sparse fixups · 91b152aa
      Jason Wessel 提交于
      Fix the following sparse warnings:
      
      kdb_main.c:328:5: warning: symbol 'kdbgetu64arg' was not declared. Should it be static?
      kgdboc.c:246:12: warning: symbol 'kgdboc_early_init' was not declared. Should it be static?
      kgdb.c:652:26: warning: incorrect type in argument 1 (different address spaces)
      kgdb.c:652:26:    expected void const *ptr
      kgdb.c:652:26:    got struct perf_event *[noderef] <asn:3>*pev
      
      The one in kgdb.c required the (void * __force) because of the return
      code from register_wide_hw_breakpoint looking like:
      
              return (void __percpu __force *)ERR_PTR(err);
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      91b152aa
    • J
      kdb: Fix oops in kdb_unregister · 75d14ede
      Jason Wessel 提交于
      Nothing should try to use kdb_commands directly as sometimes it is
      null.  Instead, use the for_each_kdbcmd() iterator.
      
      This particular problem dates back to the initial kdb merge (2.6.35),
      but at that point nothing was dynamically unregistering commands from
      the kdb shell.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      75d14ede
    • J
      kdb,ftdump: Remove reference to internal kdb include · e3bda3ac
      Jason Wessel 提交于
      Now that include/linux/kdb.h properly exports all the functions
      required to dynamically add a kdb shell command, the reference to the
      private kdb header can be removed.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      e3bda3ac
    • J
      kdb: Allow kernel loadable modules to add kdb shell functions · f7030bbc
      Jason Wessel 提交于
      In order to allow kernel modules to dynamically add a command to the
      kdb shell the kdb_register, kdb_register_repeat, kdb_unregister, and
      kdb_printf need to be exported as GPL symbols.
      
      Any kernel module that adds a dynamic kdb shell function should only
      need to include linux/kdb.h.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      f7030bbc
    • J
      debug_core: stop rcu warnings on kernel resume · fb70b588
      Jason Wessel 提交于
      When returning from the kernel debugger reset the rcu jiffies_stall
      value to prevent the rcu stall detector from sending NMI events which
      invoke a stack dump for each cpu in the system.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      fb70b588
    • J
      debug_core: move all watch dog syncs to a single function · 16cdc628
      Jason Wessel 提交于
      Move the various clock and watch dog syncs to a single function in
      advance of adding another sync for the rcu stall detector.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      16cdc628
    • J
      x86,kgdb: fix debugger hw breakpoint test regression in 2.6.35 · fad99fac
      Jason Wessel 提交于
      HW breakpoints events stopped working correctly with kgdb as a result
      of commit: 018cbffe (Merge commit
      'v2.6.33' into perf/core), later commit:
      ba773f7c (x86,kgdb: Fix hw breakpoint
      regression) allowed breakpoints to propagate to the debugger core but
      did not completely address the original regression in functionality
      found in 2.6.35.
      
      When the DR_STEP flag is set in dr6 along with any of the DR_TRAP
      bits, the kgdb exception handler will enter once from the
      hw_breakpoint API call back and again from the die notifier for
      do_debug(), which causes the debugger to stop twice and also for the
      kgdb regression tests to fail running under kvm with:
      
      echo V2I1 > /sys/module/kgdbts/parameters/kgdbts
      
      To address the problem, the kgdb overflow handler needs to implement
      the same logic as the ptrace overflow handler call back with respect
      to updating the virtual copy of dr6.  This will allow the kgdb
      do_debug() die notifier to properly handle the exception and the
      attached debugger, or kgdb test suite, will only receive a single
      notification.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      CC: Frederic Weisbecker <fweisbec@gmail.com>
      CC: x86@kernel.org
      fad99fac
    • L
      Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6 · f5d9d249
      Linus Torvalds 提交于
      * 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
        pcmcia: fix ni_daq_700 compilation
        pcmcia: IOCARD is also required for using IRQs
      f5d9d249
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic · db08bf08
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        asm-generic/io.h: allow people to override individual funcs
        bitops: remove duplicated extern declarations
        bitops: make asm-generic/bitops/find.h more generic
        asm-generic: kdebug.h: Checkpatch cleanup
        asm-generic: fcntl: make exported headers use strict posix types
        asm-generic: cmpxchg does not handle non-long arguments
        asm-generic: make atomic_add_unless a function
      db08bf08
    • L
      Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl · 092e0e7e
      Linus Torvalds 提交于
      * 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
        vfs: make no_llseek the default
        vfs: don't use BKL in default_llseek
        llseek: automatically add .llseek fop
        libfs: use generic_file_llseek for simple_attr
        mac80211: disallow seeks in minstrel debug code
        lirc: make chardev nonseekable
        viotape: use noop_llseek
        raw: use explicit llseek file operations
        ibmasmfs: use generic_file_llseek
        spufs: use llseek in all file operations
        arm/omap: use generic_file_llseek in iommu_debug
        lkdtm: use generic_file_llseek in debugfs
        net/wireless: use generic_file_llseek in debugfs
        drm: use noop_llseek
      092e0e7e
    • L
      Merge branch 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl · 79f14b7c
      Linus Torvalds 提交于
      * 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: (30 commits)
        BKL: remove BKL from freevxfs
        BKL: remove BKL from qnx4
        autofs4: Only declare function when CONFIG_COMPAT is defined
        autofs: Only declare function when CONFIG_COMPAT is defined
        ncpfs: Lock socket in ncpfs while setting its callbacks
        fs/locks.c: prepare for BKL removal
        BKL: Remove BKL from ncpfs
        BKL: Remove BKL from OCFS2
        BKL: Remove BKL from squashfs
        BKL: Remove BKL from jffs2
        BKL: Remove BKL from ecryptfs
        BKL: Remove BKL from afs
        BKL: Remove BKL from USB gadgetfs
        BKL: Remove BKL from autofs4
        BKL: Remove BKL from isofs
        BKL: Remove BKL from fat
        BKL: Remove BKL from ext2 filesystem
        BKL: Remove BKL from do_new_mount()
        BKL: Remove BKL from cgroup
        BKL: Remove BKL from NTFS
        ...
      79f14b7c
    • L
      Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl · c37927d4
      Linus Torvalds 提交于
      * 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
        block: autoconvert trivial BKL users to private mutex
        drivers: autoconvert trivial BKL users to private mutex
        ipmi: autoconvert trivial BKL users to private mutex
        mac: autoconvert trivial BKL users to private mutex
        mtd: autoconvert trivial BKL users to private mutex
        scsi: autoconvert trivial BKL users to private mutex
      
      Fix up trivial conflicts (due to addition of private mutex right next to
      deletion of a version string) in drivers/char/pcmcia/cm40[04]0_cs.c
      c37927d4
    • L
      Merge branch 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl · 5704e44d
      Linus Torvalds 提交于
      * 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
        BKL: introduce CONFIG_BKL.
        dabusb: remove the BKL
        sunrpc: remove the big kernel lock
        init/main.c: remove BKL notations
        blktrace: remove the big kernel lock
        rtmutex-tester: make it build without BKL
        dvb-core: kill the big kernel lock
        dvb/bt8xx: kill the big kernel lock
        tlclk: remove big kernel lock
        fix rawctl compat ioctls breakage on amd64 and itanic
        uml: kill big kernel lock
        parisc: remove big kernel lock
        cris: autoconvert trivial BKL users
        alpha: kill big kernel lock
        isapnp: BKL removal
        s390/block: kill the big kernel lock
        hpet: kill BKL, add compat_ioctl
      5704e44d
    • D
      36845d09
  2. 22 10月, 2010 23 次提交