1. 30 1月, 2010 2 次提交
    • J
      perf, hw_breakpoint, kgdb: Do not take mutex for kernel debugger · 5352ae63
      Jason Wessel 提交于
      This patch fixes the regression in functionality where the
      kernel debugger and the perf API do not nicely share hw
      breakpoint reservations.
      
      The kernel debugger cannot use any mutex_lock() calls because it
      can start the kernel running from an invalid context.
      
      A mutex free version of the reservation API needed to get
      created for the kernel debugger to safely update hw breakpoint
      reservations.
      
      The possibility for a breakpoint reservation to be concurrently
      processed at the time that kgdb interrupts the system is
      improbable. Should this corner case occur the end user is
      warned, and the kernel debugger will prohibit updating the
      hardware breakpoint reservations.
      
      Any time the kernel debugger reserves a hardware breakpoint it
      will be a system wide reservation.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: kgdb-bugreport@lists.sourceforge.net
      Cc: K.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: torvalds@linux-foundation.org
      LKML-Reference: <1264719883-7285-3-git-send-email-jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5352ae63
    • J
      x86, hw_breakpoints, kgdb: Fix kgdb to use hw_breakpoint API · cc096749
      Jason Wessel 提交于
      In the 2.6.33 kernel, the hw_breakpoint API is now used for the
      performance event counters.  The hw_breakpoint_handler() now
      consumes the hw breakpoints that were previously set by kgdb
      arch specific code.  In order for kgdb to work in conjunction
      with this core API change, kgdb must use some of the low level
      functions of the hw_breakpoint API to install, uninstall, and
      deal with hw breakpoint reservations.
      
      The kgdb core required a change to call kgdb_disable_hw_debug
      anytime a slave cpu enters kgdb_wait() in order to keep all the
      hw breakpoints in sync as well as to prevent hitting a hw
      breakpoint while kgdb is active.
      
      During the architecture specific initialization of kgdb, it will
      pre-allocate 4 disabled (struct perf event **) structures.  Kgdb
      will use these to manage the capabilities for the 4 hw
      breakpoint registers, per cpu.  Right now the hw_breakpoint API
      does not have a way to ask how many breakpoints are available,
      on each CPU so it is possible that the install of a breakpoint
      might fail when kgdb restores the system to the run state.  The
      intent of this patch is to first get the basic functionality of
      hw breakpoints working and leave it to the person debugging the
      kernel to understand what hw breakpoints are in use and what
      restrictions have been imposed as a result.  Breakpoint
      constraints will be dealt with in a future patch.
      
      While atomic, the x86 specific kgdb code will call
      arch_uninstall_hw_breakpoint() and arch_install_hw_breakpoint()
      to manage the cpu specific hw breakpoints.
      
      The net result of these changes allow kgdb to use the same pool
      of hw_breakpoints that are used by the perf event API, but
      neither knows about future reservations for the available hw
      breakpoint slots.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: kgdb-bugreport@lists.sourceforge.net
      Cc: K.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: torvalds@linux-foundation.org
      LKML-Reference: <1264719883-7285-2-git-send-email-jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cc096749
  2. 11 12月, 2009 3 次提交
    • J
      kgdb,x86: do not set kgdb_single_step on x86 · 8097551d
      Jason Wessel 提交于
      On an SMP system the kgdb_single_step flag has the possibility to
      indefinitely hang the system in the case.  Consider the case where,
      CPU 1 has the schedule lock and CPU 0 is set to single step, there is
      no way for CPU 0 to run another task.
      
      The easy way to observe the problem is to make 2 cpus busy, and run
      the kgdb test suite.  You will see that it hangs the system very
      quickly.
      
      while [ 1 ] ; do find /proc > /dev/null 2>&1 ; done &
      while [ 1 ] ; do find /proc > /dev/null 2>&1 ; done &
      echo V1 > /sys/module/kgdbts/parameters/kgdbts
      
      The side effect of this patch is that there is the possibility
      to miss a breakpoint in the case that a single step operation
      was executed to step over a breakpoint in common code.
      
      The trade off of the missed breakpoint is preferred to
      hanging the kernel.  This can be fixed in the future by
      using kprobes or another strategy to step over planted
      breakpoints with out of line execution.
      
      CC: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      8097551d
    • J
      kgdb,i386: Fix corner case access to ss with NMI watch dog exception · cf6f196d
      Jason Wessel 提交于
      It is possible for the user_mode_vm(regs) check to return true on the
      i368 arch for a non master kgdb cpu or when the master kgdb cpu
      handles the NMI watch dog exception.
      
      The solution is simply to select the correct gdb_ss location
      based on the check to user_mode_vm(regs).
      
      CC: Ingo Molnar <mingo@elte.hu>
      Acked-by: NH. Peter Anvin <hpa@zytor.com>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      cf6f196d
    • R
      kgdb,x86: remove redundant test · a5d09d68
      Roel Kluin 提交于
      The for loop starts with a breakno of 0, and ends when it's 4. so
      this test is always true.
      Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      a5d09d68
  3. 13 10月, 2009 1 次提交
    • H
      x86: use kernel_stack_pointer() in kgdb.c · 5ca6c0ca
      H. Peter Anvin 提交于
      The way to obtain a kernel-mode stack pointer from a struct
      pt_regs in 32-bit mode is "subtle": the stack doesn't actually
      contain the stack pointer, but rather the location where it would
      have been marks the actual previous stack frame.  For clarity, use
      kernel_stack_pointer() instead of coding this weirdness
      explicitly.
      Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      5ca6c0ca
  4. 03 6月, 2009 1 次提交
  5. 15 5月, 2009 1 次提交
  6. 11 5月, 2009 1 次提交
  7. 18 2月, 2009 1 次提交
  8. 29 1月, 2009 2 次提交
  9. 07 10月, 2008 1 次提交
  10. 26 9月, 2008 2 次提交
    • J
      kgdb, x86_64: fix PS CS SS registers in gdb serial · 703a1edc
      Jason Wessel 提交于
      On x86_64 the gdb serial register structure defines the PS (also known
      as eflags), CS and SS registers as 4 bytes entities.
      
      This patch splits the x86_64 regnames enum into a 32 and 64 version to
      account for the 32 bit entities in the gdb serial packets.
      
      Also the program counter is properly filled in for the sleeping
      threads.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      703a1edc
    • J
      kgdb, x86, arm, mips, powerpc: ignore user space single stepping · d7161a65
      Jason Wessel 提交于
      On the x86 arch, user space single step exceptions should be ignored
      if they occur in the kernel space, such as ptrace stepping through a
      system call.
      
      First check if it is kgdb that is executing a single step, then ensure
      it is not an accidental traversal into the user space, while in kgdb,
      any other time the TIF_SINGLESTEP is set, kgdb should ignore the
      exception.
      
      On x86, arm, mips and powerpc, the kgdb_contthread usage was
      inconsistent with the way single stepping is implemented in the kgdb
      core.  The arch specific stub should always set the
      kgdb_cpu_doing_single_step correctly if it is single stepping.  This
      allows kgdb to correctly process an instruction steps if ptrace
      happens to be requesting an instruction step over a system call.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      d7161a65
  11. 20 4月, 2008 1 次提交
  12. 19 4月, 2008 1 次提交
  13. 18 4月, 2008 4 次提交
    • J
      kgdb: fix several kgdb regressions · 737a460f
      Jason Wessel 提交于
      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: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      737a460f
    • J
      kgdb: add x86 HW breakpoints · 64e9ee30
      Jason Wessel 提交于
      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: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      64e9ee30
    • J
      kgdb: fix NMI hangs · d3597524
      Jason Wessel 提交于
      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: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d3597524
    • I
      x86: kgdb support · 82da3ff8
      Ingo Molnar 提交于
      simplified and streamlined kgdb support on x86, both 32-bit and 64-bit,
      based on patch from:
      
        Subject: kgdb: core-lite
        From: Jason Wessel <jason.wessel@windriver.com>
      
      [ and countless other authors - see the patch for details. ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NJan Kiszka <jan.kiszka@web.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      82da3ff8