Merge tag 'for_linux-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwess...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 Feb 2015 23:13:29 +0000 (15:13 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 Feb 2015 23:13:29 +0000 (15:13 -0800)
Pull kgdb/kdb updates from Jason Wessel:
 "KGDB/KDB New:
   - KDB: improved searching
   - No longer enter debug core on panic if panic timeout is set

  KGDB/KDB regressions / cleanups
   - fix pdf doc build errors
   - prevent junk characters on kdb console from printk levels"

* tag 'for_linux-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
  kgdb, docs: Fix <para> pdfdocs build errors
  debug: prevent entering debug mode on panic/exception.
  kdb: Const qualifier for kdb_getstr's prompt argument
  kdb: Provide forward search at more prompt
  kdb: Fix a prompt management bug when using | grep
  kdb: Remove stack dump when entering kgdb due to NMI
  kdb: Avoid printing KERN_ levels to consoles
  kdb: Fix off by one error in kdb_cpu()
  kdb: fix incorrect counts in KDB summary command output

1  2 
Documentation/DocBook/kgdb.tmpl
kernel/printk/printk.c

index 2428cc04dbc84b5f7243558296f6f36fa9621fb4,efca2a418d5bfcc06163d42945c805d63cc766fe..f3abca7ec53d62e4bd416da9f53395aef9269855
@@@ -75,7 -75,7 +75,7 @@@
      a development machine and the other is the target machine.  The
      kernel to be debugged runs on the target machine. The development
      machine runs an instance of gdb against the vmlinux file which
 -    contains the symbols (not boot image such as bzImage, zImage,
 +    contains the symbols (not boot image such as bzImage, zImage,
      uImage...).  In gdb the developer specifies the connection
      parameters and connects to kgdb.  The type of connection a
      developer makes with gdb depends on the availability of kgdb I/O
@@@ -95,7 -95,7 +95,7 @@@
      <title>Kernel config options for kgdb</title>
      <para>
      To enable <symbol>CONFIG_KGDB</symbol> you should look under
 -    "Kernel debugging" and select "KGDB: kernel debugger".
 +    "Kernel hacking" / "Kernel debugging" and select "KGDB: kernel debugger".
      </para>
      <para>
      While it is not a hard requirement that you have symbols in your
      kernel with debug info" in the config menu.
      </para>
      <para>
 -    It is advised, but not required that you turn on the
 +    It is advised, but not required, that you turn on the
      <symbol>CONFIG_FRAME_POINTER</symbol> kernel option which is called "Compile the
      kernel with frame pointers" in the config menu.  This option
      inserts code to into the compiled executable which saves the frame
    <para>This section describes the various runtime kernel
    parameters that affect the configuration of the kernel debugger.
    The following chapter covers using kdb and kgdb as well as
 -  provides some examples of the configuration parameters.</para>
 +  providing some examples of the configuration parameters.</para>
     <sect1 id="kgdboc">
     <title>Kernel parameter: kgdboc</title>
     <para>The kgdboc driver was originally an abbreviation meant to
     may be configured as a kernel built-in or a kernel loadable module.
     You can only make use of <constant>kgdbwait</constant> and early
     debugging if you build kgdboc into the kernel as a built-in.
+    </para>
     <para>Optionally you can elect to activate kms (Kernel Mode
     Setting) integration.  When you use kms with kgdboc and you have a
     video driver that has atomic mode setting hooks, it is possible to
     crashes or doing analysis of memory with kdb while allowing the
     full graphics console applications to run.
     </para>
-    </para>
     <sect2 id="kgdbocArgs">
     <title>kgdboc arguments</title>
     <para>Usage: <constant>kgdboc=[kms][[,]kbd][[,]serial_device][,baud]</constant></para>
     <listitem><para>kbd = Keyboard</para></listitem>
     </itemizedlist>
     </para>
 -   <para>You can configure kgdboc to use the keyboard, and or a serial
 -   device depending on if you are using kdb and or kgdb, in one of the
 +   <para>You can configure kgdboc to use the keyboard, and/or a serial
 +   device depending on if you are using kdb and/or kgdb, in one of the
     following scenarios.  The order listed above must be observed if
     you use any of the optional configurations together.  Using kms +
     only gdb is generally not a useful combination.</para>
     </sect3>
     <sect3 id="kgdbocArgs3">
     <title>More examples</title>
 -   <para>You can configure kgdboc to use the keyboard, and or a serial
 -   device depending on if you are using kdb and or kgdb, in one of the
 -   following scenarios.</para>
 -   <para>You can configure kgdboc to use the keyboard, and or a serial device
 -   depending on if you are using kdb and or kgdb, in one of the
 +   <para>You can configure kgdboc to use the keyboard, and/or a serial device
 +   depending on if you are using kdb and/or kgdb, in one of the
     following scenarios.
     <orderedlist>
     <listitem><para>kdb and kgdb over only a serial port</para>
     </listitem>
     </orderedlist>
     </para>
-    </sect3>
     <para>NOTE: Kgdboc does not support interrupting the target via the
     gdb remote protocol.  You must manually send a sysrq-g unless you
     have a proxy that splits console output to a terminal program.
      as well as on the initial connect, or to use a debugger proxy that
      allows an unmodified gdb to do the debugging.
     </para>
+    </sect3>
     </sect2>
     </sect1>
     <sect1 id="kgdbwait">
     <para>
     The Kernel command line option <constant>kgdbwait</constant> makes
     kgdb wait for a debugger connection during booting of a kernel.  You
 -   can only use this option you compiled a kgdb I/O driver into the
 +   can only use this option if you compiled a kgdb I/O driver into the
     kernel and you specified the I/O driver configuration as a kernel
     command line option.  The kgdbwait parameter should always follow the
     configuration parameter for the kgdb I/O driver in the kernel
     </para>
     </listitem>
     </orderedlist>
+   </para>
     <para>IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an
 -   active system console.  An example incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant>
 +   active system console.  An example of incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant>
     </para>
     <para>It is possible to use this option with kgdboc on a tty that is not a system console.
     </para>
-   </para>
    </sect1>
     <sect1 id="kgdbreboot">
     <title>Run time parameter: kgdbreboot</title>
    <title>Quick start for kdb on a serial port</title>
    <para>This is a quick example of how to use kdb.</para>
    <para><orderedlist>
 -  <listitem><para>Boot kernel with arguments:
 +  <listitem><para>Configure kgdboc at boot using kernel parameters:
    <itemizedlist>
    <listitem><para><constant>console=ttyS0,115200 kgdboc=ttyS0,115200</constant></para></listitem>
    </itemizedlist></para>
    <para>OR</para>
 -  <para>Configure kgdboc after the kernel booted; assuming you are using a serial port console:
 +  <para>Configure kgdboc after the kernel has booted; assuming you are using a serial port console:
    <itemizedlist>
    <listitem><para><constant>echo ttyS0 &gt; /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem>
    </itemizedlist>
    <title>Quick start for kdb using a keyboard connected console</title>
    <para>This is a quick example of how to use kdb with a keyboard.</para>
    <para><orderedlist>
 -  <listitem><para>Boot kernel with arguments:
 +  <listitem><para>Configure kgdboc at boot using kernel parameters:
    <itemizedlist>
    <listitem><para><constant>kgdboc=kbd</constant></para></listitem>
    </itemizedlist></para>
    <para>OR</para>
 -  <para>Configure kgdboc after the kernel booted:
 +  <para>Configure kgdboc after the kernel has booted:
    <itemizedlist>
    <listitem><para><constant>echo kbd &gt; /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem>
    </itemizedlist>
    <title>Connecting with gdb to a serial port</title>
    <orderedlist>
    <listitem><para>Configure kgdboc</para>
 -   <para>Boot kernel with arguments:
 +   <para>Configure kgdboc at boot using kernel parameters:
     <itemizedlist>
      <listitem><para><constant>kgdboc=ttyS0,115200</constant></para></listitem>
     </itemizedlist></para>
     <para>OR</para>
 -   <para>Configure kgdboc after the kernel booted:
 +   <para>Configure kgdboc after the kernel has booted:
     <itemizedlist>
      <listitem><para><constant>echo ttyS0 &gt; /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem>
     </itemizedlist></para>
    </para>
    </listitem>
    <listitem>
 -    <para>Connect from from gdb</para>
 +    <para>Connect from gdb</para>
      <para>
      Example (using a directly connected port):
      </para>
    <para>
    There are two ways to switch from kgdb to kdb: you can use gdb to
    issue a maintenance packet, or you can blindly type the command $3#33.
 -  Whenever kernel debugger stops in kgdb mode it will print the
 +  Whenever the kernel debugger stops in kgdb mode it will print the
    message <constant>KGDB or $3#33 for KDB</constant>.  It is important
    to note that you have to type the sequence correctly in one pass.
    You cannot type a backspace or delete because kgdb will interpret
@@@ -701,7 -704,7 +701,7 @@@ Task Addr       Pid   Parent [*] cpu St
        <listitem><para>Registration and unregistration of architecture specific trap hooks</para></listitem>
        <listitem><para>Any special exception handling and cleanup</para></listitem>
        <listitem><para>NMI exception handling and cleanup</para></listitem>
 -      <listitem><para>(optional)HW breakpoints</para></listitem>
 +      <listitem><para>(optional) HW breakpoints</para></listitem>
        </itemizedlist>
        </para>
        </listitem>
        a kgdb I/O driver for characters when it needs input.  The I/O
        driver is expected to return immediately if there is no data
        available.  Doing so allows for the future possibility to touch
 -      watch dog hardware in such a way as to have a target system not
 +      watchdog hardware in such a way as to have a target system not
        reset when these are enabled.
        </para>
        </listitem>
        their &lt;asm/kgdb.h&gt; file.  These are:
        <itemizedlist>
          <listitem>
 -        <para>
 -        NUMREGBYTES: The size in bytes of all of the registers, so
 -        that we can ensure they will all fit into a packet.
 -        </para>
 -        <para>
 -        BUFMAX: The size in bytes of the buffer GDB will read into.
 -        This must be larger than NUMREGBYTES.
 -        </para>
 -        <para>
 -        CACHE_FLUSH_IS_SAFE: Set to 1 if it is always safe to call
 -        flush_cache_range or flush_icache_range.  On some architectures,
 -        these functions may not be safe to call on SMP since we keep other
 -        CPUs in a holding pattern.
 -        </para>
 -      </listitem>
 +          <para>
 +          NUMREGBYTES: The size in bytes of all of the registers, so
 +          that we can ensure they will all fit into a packet.
 +          </para>
 +        </listitem>
 +        <listitem>
 +          <para>
 +          BUFMAX: The size in bytes of the buffer GDB will read into.
 +          This must be larger than NUMREGBYTES.
 +          </para>
 +        </listitem>
 +        <listitem>
 +          <para>
 +          CACHE_FLUSH_IS_SAFE: Set to 1 if it is always safe to call
 +          flush_cache_range or flush_icache_range.  On some architectures,
 +          these functions may not be safe to call on SMP since we keep other
 +          CPUs in a holding pattern.
 +          </para>
 +        </listitem>
        </itemizedlist>
        </para>
        <para>
    <para>
    The kgdboc driver is actually a very thin driver that relies on the
    underlying low level to the hardware driver having "polling hooks"
 -  which the to which the tty driver is attached.  In the initial
 -  implementation of kgdboc it the serial_core was changed to expose a
 +  to which the tty driver is attached.  In the initial
 +  implementation of kgdboc the serial_core was changed to expose a
    low level UART hook for doing polled mode reading and writing of a
    single character while in an atomic context.  When kgdb makes an I/O
    request to the debugger, kgdboc invokes a callback in the serial
diff --combined kernel/printk/printk.c
index c06df7de0963a3c82889c274dd2d707507d31d50,fae29e3ffbf027bfee7fbc6346b53bf76f8fce11..01cfd69c54c6772ad49a1d81120258f765f435a1
@@@ -935,8 -935,8 +935,8 @@@ static int __init ignore_loglevel_setup
  
  early_param("ignore_loglevel", ignore_loglevel_setup);
  module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
 -MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
 -      "print all kernel messages to the console.");
 +MODULE_PARM_DESC(ignore_loglevel,
 +               "ignore loglevel setting (prints all kernel messages to the console)");
  
  #ifdef CONFIG_BOOT_PRINTK_DELAY
  
@@@ -1419,16 -1419,16 +1419,16 @@@ static void call_console_drivers(int le
  }
  
  /*
 - * Zap console related locks when oopsing. Only zap at most once
 - * every 10 seconds, to leave time for slow consoles to print a
 - * full oops.
 + * Zap console related locks when oopsing.
 + * To leave time for slow consoles to print a full oops,
 + * only zap at most once every 30 seconds.
   */
  static void zap_locks(void)
  {
        static unsigned long oops_timestamp;
  
        if (time_after_eq(jiffies, oops_timestamp) &&
 -                      !time_after(jiffies, oops_timestamp + 30 * HZ))
 +          !time_after(jiffies, oops_timestamp + 30 * HZ))
                return;
  
        oops_timestamp = jiffies;
@@@ -1811,7 -1811,7 +1811,7 @@@ int vprintk_default(const char *fmt, va
  
  #ifdef CONFIG_KGDB_KDB
        if (unlikely(kdb_trap_printk)) {
-               r = vkdb_printf(fmt, args);
+               r = vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
                return r;
        }
  #endif