Skip to contentSkip to conversation

kgdb light, v7

GIT PULL Ingo Molnar 3 participants 5 messages Feb 10, 2008 – Feb 11, 2008

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

this is -v7 of the KGDB-light tree, which can be pulled from:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb.git

Find the shortlog, the diffstat and the combo patch below.

Changes since -v6: lots of cleanups all around the place, based on the review feedback from:

- Bartlomiej Zolnierkiewicz
- Sam Ravnborg
- Linus Torvalds
- Christoph Hellwig
- Marcin Slusarz
- Thomas Gleixner

memory handling is a lot cleaner, the include files and Kconfig have been further cleaned up, and the code flow in kernel/kgdb.c has been cleaned up as well - and a zillion of other small details.

thanks guys!

It builds/boots/works on 32-bit and 64-bit x86 as well, and it passed allnoconfig, allyesconfig and allmodconfig tests.

Ingo

------------------>
Ingo Molnar (3):
pids: add pid_max prototype
uaccess: add probe_kernel_write()
x86: kgdb support

Jason Wessel (3):
kgdb: core
consoles: polling support, kgdboc
kgdb: document parameters

 Documentation/kernel-parameters.txt |    5 +
 arch/x86/Kconfig                    |    2 +
 arch/x86/kernel/Makefile            |    1 +
 arch/x86/kernel/kgdb.c              |  654 +++++++++++++
 drivers/char/tty_io.c               |   47 +
 drivers/serial/8250.c               |   58 ++
 drivers/serial/Kconfig              |    3 +
 drivers/serial/Makefile             |    1 +
 drivers/serial/kgdboc.c             |  163 +++
 drivers/serial/serial_core.c        |   70 ++-
 include/asm-x86/kgdb.h              |   81 ++
 include/linux/kgdb.h                |  314 ++++++
 include/linux/pid.h                 |    2 +
 include/linux/serial_core.h         |    4 +
 include/linux/tty_driver.h          |   12 +
 include/linux/uaccess.h             |   22 +
 kernel/Makefile                     |    1 +
 kernel/kgdb.c                       | 1838 +++++++++++++++++++++++++++++++++++
 kernel/sysctl.c                     |    2 +-
 lib/Kconfig.debug                   |    2 +
 lib/Kconfig.kgdb                    |   40 +
 mm/Makefile                         |    2 +-
 mm/maccess.c                        |   49 +
 23 files changed, 3368 insertions(+), 5 deletions(-)
 create mode 100644 arch/x86/kernel/kgdb.c
 create mode 100644 drivers/serial/kgdboc.c
 create mode 100644 include/asm-x86/kgdb.h
 create mode 100644 include/linux/kgdb.h
 create mode 100644 kernel/kgdb.c
 create mode 100644 lib/Kconfig.kgdb
 create mode 100644 mm/maccess.c
Documentation/kernel-parameters.txt +5 -0
index a4fc7fc..6e97307 100644
@@ -930,6 +930,11 @@ and is between 256 and 4096 characters. It is defined in the file
 	kstack=N	[X86-32,X86-64] Print N words from the kernel stack
 			in oops dumps.
 
+	kgdboc=		[HW] kgdb over consoles.
+			Requires a tty driver that supports console polling.
+			(only serial suported for now)
+			Format: <serial_device>[,baud]
+
 	l2cr=		[PPC]
 
 	lapic		[X86-32,APIC] Enable the local APIC even if BIOS
arch/x86/Kconfig +2 -0
index aaed1a3..5e0fab5 100644
@@ -14,6 +14,7 @@ config X86_32
 
 config X86_64
 	def_bool 64BIT
+	select HAVE_ARCH_KGDB_SHADOW_INFO
 
 ### Arch settings
 config X86
@@ -21,6 +22,7 @@ config X86
 	select HAVE_IDE
 	select HAVE_OPROFILE
 	select HAVE_KPROBES
+	select HAVE_ARCH_KGDB
 
 config GENERIC_LOCKBREAK
 	def_bool n
arch/x86/kernel/Makefile +1 -0
index 76ec0f8..4cd39cd 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_MODULES)		+= module_$(BITS).o
 obj-$(CONFIG_ACPI_SRAT) 	+= srat_32.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_$(BITS).o efi_stub_$(BITS).o
 obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault_32.o
+obj-$(CONFIG_KGDB)		+= kgdb.o
 obj-$(CONFIG_VM86)		+= vm86_32.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
arch/x86/kernel/kgdb.c new file +654 -0

654 lines not on this page · raw message

drivers/char/tty_io.c +47 -0

59 lines not on this page · raw message

drivers/serial/8250.c +58 -0

70 lines not on this page · raw message

drivers/serial/Kconfig +3 -0
index b82595c..5d9667c 100644
@@ -961,6 +961,9 @@ config SERIAL_CORE
 config SERIAL_CORE_CONSOLE
 	bool
 
+config CONSOLE_POLL
+	bool
+
 config SERIAL_68328
 	bool "68328 serial support"
 	depends on M68328 || M68EZ328 || M68VZ328
drivers/serial/Makefile +1 -0
index 640cfe4..3cbea54 100644
@@ -66,4 +66,5 @@ obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
 obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
 obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
+obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
drivers/serial/kgdboc.c new file +163 -0

163 lines not on this page · raw message

drivers/serial/serial_core.c +67 -3

100 lines not on this page · raw message

include/asm-x86/kgdb.h new file +81 -0

81 lines not on this page · raw message

include/linux/kgdb.h new file +314 -0

314 lines not on this page · raw message

include/linux/pid.h +2 -0
index f84d532..e066d3d 100644
@@ -86,6 +86,8 @@ extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
 
 extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
 
+extern int pid_max;
+
 /*
  * attach_pid() and detach_pid() must be called with the tasklist_lock
  * write-held.
include/linux/serial_core.h +4 -0
index 1a0b6cf..7d1a46b 100644
@@ -211,6 +211,10 @@ struct uart_ops {
 	void		(*config_port)(struct uart_port *, int);
 	int		(*verify_port)(struct uart_port *, struct serial_struct *);
 	int		(*ioctl)(struct uart_port *, unsigned int, unsigned long);
+#ifdef CONFIG_CONSOLE_POLL
+	void	(*poll_put_char)(struct uart_port *, unsigned char);
+	int		(*poll_get_char)(struct uart_port *);
+#endif
 };
 
 #define UART_CONFIG_TYPE	(1 << 0)
include/linux/tty_driver.h +12 -0
index 85c95cd..21f69ac 100644
@@ -125,6 +125,7 @@
 #include <linux/cdev.h>
 
 struct tty_struct;
+struct tty_driver;
 
 struct tty_operations {
 	int  (*open)(struct tty_struct * tty, struct file * filp);
@@ -157,6 +158,11 @@ struct tty_operations {
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
 			unsigned int set, unsigned int clear);
+#ifdef CONFIG_CONSOLE_POLL
+	int (*poll_init)(struct tty_driver *driver, int line, char *options);
+	int (*poll_get_char)(struct tty_driver *driver, int line);
+	void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
+#endif
 };
 
 struct tty_driver {
@@ -220,6 +226,11 @@ struct tty_driver {
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
 			unsigned int set, unsigned int clear);
+#ifdef CONFIG_CONSOLE_POLL
+	int (*poll_init)(struct tty_driver *driver, int line, char *options);
+	int (*poll_get_char)(struct tty_driver *driver, int line);
+	void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
+#endif
 
 	struct list_head tty_drivers;
 };
@@ -230,6 +241,7 @@ struct tty_driver *alloc_tty_driver(int lines);
 void put_tty_driver(struct tty_driver *driver);
 void tty_set_operations(struct tty_driver *driver,
 			const struct tty_operations *op);
+extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
 
 /* tty driver magic number */
 #define TTY_DRIVER_MAGIC		0x5402
include/linux/uaccess.h +22 -0
index 975c963..fec6dec 100644
@@ -84,4 +84,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
 		ret;					\
 	})
 
+/*
+ * probe_kernel_read(): safely attempt to read from a location
+ * @dst: pointer to the buffer that shall take the data
+ * @src: address to read from
+ * @size: size of the data chunk
+ *
+ * Safely read from address @src to the buffer at @dst.  If a kernel fault
+ * happens, handle that and return -EFAULT.
+ */
+extern long probe_kernel_read(void *dst, void *src, size_t size);
+
+/*
+ * probe_kernel_write(): safely attempt to write to a location
+ * @dst: address to write to
+ * @src: pointer to the data that shall be written
+ * @size: size of the data chunk
+ *
+ * Safely write to address @dst from the buffer at @src.  If a kernel fault
+ * happens, handle that and return -EFAULT.
+ */
+extern long probe_kernel_write(void *dst, void *src, size_t size);
+
 #endif		/* __LINUX_UACCESS_H__ */
kernel/Makefile +1 -0
index 6c584c5..05c8003 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
 obj-$(CONFIG_AUDIT_TREE) += audit_tree.o
 obj-$(CONFIG_KPROBES) += kprobes.o
+obj-$(CONFIG_KGDB) += kgdb.o
 obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o
 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
 obj-$(CONFIG_SECCOMP) += seccomp.o
kernel/kgdb.c new file +1838 -0

1,426 lines not on this page · raw message

kernel/sysctl.c +1 -1
index d41ef6b..97a152c 100644

Lines of this file are not shown. View the raw message.

lib/Kconfig.debug +2 -0
index a370fe8..a904916 100644

Lines of this file are not shown. View the raw message.

lib/Kconfig.kgdb new file +40 -0
new file mode 100644
index 0000000..a739e9d

Lines of this file are not shown. View the raw message.

mm/Makefile +1 -1
index 9f117ba..fb9e7ac 100644

Lines of this file are not shown. View the raw message.

mm/maccess.c new file +49 -0

49 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 4 lines · Ingo Molnar

this is -v7 of the KGDB-light tree, which can be pulled from:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb.git

my git hangs on this..

-----[ Domenico Andreoli, aka cavok
--[ http://www.dandreoli.com/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

#2 lore raw
Quoted 6 lines · Domenico Andreoli
Quoted 3 lines · Ingo Molnar

this is -v7 of the KGDB-light tree, which can be pulled from:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb.git

my git hangs on this..

Just booting? Or using the debugger? If the former: does switching KGDB off in the config solve it?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 10 lines · Jan Kiszka
Quoted 6 lines · Domenico Andreoli
Quoted 3 lines · Ingo Molnar

this is -v7 of the KGDB-light tree, which can be pulled from:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb.git

my git hangs on this..

Just booting? Or using the debugger? If the former: does switching KGDB off in the config solve it?

sorry, git pull was hanging. it looks somewhat related to the kernel version (debian 2.6.24-3), rebooting did not cure it.

i had also many problems with ssh, many (but not all) were hanging. moreover X was very sluggish, as well as the network. now i am back to debian 2.6.23-2 and everything works correctly. odd.

regards,
Domenico

-----[ Domenico Andreoli, aka cavok
--[ http://www.dandreoli.com/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

#4 lore raw
In reply to Jan Kiszka
Quoted 10 lines · Jan Kiszka
Quoted 6 lines · Domenico Andreoli
Quoted 3 lines · Ingo Molnar

this is -v7 of the KGDB-light tree, which can be pulled from:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-kgdb.git

my git hangs on this..

Just booting? Or using the debugger? If the former: does switching KGDB off in the config solve it?

heh - i suspect what he meant is that his user-space git pull/clone is hanging on that repository :)

transient failures sometimes happen - the cloning should be re-tried.

Ingo