Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756867Ab0ANPCR (ORCPT ); Thu, 14 Jan 2010 10:02:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756870Ab0ANPCJ (ORCPT ); Thu, 14 Jan 2010 10:02:09 -0500 Received: from mail.windriver.com ([147.11.1.11]:47969 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756843Ab0ANPCF (ORCPT ); Thu, 14 Jan 2010 10:02:05 -0500 From: Jason Wessel To: linux-kernel@vger.kernel.org Cc: kgdb-bugreport@lists.sourceforge.net, mingo@elte.hu, Jason Wessel Subject: [PATCH 37/40] kgdb,docs: Update the kgdb docs to include kms Date: Thu, 14 Jan 2010 08:59:33 -0600 Message-Id: <1263481176-1897-38-git-send-email-jason.wessel@windriver.com> X-Mailer: git-send-email 1.6.3.1.9.g95405b In-Reply-To: <1263481176-1897-1-git-send-email-jason.wessel@windriver.com> References: <1263481176-1897-1-git-send-email-jason.wessel@windriver.com> X-OriginalArrivalTime: 14 Jan 2010 15:01:23.0491 (UTC) FILETIME=[70128F30:01CA952A] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8152 Lines: 168 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 ebae961..bbf4a22 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 + restored. This integration can serve as a useful tool to aid in + dianosing crashes or doing analysis of memory with kdb while + 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. 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 @@ -612,6 +635,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. + NOTE: kgdboc is where the kms callbacks are invoked. @@ -719,6 +744,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" @@ -727,10 +754,7 @@ Task Addr Pid Parent [*] cpu State Thread Command 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 call back in the serial - core which in turn uses the call back in the uart driver. It is - certainly possible to extend kgdboc to work with non-uart based - consoles in the future. - + core which in turn uses the call back in the uart driver. 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 @@ -744,9 +768,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 + called kdb_poll_funcs[]. The + kdb_get_kbd_char() is the top level function which polls hardware + for single character input. + + + + kgdboc and kms + The kgdboc driver contains logic to request the grpahics + 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_console_core->activate_console(). On resuming kernel + execution, the kernel debugger calls kgdboc_post_exp_handler() which + in turn calls dbg_kms_console_core->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: + 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 -- 1.6.3.1.9.g95405b -- 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/