Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932134Ab0BLXGA (ORCPT ); Fri, 12 Feb 2010 18:06:00 -0500 Received: from xenotime.net ([72.52.64.118]:57322 "HELO xenotime.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755964Ab0BLXF5 (ORCPT ); Fri, 12 Feb 2010 18:05:57 -0500 Message-ID: <4B75DED3.1070407@xenotime.net> Date: Fri, 12 Feb 2010 15:05:55 -0800 From: Randy Dunlap Organization: YPO4 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-3.fc11 Thunderbird/3.0 MIME-Version: 1.0 To: Jason Wessel CC: linux-kernel@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, mingo@elte.hu Subject: Re: [PATCH 6/7] kgdb,docs: Update the kgdb docs to include kms References: <1266014188-29505-1-git-send-email-jason.wessel@windriver.com> <1266014188-29505-7-git-send-email-jason.wessel@windriver.com> In-Reply-To: <1266014188-29505-7-git-send-email-jason.wessel@windriver.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9102 Lines: 206 On 02/12/10 14:36, Jason Wessel wrote: > Update the kgdb docs to include information about kernel mode setting support. > > Signed-off-by: Jason Wessel > --- > Documentation/DocBook/kgdb.tmpl | 82 +++++++++++++++++++++++++++++++---- > Documentation/kernel-parameters.txt | 9 +++- > 2 files changed, 79 insertions(+), 12 deletions(-) > > diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl > index cc81879..498267b 100644 > --- a/Documentation/DocBook/kgdb.tmpl > +++ b/Documentation/DocBook/kgdb.tmpl > @@ -200,12 +200,29 @@ > only make use of kgdbwait and early debugging > if you build kgdboc into the kernel as a builtins. > > + 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 > + enter the debugger on the graphics console. When the kernel > + execution is resumed, the graphics previous graphics mode will get drop first "graphics" above ... mode will be > + restored. This integration can serve as a useful tool to aid in > + dianosing crashes or doing analysis of memory with kdb while diagnosing > + allowing the full graphics console applications to run. > + > > kgdboc arguments > - Usage: kgdboc=[kbd][[,]serial_device][,baud] > - 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. > + Usage: kgdboc=[kms][[,]kbd][[,]serial_device][,baud] > + Abreviations: > + > + kms = Kernel Mode Setting > + kbd = Keyboard > + > + > + 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 usful combination. useful > > kdb and kgdb over only a serial port > kgdboc=<serial_device>[,baud] > @@ -218,6 +235,12 @@ > kdb with a keyboard > kgdboc=kbd > > + kdb with kernel modesetting > + kgdboc=kms,kbd > + > + kdb with kernel modesetting and kgdb over a serial port > + kgdboc=kbd,kbd,ttyS0,115200 > + > > > You can configure kgdboc via sysfs or a module or kernel boot line > @@ -613,6 +636,8 @@ Task Addr Pid Parent [*] cpu State Thread Command > The logic to perform safe memory reads and writes to memory while using the debugger > A full implementation for software breakpoints unless overridden by the arch > The API to invoke either the kdb or kgdb frontend to the debug core. > + The structures and call back API for atomic kernel mode setting. callback > + NOTE: kgdboc is where the kms callbacks are invoked. > > > > @@ -721,6 +746,8 @@ Task Addr Pid Parent [*] cpu State Thread Command > > > kgdboc internals > + > + kgdboc and uarts > > The kgdboc driver is actually a very thin driver that relies on the > underlying low level to the hardware driver having "polling hooks" > @@ -729,10 +756,7 @@ Task Addr Pid Parent [*] cpu State Thread Command > low level uart hook for doing polled mode reading and writing of a I prefer UART, but, oh well. > single character while in an atomic context. When kgdb makes an I/O > request to the debugger, kgdboc invokes a call back in the serial > - core which in turn uses the call back in the uart driver. It is callback in the UART > - certainly possible to extend kgdboc to work with non-uart based non-UART-based > - consoles in the future. > - > + core which in turn uses the call back in the uart driver. callback > > When using kgdboc with a uart, the uart driver must implement two callbacks in the struct uart_ops. Example from drivers/8250.c: > #ifdef CONFIG_CONSOLE_POLL > @@ -746,9 +770,49 @@ Task Addr Pid Parent [*] cpu State Thread Command > that they can be called from an atomic context and have to restore > the state of the uart chip on return such that the system can return > to normal when the debugger detaches. You need to be very careful > - with any kind of lock you consider, because failing here is most > + with any kind of lock you consider, because failing here is most likely > going to mean pressing the reset button. > > + > + > + kgdboc and keyboards > + The kgdboc driver contains logic to configure communications > + with an attached keyboard. The keyboard infrastructure is only > + compiled into the kernel when CONFIG_KDB_KEYBOARD=y is set in the > + kernel configuration. > + The core polled keyboard driver driver for PS/2 type keyboards > + is in drivers/char/kdb_keyboard.c. This driver is hooked into the > + debug core when kgdboc populates the callback in the arrary array > + called kdb_poll_funcs[]. The > + kdb_get_kbd_char() is the top level function which polls hardware top-level > + for single character input. > + > + > + > + kgdboc and kms > + The kgdboc driver contains logic to request the grpahics graphics > + display to switch to a text context if you are using > + kgdboc=kms,... and you have a video driver which has a framebuffer > + console and atomic kernel mode setting support. Every time kernel > + debugger is entered it calls kgdboc_pre_exp_handler() which in turn > + calls dbg_kms_ops->activate_console(). On resuming kernel > + execution, the kernel debugger calls kgdboc_post_exp_handler() which > + in turn calls dbg_kms_ops->restore_console(). > + Any video driver that wants to be compatible with the kernel > + debugger and the atomic kms callbacks must implement the > + mode_set_base_atomic operation. The following is an example from > + drivers/gpu/drm/i915/intel_display.c: > + > + > +static const struct drm_crtc_helper_funcs intel_helper_funcs = { > +[...] > + .mode_set_base_atomic = intel_pipe_set_base_atomic, > +[...] > +}; > + > + > + > + > > > > diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt > index af8b8e8..b340445 100644 > --- a/Documentation/kernel-parameters.txt > +++ b/Documentation/kernel-parameters.txt > @@ -1106,9 +1106,12 @@ and is between 256 and 4096 characters. It is defined in the file > kgdboc= [KGDB,HW] kgdb over consoles. > Requires a tty driver that supports console polling, > or a supported polling keyboard driver (non-usb). > - Serial only format: [,baud] > - keyboard only format: kbd > - keyboard and serial format: kbd,[,baud] > + Serial only format: [,baud] > + keyboard only format: kbd > + keyboard and serial format: kbd,[,baud] > + Optional Kernal mode setting: Kernel > + kms, kbd format: kms,kbd > + kms, kbd and serial format: kms,kbd,[,baud] > > kgdbwait [KGDB] Stop kernel execution and enter the > kernel debugger at the earliest opportunity if -- ~Randy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/