05 Apr, 2012

1 commit

  • Pull KGDB/KDB regression fixes from Jason Wessel:
    - Fix a Smatch warning that appeared in the 3.4 merge window
    - Fix kgdb test suite with SMP for all archs without HW single stepping
    - Fix kgdb sw breakpoints with CONFIG_DEBUG_RODATA=y limitations on x86
    - Fix oops on kgdb test suite with CONFIG_DEBUG_RODATA
    - Fix kgdb test suite with SMP for all archs with HW single stepping

    * tag 'for_linus-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    x86,kgdb: Fix DEBUG_RODATA limitation using text_poke()
    kgdb,debug_core: pass the breakpoint struct instead of address and memory
    kgdbts: (2 of 2) fix single step awareness to work correctly with SMP
    kgdbts: (1 of 2) fix single step awareness to work correctly with SMP
    kgdbts: Fix kernel oops with CONFIG_DEBUG_RODATA
    kdb: Fix smatch warning on dbg_io_ops->is_console

    Linus Torvalds
     

30 Mar, 2012

2 commits

  • There is extra state information that needs to be exposed in the
    kgdb_bpt structure for tracking how a breakpoint was installed. The
    debug_core only uses the the probe_kernel_write() to install
    breakpoints, but this is not enough for all the archs. Some arch such
    as x86 need to use text_poke() in order to install a breakpoint into a
    read only page.

    Passing the kgdb_bpt structure to kgdb_arch_set_breakpoint() and
    kgdb_arch_remove_breakpoint() allows other archs to set the type
    variable which indicates how the breakpoint was installed.

    Cc: stable@vger.kernel.org # >= 2.6.36
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The Smatch tool warned that the change from commit b8adde8dd
    (kdb: Avoid using dbg_io_ops until it is initialized) should
    add another null check later in the kdb_printf().

    It is worth noting that the second use of dbg_io_ops->is_console
    is protected by the KDB_PAGER state variable which would only
    get set when kdb is fully active and initialized. If we
    ever encounter changes or defects in the KDB_PAGER state
    we do not want to crash the kernel in a kdb_printf/printk.

    CC: Tim Bird
    Reported-by: Dan Carpenter
    Signed-off-by: Jason Wessel

    Jason Wessel
     

29 Mar, 2012

2 commits

  • …m/linux/kernel/git/dhowells/linux-asm_system

    Pull "Disintegrate and delete asm/system.h" from David Howells:
    "Here are a bunch of patches to disintegrate asm/system.h into a set of
    separate bits to relieve the problem of circular inclusion
    dependencies.

    I've built all the working defconfigs from all the arches that I can
    and made sure that they don't break.

    The reason for these patches is that I recently encountered a circular
    dependency problem that came about when I produced some patches to
    optimise get_order() by rewriting it to use ilog2().

    This uses bitops - and on the SH arch asm/bitops.h drags in
    asm-generic/get_order.h by a circuituous route involving asm/system.h.

    The main difficulty seems to be asm/system.h. It holds a number of
    low level bits with no/few dependencies that are commonly used (eg.
    memory barriers) and a number of bits with more dependencies that
    aren't used in many places (eg. switch_to()).

    These patches break asm/system.h up into the following core pieces:

    (1) asm/barrier.h

    Move memory barriers here. This already done for MIPS and Alpha.

    (2) asm/switch_to.h

    Move switch_to() and related stuff here.

    (3) asm/exec.h

    Move arch_align_stack() here. Other process execution related bits
    could perhaps go here from asm/processor.h.

    (4) asm/cmpxchg.h

    Move xchg() and cmpxchg() here as they're full word atomic ops and
    frequently used by atomic_xchg() and atomic_cmpxchg().

    (5) asm/bug.h

    Move die() and related bits.

    (6) asm/auxvec.h

    Move AT_VECTOR_SIZE_ARCH here.

    Other arch headers are created as needed on a per-arch basis."

    Fixed up some conflicts from other header file cleanups and moving code
    around that has happened in the meantime, so David's testing is somewhat
    weakened by that. We'll find out anything that got broken and fix it..

    * tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system: (38 commits)
    Delete all instances of asm/system.h
    Remove all #inclusions of asm/system.h
    Add #includes needed to permit the removal of asm/system.h
    Move all declarations of free_initmem() to linux/mm.h
    Disintegrate asm/system.h for OpenRISC
    Split arch_align_stack() out from asm-generic/system.h
    Split the switch_to() wrapper out of asm-generic/system.h
    Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h
    Create asm-generic/barrier.h
    Make asm-generic/cmpxchg.h #include asm-generic/cmpxchg-local.h
    Disintegrate asm/system.h for Xtensa
    Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt]
    Disintegrate asm/system.h for Tile
    Disintegrate asm/system.h for Sparc
    Disintegrate asm/system.h for SH
    Disintegrate asm/system.h for Score
    Disintegrate asm/system.h for S390
    Disintegrate asm/system.h for PowerPC
    Disintegrate asm/system.h for PA-RISC
    Disintegrate asm/system.h for MN10300
    ...

    Linus Torvalds
     
  • Remove all #inclusions of asm/system.h preparatory to splitting and killing
    it. Performed with the following command:

    perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *`

    Signed-off-by: David Howells

    David Howells
     

24 Mar, 2012

1 commit

  • Pull KGDB/KDB updates from Jason Wessel:
    "Fixes:
    - Fix KDB keyboard repeat scan codes and leaked keyboard events
    - Fix kernel crash with kdb_printf() for users who compile new
    kdb_printf()'s in early code
    - Return all segment registers to gdb on x86_64

    Features:
    - KDB/KGDB hook the reboot notifier and end user can control if it
    stops, detaches or does nothing (updated docs as well)
    - Notify users who use CONFIG_DEBUG_RODATA to use hw breakpoints"

    * tag 'for_linus-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    kdb: Add message about CONFIG_DEBUG_RODATA on failure to install breakpoint
    kdb: Avoid using dbg_io_ops until it is initialized
    kgdb,debug_core: add the ability to control the reboot notifier
    KDB: Fix usability issues relating to the 'enter' key.
    kgdb,debug-core,gdbstub: Hook the reboot notifier for debugger detach
    kgdb: Respect that flush op is optional
    kgdb: x86: Return all segment registers also in 64-bit mode

    Linus Torvalds
     

23 Mar, 2012

6 commits

  • On x86, if CONFIG_DEBUG_RODATA is set, one cannot set breakpoints
    via KDB. Apparently this is a well-known problem, as at least one distribution
    now ships with both KDB enabled and CONFIG_DEBUG_RODATA=y for security reasons.

    This patch adds an printk message to the breakpoint failure case,
    in order to provide suggestions about how to use the debugger.

    Reported-by: Tim Bird
    Signed-off-by: Jason Wessel
    Acked-by: Tim Bird

    Jason Wessel
     
  • This fixes a bug with setting a breakpoint during kdb initialization
    (from kdb_cmds). Any call to kdb_printf() before the initialization
    of the kgdboc serial console driver (which happens much later during
    bootup than kdb_init), results in kernel panic due to the use of
    dbg_io_ops before it is initialized.

    Signed-off-by: Tim Bird
    Signed-off-by: Jason Wessel

    Tim Bird
     
  • Sometimes it is desirable to stop the kernel debugger before allowing
    a system to reboot either with kdb or kgdb. This patch adds the
    ability to turn the reboot notifier on and off or enter the debugger
    and stop kernel execution before rebooting.

    It is possible to change the setting after booting the kernel with the
    following:

    echo 1 > /sys/module/debug_core/parameters/kgdbreboot

    It is also possible to change this setting using kdb / kgdb to
    manipulate the variable directly.

    Using KDB:
    mm kgdbreboot 1

    Using gdb:
    set kgdbreboot=1

    Reported-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • This fixes the following problems:
    1) Typematic-repeat of 'enter' gives warning message
    and leaks make/break if KDB exits. Repeats
    look something like 0x1c 0x1c .... 0x9c
    2) Use of 'keypad enter' gives warning message and
    leaks the ENTER break/make code out if KDB exits.
    KP ENTER repeats look someting like 0xe0 0x1c
    0xe0 0x1c ... 0xe0 0x9c.
    3) Lag on the order of seconds between "break" and "make" when
    expecting the enter "break" code. Seen under virtualized
    environments such as VMware ESX.

    The existing special enter handler tries to glob the enter break code,
    but this fails if the other (KP) enter was used, or if there was a key
    repeat. It also fails if you mashed some keys along with enter, and
    you ended up with a non-enter make or non-enter break code coming
    after the enter make code. So first, we modify the handler to handle
    these cases. But performing these actions on every enter is annoying
    since now you can't hold ENTER down to scroll d messages in
    KDB. Since this special behaviour is only necessary to handle the
    exiting KDB ('g' + ENTER) without leaking scancodes to the OS. This
    cleanup needs to get executed anytime the kdb_main loop exits.

    Tested on QEMU. Set a bp on atkbd.c to verify no scan code was leaked.

    Cc: Andrei Warkentin
    [jason.wessel@windriver.com: move cleanup calls to kdb_main.c]
    Signed-off-by: Andrei Warkentin
    Signed-off-by: Jason Wessel

    Andrei Warkentin
     
  • The gdbstub and kdb should get detached if the system is rebooting.
    Calling gdbstub_exit() will set the proper debug core state and send a
    message to any debugger that is connected to correctly detach.

    An attached debugger will receive the exit code from
    include/linux/reboot.h based on SYS_HALT, SYS_REBOOT, etc...

    Reported-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Not all kgdb I/O drivers implement a flush operation. Adjust
    gdbstub_exit accordingly.

    Signed-off-by: Jan Kiszka
    Signed-off-by: Jason Wessel

    Jan Kiszka
     

20 Mar, 2012

1 commit


13 Jan, 2012

1 commit

  • module_ref contains two "unsigned int" fields.

    Thats now too small, since some machines can open more than 2^32 files.

    Check commit 518de9b39e8 (fs: allow for more than 2^31 files) for
    reference.

    We can add an aligned(2 * sizeof(unsigned long)) attribute to force
    alloc_percpu() allocating module_ref areas in single cache lines.

    Signed-off-by: Eric Dumazet
    CC: Rusty Russell
    CC: Tejun Heo
    CC: Robin Holt
    CC: David Miller
    Signed-off-by: Rusty Russell

    Eric Dumazet
     

12 Dec, 2011

1 commit


07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

01 Nov, 2011

2 commits


02 Aug, 2011

5 commits


27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

31 Mar, 2011

1 commit


26 Mar, 2011

3 commits


19 Mar, 2011

1 commit

  • Notify GDB of the machine halting, rebooting or powering off by sending it an
    exited command (remote protocol command 'W'). This is done by calling:

    void gdbstub_exit(int status)

    from the arch's machine_{halt,restart,power_off}() functions with an
    appropriate exit status to be reported to GDB.

    Signed-off-by: David Howells

    David Howells
     

23 Dec, 2010

1 commit


18 Nov, 2010

2 commits


02 Nov, 2010

1 commit

  • "gadget", "through", "command", "maintain", "maintain", "controller", "address",
    "between", "initiali[zs]e", "instead", "function", "select", "already",
    "equal", "access", "management", "hierarchy", "registration", "interest",
    "relative", "memory", "offset", "already",

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Jiri Kosina

    Uwe Kleine-König
     

30 Oct, 2010

3 commits

  • The kgdb_disable_hw_debug() was an architecture specific function for
    disabling all hardware breakpoints on a per cpu basis when entering
    the debug core.

    This patch will remove the weak function kdbg_disable_hw_debug() and
    change it into a call back which lives with the rest of hw breakpoint
    call backs in struct kgdb_arch.

    Signed-off-by: Dongdong Deng
    Signed-off-by: Jason Wessel

    Dongdong Deng
     
  • The kdb_current legally be equal to NULL in the early boot of the x86
    arch. The problem pcan be observed by booting with the kernel arguments:

    earlyprintk=vga ekgdboc=kbd kgdbwait

    The kdb shell will oops on entry and recursively fault because it
    cannot get past the final stage of shell initialization.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Rusty pointed out that the per_cpu command uses up lots of space on
    the stack and the cpu supress mask is probably not needed.

    This patch removes the need for the supress mask as well as fixing up
    the following problems with the kdb per_cpu command:
    * The per_cpu command should allow an address as an argument
    * When you have more data than can be displayed on one screen allow
    the user to break out of the print loop.

    Reported-by: Rusty Russell
    Signed-off-by: Jason Wessel

    Jason Wessel
     

23 Oct, 2010

4 commits

  • The kdb shell needs to enforce switching back to the original CPU that
    took the exception before restoring normal kernel execution. Resuming
    from a different CPU than what took the original exception will cause
    problems with spin locks that are freed from the a different processor
    than had taken the lock.

    The special logic in dbg_cpu_switch() can go away entirely with
    because the state of what cpus want to be masters or slaves will
    remain unchanged between entry and exit of the debug_core exception
    context.

    Signed-off-by: Jason Wessel

    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: Jason Wessel
    Acked-by: Dongdong Deng

    Jason Wessel
     
  • 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: Dongdong Deng
    Signed-off-by: Jason Wessel

    Dongdong Deng
     
  • 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] *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: Jason Wessel

    Jason Wessel