1. 18 Apr, 2008 24 commits
  2. 17 Apr, 2008 16 commits
    • Jason Wessel's avatar
      kgdb: always use icache flush for sw breakpoints · 1a9a3e76
      Jason Wessel authored
      On the ppc 4xx architecture the instruction cache must be flushed as
      well as the data cache.  This patch just makes it generic for all
      architectures where CACHE_FLUSH_IS_SAFE is set to 1.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1a9a3e76
    • Jason Wessel's avatar
      kgdb: fix SMP NMI kgdb_handle_exception exit race · 56fb7093
      Jason Wessel authored
      Fix the problem of protecting the kgdb handle_exception exit
      which had an NMI race condition, while trying to restore
      normal system operation.
      
      There was a small window after the master processor sets cpu_in_debug
      to zero but before it has set kgdb_active to zero where a
      non-master processor in an SMP system could receive an NMI and
      re-enter the kgdb_wait() loop.
      
      As long as the master processor sets the cpu_in_debug before sending
      the cpu roundup the cpu_in_debug variable can also be used to guard
      against the race condition.
      
      The kgdb_wait() function no longer needs to check
      kgdb_active because it is done in the arch specific code
      and handled along with the nmi traps at the low level.
      This also allows kgdb_wait() to exit correctly if it was
      entered for some unknown reason due to a spurious NMI that
      could not be handled by the arch specific code.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      56fb7093
    • Jason Wessel's avatar
      kgdb: documentation fixes · 225a4424
      Jason Wessel authored
      Minor cleanups to kgdb docs.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      225a4424
    • Jason Wessel's avatar
      kgdb: allow static kgdbts boot configuration · 974460c5
      Jason Wessel authored
      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: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      974460c5
    • Jason Wessel's avatar
      kgdb: add documentation · e3e2aaf7
      Jason Wessel authored
      Add in the kgdb documentation for kgdb.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e3e2aaf7
    • Andrew Morton's avatar
      kgdb: Kconfig fix · 4a1b5502
      Andrew Morton authored
      ERROR: "uart_parse_options" [drivers/serial/serial_core.ko] undefined!
      
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4a1b5502
    • Jason Wessel's avatar
      kgdb: add kgdb internal test suite · e8d31c20
      Jason Wessel authored
      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: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e8d31c20
    • Jason Wessel's avatar
      kgdb: fix several kgdb regressions · 737a460f
      Jason Wessel authored
      kgdb core fixes:
      - Check to see that mm->mmap_cache is not null before calling
        flush_cache_range(), else on arch=ARM it will cause a fatal
        fault.
      
      - Breakpoints should only be restored if they are in the BP_ACTIVE
        state.
      
      - Fix a typo in comments to "kgdb_register_io_module"
      
      x86 kgdb fixes:
      - Fix the x86 arch handler such that on a kill or detach that the
        appropriate cleanup on the single stepping flags gets run.
      
      - Add in the DIE_NMIWATCHDOG call for x86_64
      
      - Touch the nmi watchdog before returning the system to normal
        operation after performing any kind of kgdb operation, else
        the possibility exists to trigger the watchdog.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      737a460f
    • Jason Wessel's avatar
      kgdb: kgdboc pl011 I/O module · 84b5ae15
      Jason Wessel authored
      Implement the serial polling hooks for the pl011 uart for use with
      kgdboc.
      
      This patch was specifically tested on the ARM Versatile AB reference
      platform.
      
      [ mingo@elte.hu: minor cleanups. ]
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      84b5ae15
    • Jason Wessel's avatar
      kgdb: fix optional arch functions and probe_kernel_* · b4b8ac52
      Jason Wessel authored
      Fix two regressions dealing with the kgdb core.
      
      1) kgdb_skipexception and kgdb_post_primary_code are optional
      functions that are only required on archs that need special exception
      fixups.
      
      2) The kernel address space scope must be set on any probe_kernel_*
      function or archs such as ARCH=arm will not allow access to the kernel
      memory space.  As an example, it is required to allow the full kernel
      address space is when you the kernel debugger to inspect a system
      call.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b4b8ac52
    • Jason Wessel's avatar
      kgdb: add x86 HW breakpoints · 64e9ee30
      Jason Wessel authored
      Add HW breakpoints into the arch specific portion of x86 kgdb.  In the
      current x86 kernel.org kernels HW breakpoints are changed out in lazy
      fashion because there is no infrastructure around changing them when
      changing to a kernel task or entering the kernel mode via a system
      call.  This lazy approach means that if a user process uses HW
      breakpoints the kgdb will loose out.  This is an acceptable trade off
      because the developer debugging the kernel is assumed to know what is
      going on system wide and would be aware of this trade off.
      
      There is a minor bug fix to the kgdb core so as to correctly call the
      hw breakpoint functions with a valid value from the enum.
      
      There is also a minor change to the x86_64 startup code when using
      early HW breakpoints.  When the debugger is connected, the cpu startup
      code must not zero out the HW breakpoint registers or you cannot hit
      the breakpoints you are interested in, in the first place.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      64e9ee30
    • Jason Wessel's avatar
      kgdb: print breakpoint removed on exception · 67baf94c
      Jason Wessel authored
      If kgdb does remove a breakpoint that had a problem on the recursion
      check, it should also print the address of the breakpoint.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      67baf94c
    • Jason Wessel's avatar
      kgdb: clocksource watchdog · 7c3078b6
      Jason Wessel authored
      In order to not trip the clocksource watchdog, kgdb must touch the
      clocksource watchdog on the return to normal system run state.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7c3078b6
    • Jason Wessel's avatar
      kgdb: fix NMI hangs · d3597524
      Jason Wessel authored
      This patch fixes the hang regression with kgdb when the NMI interrupt
      comes in while the master core is returning from an exception.
      
      Adjust the NMI logic such that KGDB will not stop NMI exceptions from
      occurring by in general returning NOTIFY_DONE.  It is not possible to
      distinguish the debug NMI sync vs the normal NMI apic interrupt so
      kgdb needs to catch the unknown NMI if it the debugger was previously
      active on one of the cpus.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d3597524
    • Jason Wessel's avatar
      kgdb: fix kgdboc dynamic module configuration · c191e5ad
      Jason Wessel authored
      Fix the run time configuration of kgdboc such that it does not default
      to 9600 baud if you use the "echo" command to configure the sysfs
      module paramater.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c191e5ad
    • Jason Wessel's avatar
      kgdb: document parameters · 6cdf6e06
      Jason Wessel authored
      document the kgdboc module/boot parameter.
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@web.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6cdf6e06