05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 02111
    1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 136 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190530000436.384967451@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

26 Apr, 2019

1 commit


26 Sep, 2018

1 commit

  • kgdbts current fails when compiled with restrict:

    drivers/misc/kgdbts.c: In function ‘configure_kgdbts’:
    drivers/misc/kgdbts.c:1070:2: error: ‘strcpy’ source argument is the same as destination [-Werror=restrict]
    strcpy(config, opt);
    ^~~~~~~~~~~~~~~~~~~

    As the error says, config is being used in both the source and destination.
    Refactor the code to avoid the extra copy and put the parsing closer to
    the actual location.

    Signed-off-by: Laura Abbott
    Acked-by: Daniel Thompson
    Signed-off-by: Greg Kroah-Hartman

    Laura Abbott
     

25 Jan, 2018

1 commit

  • kgdbts includes a couple of different "thrashing" style tests that
    may have long runtimes (especially on simulated platforms) and which
    run asynchronously. This is uncomfortable for interactive use and
    makes setting timeouts tricky for automatic use.

    Fix by providing a optional means to show progress during these tests.
    Selecting 100 is somewhat arbitrary but it matches the step used on
    the synchronous tests, is large enough to keep the call to printk
    from invalidating the testing and is human enough to "feel about
    right".

    Signed-off-by: Daniel Thompson
    Signed-off-by: Jason Wessel

    Daniel Thompson
     

31 Oct, 2017

1 commit

  • Several function prototypes for the set/get functions defined by
    module_param_call() have a slightly wrong argument types. This fixes
    those in an effort to clean up the calls when running under type-enforced
    compiler instrumentation for CFI. This is the result of running the
    following semantic patch:

    @match_module_param_call_function@
    declarer name module_param_call;
    identifier _name, _set_func, _get_func;
    expression _arg, _mode;
    @@

    module_param_call(_name, _set_func, _get_func, _arg, _mode);

    @fix_set_prototype
    depends on match_module_param_call_function@
    identifier match_module_param_call_function._set_func;
    identifier _val, _param;
    type _val_type, _param_type;
    @@

    int _set_func(
    -_val_type _val
    +const char * _val
    ,
    -_param_type _param
    +const struct kernel_param * _param
    ) { ... }

    @fix_get_prototype
    depends on match_module_param_call_function@
    identifier match_module_param_call_function._get_func;
    identifier _val, _param;
    type _val_type, _param_type;
    @@

    int _get_func(
    -_val_type _val
    +char * _val
    ,
    -_param_type _param
    +const struct kernel_param * _param
    ) { ... }

    Two additional by-hand changes are included for places where the above
    Coccinelle script didn't notice them:

    drivers/platform/x86/thinkpad_acpi.c
    fs/lockd/svc.c

    Signed-off-by: Kees Cook
    Signed-off-by: Jessica Yu

    Kees Cook
     

02 Mar, 2017

1 commit


21 Sep, 2015

1 commit

  • The Kconfig currently controlling compilation of this code is:

    lib/Kconfig.kgdb:config KGDB_TESTS
    lib/Kconfig.kgdb: bool "KGDB: internal test suite"

    ...meaning that it currently is not being built as a module by anyone.

    Lets remove the modular code that is essentially orphaned, so that
    when reading the driver there is no doubt it is builtin-only.

    Since module_init translates to device_initcall in the non-modular
    case, the init ordering remains unchanged with this commit.

    We also delete the MODULE_LICENSE tag etc. since all that information
    is already contained at the top of the file in the comments.

    We can't remove the module.h include since we've kept the use of
    module_param in this file for now.

    Cc: Arnd Bergmann
    Cc: kgdb-bugreport@lists.sourceforge.net
    Signed-off-by: Paul Gortmaker
    Acked-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Paul Gortmaker
     

26 Jun, 2015

1 commit

  • clone has some of the quirkiest syscall handling in the kernel, with a
    pile of special cases, historical curiosities, and architecture-specific
    calling conventions. In particular, clone with CLONE_SETTLS accepts a
    parameter "tls" that the C entry point completely ignores and some
    assembly entry points overwrite; instead, the low-level arch-specific
    code pulls the tls parameter out of the arch-specific register captured
    as part of pt_regs on entry to the kernel. That's a massive hack, and
    it makes the arch-specific code only work when called via the specific
    existing syscall entry points; because of this hack, any new clone-like
    system call would have to accept an identical tls argument in exactly
    the same arch-specific position, rather than providing a unified system
    call entry point across architectures.

    The first patch allows architectures to handle the tls argument via
    normal C parameter passing, if they opt in by selecting
    HAVE_COPY_THREAD_TLS. The second patch makes 32-bit and 64-bit x86 opt
    into this.

    These two patches came out of the clone4 series, which isn't ready for
    this merge window, but these first two cleanup patches were entirely
    uncontroversial and have acks. I'd like to go ahead and submit these
    two so that other architectures can begin building on top of this and
    opting into HAVE_COPY_THREAD_TLS. However, I'm also happy to wait and
    send these through the next merge window (along with v3 of clone4) if
    anyone would prefer that.

    This patch (of 2):

    clone with CLONE_SETTLS accepts an argument to set the thread-local
    storage area for the new thread. sys_clone declares an int argument
    tls_val in the appropriate point in the argument list (based on the
    various CLONE_BACKWARDS variants), but doesn't actually use or pass along
    that argument. Instead, sys_clone calls do_fork, which calls
    copy_process, which calls the arch-specific copy_thread, and copy_thread
    pulls the corresponding syscall argument out of the pt_regs captured at
    kernel entry (knowing what argument of clone that architecture passes tls
    in).

    Apart from being awful and inscrutable, that also only works because only
    one code path into copy_thread can pass the CLONE_SETTLS flag, and that
    code path comes from sys_clone with its architecture-specific
    argument-passing order. This prevents introducing a new version of the
    clone system call without propagating the same architecture-specific
    position of the tls argument.

    However, there's no reason to pull the argument out of pt_regs when
    sys_clone could just pass it down via C function call arguments.

    Introduce a new CONFIG_HAVE_COPY_THREAD_TLS for architectures to opt into,
    and a new copy_thread_tls that accepts the tls parameter as an additional
    unsigned long (syscall-argument-sized) argument. Change sys_clone's tls
    argument to an unsigned long (which does not change the ABI), and pass
    that down to copy_thread_tls.

    Architectures that don't opt into copy_thread_tls will continue to ignore
    the C argument to sys_clone in favor of the pt_regs captured at kernel
    entry, and thus will be unable to introduce new versions of the clone
    syscall.

    Patch co-authored by Josh Triplett and Thiago Macieira.

    Signed-off-by: Josh Triplett
    Acked-by: Andy Lutomirski
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Thiago Macieira
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josh Triplett
     

02 Mar, 2013

1 commit

  • We can't look up the address of the entry point of the function simply
    via that function symbol for all architectures.

    For PPC64 ABI, actually there is a function descriptors structure.

    A function descriptor is a three doubleword data structure that contains
    the following values:
    * The first doubleword contains the address of the entry point of
    the function.
    * The second doubleword contains the TOC base address for
    the function.
    * The third doubleword contains the environment pointer for
    languages such as Pascal and PL/1.

    So we should call a wapperred dereference_function_descriptor() to get
    the address of the entry point of the function.

    Note this is also safe for other architecture after refer to
    "include/asm-generic/sections.h" since:

    dereference_function_descriptor(p) always is (p) if without arched definition.

    Signed-off-by: Tiejun Chen
    Signed-off-by: Jason Wessel

    Tiejun Chen
     

30 Mar, 2012

4 commits

  • There has long been a limitation using software breakpoints with a
    kernel compiled with CONFIG_DEBUG_RODATA going back to 2.6.26. For
    this particular patch, it will apply cleanly and has been tested all
    the way back to 2.6.36.

    The kprobes code uses the text_poke() function which accommodates
    writing a breakpoint into a read-only page. The x86 kgdb code can
    solve the problem similarly by overriding the default breakpoint
    set/remove routines and using text_poke() directly.

    The x86 kgdb code will first attempt to use the traditional
    probe_kernel_write(), and next try using a the text_poke() function.
    The break point install method is tracked such that the correct break
    point removal routine will get called later on.

    Cc: x86@kernel.org
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: H. Peter Anvin
    Cc: stable@vger.kernel.org # >= 2.6.36
    Inspried-by: Masami Hiramatsu
    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • The do_fork and sys_open tests have never worked properly on anything
    other than a UP configuration with the kgdb test suite. This is
    because the test suite did not fully implement the behavior of a real
    debugger. A real debugger tracks the state of what thread it asked to
    single step and can correctly continue other threads of execution or
    conditionally stop while waiting for the original thread single step
    request to return.

    Below is a simple method to cause a fatal kernel oops with the kgdb
    test suite on a 2 processor ARM system:

    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    echo V1I1F100 > /sys/module/kgdbts/parameters/kgdbts

    Very soon after starting the test the kernel will start warning with
    messages like:

    kgdbts: BP mismatch c002487c expected c0024878
    ------------[ cut here ]------------
    WARNING: at drivers/misc/kgdbts.c:317 check_and_rewind_pc+0x9c/0xc4()
    [] (check_and_rewind_pc+0x9c/0xc4)
    [] (validate_simple_test+0x3c/0xc4)
    [] (run_simple_test+0x1e8/0x274)

    The kernel will eventually recovers, but the test suite has completely
    failed to test anything useful.

    This patch implements behavior similar to a real debugger that does
    not rely on hardware single stepping by using only software planted
    breakpoints.

    In order to mimic a real debugger, the kgdb test suite now tracks the
    most recent thread that was continued (cont_thread_id), with the
    intent to single step just this thread. When the response to the
    single step request stops in a different thread that hit the original
    break point that thread will now get continued, while the debugger
    waits for the thread with the single step pending. Here is a high
    level description of the sequence of events.

    cont_instead_of_sstep = 0;

    1) set breakpoint at do_fork
    2) continue
    3) Save the thread id where we stop to cont_thread_id
    4) Remove breakpoint at do_fork
    5) Reset the PC if needed depending on kernel exception type
    6) soft single step
    7) Check where we stopped
    if current thread != cont_thread_id {
    if (here for more than 2 times for the same thead) {
    ### must be a really busy system, start test again ###
    goto step 1
    }
    goto step 5
    } else {
    cont_instead_of_sstep = 0;
    }
    8) clean up and run test again if needed
    9) Clear out any threads that were waiting on a break point at the
    point in time the test is ended with get_cont_catch(). This
    happens sometimes because breakpoints are used in place of single
    stepping and some threads could have been in the debugger exception
    handling queue because breakpoints were hit concurrently on
    different CPUs. This also means we wait at least one second before
    unplumbing the debugger connection at the very end, so as respond
    to any debug threads waiting to be serviced.

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

    Jason Wessel
     
  • The do_fork and sys_open tests have never worked properly on anything
    other than a UP configuration with the kgdb test suite. This is
    because the test suite did not fully implement the behavior of a real
    debugger. A real debugger tracks the state of what thread it asked to
    single step and can correctly continue other threads of execution or
    conditionally stop while waiting for the original thread single step
    request to return.

    Below is a simple method to cause a fatal kernel oops with the kgdb
    test suite on a 4 processor x86 system:

    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    while [ 1 ] ; do ls > /dev/null 2> /dev/null; done&
    echo V1I1F1000 > /sys/module/kgdbts/parameters/kgdbts

    Very soon after starting the test the kernel will oops with a message like:

    kgdbts: BP mismatch 3b7da66480 expected ffffffff8106a590
    WARNING: at drivers/misc/kgdbts.c:303 check_and_rewind_pc+0xe0/0x100()
    Call Trace:
    [] check_and_rewind_pc+0xe0/0x100
    [] validate_simple_test+0x25/0xc0
    [] run_simple_test+0x107/0x2c0
    [] kgdbts_put_char+0x18/0x20

    The warn will turn to a hard kernel crash shortly after that because
    the pc will not get properly rewound to the right value after hitting
    a breakpoint leading to a hard lockup.

    This change is broken up into 2 pieces because archs that have hw
    single stepping (2.6.26 and up) need different changes than archs that
    do not have hw single stepping (3.0 and up). This change implements
    the correct behavior for an arch that supports hw single stepping.

    A minor defect was fixed where sys_open should be do_sys_open
    for the sys_open break point test. This solves the problem of running
    a 64 bit with a 32 bit user space. The sys_open() never gets called
    when using the 32 bit file system for the kgdb testsuite because the
    32 bit binaries invoke the compat_sys_open() call leading to the test
    never completing.

    In order to mimic a real debugger, the kgdb test suite now tracks the
    most recent thread that was continued (cont_thread_id), with the
    intent to single step just this thread. When the response to the
    single step request stops in a different thread that hit the original
    break point that thread will now get continued, while the debugger
    waits for the thread with the single step pending. Here is a high
    level description of the sequence of events.

    cont_instead_of_sstep = 0;

    1) set breakpoint at do_fork
    2) continue
    3) Save the thread id where we stop to cont_thread_id
    4) Remove breakpoint at do_fork
    5) Reset the PC if needed depending on kernel exception type
    6) if (cont_instead_of_sstep) { continue } else { single step }
    7) Check where we stopped
    if current thread != cont_thread_id {
    cont_instead_of_sstep = 1;
    goto step 5
    } else {
    cont_instead_of_sstep = 0;
    }
    8) clean up and run test again if needed

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

    Jason Wessel
     
  • On x86 the kgdb test suite will oops when the kernel is compiled with
    CONFIG_DEBUG_RODATA and you run the tests after boot time. This is
    regression has existed since 2.6.26 by commit: b33cb815 (kgdbts: Use
    HW breakpoints with CONFIG_DEBUG_RODATA).

    The test suite can use hw breakpoints for all the tests, but it has to
    execute the hardware breakpoint specific tests first in order to
    determine that the hw breakpoints actually work. Specifically the
    very first test causes an oops:

    # echo V1I1 > /sys/module/kgdbts/parameters/kgdbts
    kgdb: Registered I/O driver kgdbts.
    kgdbts:RUN plant and detach test

    Entering kdb (current=0xffff880017aa9320, pid 1078) on processor 0 due to Keyboard Entry
    [0]kdb> kgdbts: ERROR PUT: end of test buffer on 'plant_and_detach_test' line 1 expected OK got $E14#aa
    WARNING: at drivers/misc/kgdbts.c:730 run_simple_test+0x151/0x2c0()
    [...oops clipped...]

    This commit re-orders the running of the tests and puts the RODATA
    check into its own function so as to correctly avoid the kernel oops
    by detecting and using the hw breakpoints.

    Cc: # >= 2.6.26
    Signed-off-by: Jason Wessel

    Jason Wessel
     

01 Nov, 2011

1 commit


01 Jun, 2011

1 commit

  • The new instruction_pointer_set helper is defined for people who have
    converted to asm-generic/ptrace.h, so don't use it generally unless
    the arch needs it (in which case it has been converted). This should
    fix building of kgdb tests for arches not yet converted.

    Signed-off-by: Mike Frysinger
    Acked-by: Stephen Rothwell
    Cc: Jason Wessel
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

27 May, 2011

1 commit

  • The Blackfin arch, like the x86 arch, needs to adjust the PC manually
    after a breakpoint is hit as normally this is handled by the remote gdb.
    However, rather than starting another arch ifdef mess, create a common
    GDB_ADJUSTS_BREAK_OFFSET define for any arch to opt-in via their kgdb.h.

    Signed-off-by: Mike Frysinger
    Cc: Oleg Nesterov
    Cc: Jason Wessel
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Acked-by: Paul Mundt
    Acked-by: Dongdong Deng
    Cc: Sergei Shtylyov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

31 Mar, 2011

1 commit


26 Mar, 2011

1 commit


30 Oct, 2010

1 commit

  • The "kgdb_connected" variable of debug_core just indicates whether or
    not kgdbts is connected to the debug_core. It does not completely
    prevent a script from trying invoke kgdbts again and possibly crashing
    the system (see Call Trace below).

    The configured variable in kgtbts can be used instead of
    kgdb_connected instead of kgdb_connected. The cleanup_kgdbts() can
    also be removed because there is no possible way to build kgdbts as a
    kernel module that you could unload with rmmod.

    Call Trace:
    -----------------------------------------------------------------
    root:/$ echo kgdbts=V1S1000 > /sys/module/kgdbts/parameters/kgdbts
    kgdb: Unregistered I/O driver kgdbts, debugger disabled.
    ------------[ cut here ]------------
    WARNING: at kernel/debug/debug_core.c:1002
    kgdb_unregister_io_module+0xec/0x100()
    Hardware name: Moon Creek platform
    Modules linked in:
    Pid: 664, comm: sh Not tainted 2.6.34.1-WR4.0.0.0_standard #58
    Call Trace:
    [] warn_slowpath_common+0x6d/0xa0
    [] ? kgdb_unregister_io_module+0xec/0x100
    [] ? kgdb_unregister_io_module+0xec/0x100
    [] ? param_attr_store+0x0/0x20
    [] warn_slowpath_null+0x15/0x20
    [] kgdb_unregister_io_module+0xec/0x100
    [] cleanup_kgdbts+0x1a/0x20
    [] param_set_kgdbts_var+0x6d/0xb0
    [] ? param_set_kgdbts_var+0x0/0xb0
    [] param_attr_store+0x17/0x20
    [] module_attr_store+0x2c/0x40
    [] sysfs_write_file+0x94/0xf0
    [] vfs_write+0x96/0x130
    [] ? sysfs_write_file+0x0/0xf0
    [] sys_write+0x46/0xd0
    [] system_call_done+0x0/0x4
    ---[ end trace 4eb028c6ee43154c ]---
    kgdb: Unregistered I/O driver kgdbts, debugger disabled.
    -----------------------------------------------------------------

    [jason.wessel@windriver.com: remove cleanup_kgdbts() ]
    Signed-off-by: Dongdong Deng
    Signed-off-by: Jason Wessel

    Dongdong Deng
     

03 Apr, 2010

1 commit


11 Dec, 2009

2 commits

  • Some versions of gcc replace calls to strstr() with single-character
    "needle" string parameters by calls to strchr() behind our back.
    This causes linking errors if strchr() is defined as an inline function
    in (e.g. on m68k, which BTW doesn't have kgdb support).

    Prevent this by explicitly calling strchr() instead.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Jason Wessel

    Geert Uytterhoeven
     
  • Prevent write to put_buf[BUFMAX] in kgdb test suite.

    If put_buf_cnt was BUFMAX - 1 at the earlier test,
    `\0' is written to put_buf[BUFMAX].

    Signed-off-by: Roel Kluin
    Signed-off-by: Jason Wessel

    Roel Kluin
     

29 May, 2008

2 commits


05 May, 2008

2 commits

  • The single step test is not terribly costly and it should be able to
    pass at 1000 loops successfully in under 1 second. A non-kgdb timing
    regression was found using this test, but it did not occur frequently
    because by default the test was only executed a single time.

    This patch changes the default for the single step test to 1000
    iterations and allows for individual configuration of the single step
    test to further exercise the kgdb subsystem when needed.

    Signed-off-by: Jason Wessel

    Jason Wessel
     
  • Shadowed variable and integer as NULL pointer fixes:
    drivers/misc/kgdbts.c:877:6: warning: symbol 'sys_open_test' shadows an earlier one
    drivers/misc/kgdbts.c:537:27: originally declared here
    drivers/misc/kgdbts.c:378:22: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:386:22: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:468:30: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:472:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:502:30: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:506:30: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:509:30: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:523:20: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:527:20: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:530:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:541:21: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:545:21: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:548:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:559:30: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:563:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:573:16: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:574:19: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:578:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:588:16: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:589:19: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:593:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:602:16: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:604:15: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:925:3: warning: Using plain integer as NULL pointer
    drivers/misc/kgdbts.c:938:3: warning: Using plain integer as NULL pointer

    Signed-off-by: Harvey Harrison
    Signed-off-by: Jason Wessel

    Harvey Harrison
     

29 Apr, 2008

1 commit


18 Apr, 2008

2 commits

  • This patch adds in the ability to compile the kgdb internal test
    string into the kernel so as to run the tests at boot without changing
    the kernel boot arguments. This patch also changes all the error
    paths to invoke WARN_ON(1) which will emit the line number of the file
    and dump the kernel stack when an error occurs.

    You can disable the tests in a kernel that is built this way
    using "kgdbts="

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • This patch adds regression tests for testing the kgdb core and arch
    specific implementation.

    The kgdb test suite is designed to be built into the kernel and not as
    a module because it uses a number of low level kernel and kgdb
    primitives which should not be exported externally.

    The kgdb test suite is designed as a KGDB I/O module which
    simulates the communications that a debugger would have with kgdb.
    The tests are broken up in to a line by line and referenced here as
    a "get" which is kgdb requesting input and "put" which is kgdb
    sending a response.

    The kgdb suite can be invoked from the kernel command line
    arguments system or executed dynamically at run time. The test
    suite uses the variable "kgdbts" to obtain the information about
    which tests to run and to configure the verbosity level. The
    following are the various characters you can use with the kgdbts=
    line:

    When using the "kgdbts=" you only choose one of the following core
    test types:
    A = Run all the core tests silently
    V1 = Run all the core tests with minimal output
    V2 = Run all the core tests in debug mode

    You can also specify optional tests:
    N## = Go to sleep with interrupts of for ## seconds
    to test the HW NMI watchdog
    F## = Break at do_fork for ## iterations
    S## = Break at sys_open for ## iterations

    NOTE: that the do_fork and sys_open tests are mutually exclusive.

    To invoke the kgdb test suite from boot you use a kernel start
    argument as follows:
    kgdbts=V1 kgdbwait
    Or if you wanted to perform the NMI test for 6 seconds and do_fork
    test for 100 forks, you could use:
    kgdbts=V1N6F100 kgdbwait

    The test suite can also be invoked at run time with:
    echo kgdbts=V1N6F100 > /sys/module/kgdbts/parameters/kgdbts
    Or as another example:
    echo kgdbts=V2 > /sys/module/kgdbts/parameters/kgdbts

    When developing a new kgdb arch specific implementation or
    using these tests for the purpose of regression testing,
    several invocations are required.

    1) Boot with the test suite enabled by using the kernel arguments
    "kgdbts=V1F100 kgdbwait"
    ## If kgdb arch specific implementation has NMI use
    "kgdbts=V1N6F100

    2) After the system boot run the basic test.
    echo kgdbts=V1 > /sys/module/kgdbts/parameters/kgdbts

    3) Run the concurrency tests. It is best to use n+1
    while loops where n is the number of cpus you have
    in your system. The example below uses only two
    loops.

    ## This tests break points on sys_open
    while [ 1 ] ; do find / > /dev/null 2>&1 ; done &
    while [ 1 ] ; do find / > /dev/null 2>&1 ; done &
    echo kgdbts=V1S10000 > /sys/module/kgdbts/parameters/kgdbts
    fg # and hit control-c
    fg # and hit control-c
    ## This tests break points on do_fork
    while [ 1 ] ; do date > /dev/null ; done &
    while [ 1 ] ; do date > /dev/null ; done &
    echo kgdbts=V1F1000 > /sys/module/kgdbts/parameters/kgdbts
    fg # and hit control-c

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel