login
Header Space

 
 

[RFC][PATCH] modular kgdb-light (was: Re: [git pull] kgdb-light -v10)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andi Kleen <andi@...>
Cc: Linus Torvalds <torvalds@...>, Ingo Molnar <mingo@...>, <linux-kernel@...>, Frank Ch. Eigler <fche@...>, Roland McGrath <roland@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>, Andrew Morton <akpm@...>, Jason Wessel <jason.wessel@...>, Jan Kiszka <jan.kiszka@...>
Date: Friday, February 15, 2008 - 8:35 am

Andi Kleen wrote:

To pick up this idea again I did the experimental patch below. It
applies against Jason's latest kgdb-light patch queue:

http://git.kernel.org/?p=linux/kernel/git/jwessel/linux-2.6-kgdb.git;a=shortlog;h=for_...

The patch nicely demonstrates what deeper dependencies on kernel
services currently exist in kgdb-light. The following symbols were
unresolvable:

 o genapic - for send_IPI_allbutself, ie. CPU roundup
 o machine_emergency_restart - for implementing "R0" gdb packet
 o idle_task - kgdb tells the per-cpu idle tasks apart
 o clocksource_touch_watchdog - obvious

For simplicity reasons I just gpl-exported all of them. The result is
a fully modular kgdb that may help to reduce concerns regarding its
intrusiveness.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

---
 arch/x86/kernel/Makefile               |    4 +++-
 arch/x86/kernel/genapic_64.c           |    1 +
 arch/x86/kernel/{kgdb.c => kgdb-x86.c} |    0 
 arch/x86/kernel/reboot.c               |    1 +
 arch/x86/mach-generic/probe.c          |    1 +
 kernel/Makefile                        |    1 -
 kernel/sched.c                         |    1 +
 kernel/time/clocksource.c              |    1 +
 lib/Kconfig.kgdb                       |    2 +-
 {kernel => lib}/kgdb.c                 |    8 ++++++--
 10 files changed, 15 insertions(+), 5 deletions(-)
 rename arch/x86/kernel/{kgdb.c => kgdb-x86.c} (100%)
 rename {kernel => lib}/kgdb.c (100%)

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 4cd39cd..2e733b1 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -58,7 +58,6 @@ 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
 
@@ -79,6 +78,9 @@ endif
 obj-$(CONFIG_SCx200)		+= scx200.o
 scx200-y			+= scx200_32.o
 
+kgdb-objs			:= ../../../lib/kgdb.o kgdb-x86.o
+obj-$(CONFIG_KGDB)		+= kgdb.o
+
 ###
 # 64 bit specific files
 ifeq ($(CONFIG_X86_64),y)
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 4ae7b64..d0518a7 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -32,6 +32,7 @@ DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID;
 EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
 
 struct genapic __read_mostly *genapic = &apic_flat;
+EXPORT_SYMBOL_GPL(genapic);
 
 /*
  * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb-x86.c
similarity index 100%
rename from arch/x86/kernel/kgdb.c
rename to arch/x86/kernel/kgdb-x86.c
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 5818dc2..66d7c27 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -375,6 +375,7 @@ void machine_emergency_restart(void)
 		}
 	}
 }
+EXPORT_SYMBOL_GPL(machine_emergency_restart);
 
 void machine_shutdown(void)
 {
diff --git a/arch/x86/mach-generic/probe.c b/arch/x86/mach-generic/probe.c
index f410d3c..4156d64 100644
--- a/arch/x86/mach-generic/probe.c
+++ b/arch/x86/mach-generic/probe.c
@@ -21,6 +21,7 @@ extern struct genapic apic_es7000;
 extern struct genapic apic_default;
 
 struct genapic *genapic = &apic_default;
+EXPORT_SYMBOL_GPL(genapic);
 
 static struct genapic *apic_probe[] __initdata = {
 	&apic_summit,
diff --git a/kernel/Makefile b/kernel/Makefile
index 05c8003..6c584c5 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -53,7 +53,6 @@ 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
diff --git a/kernel/sched.c b/kernel/sched.c
index 3eedd52..e2ffff4 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4463,6 +4463,7 @@ struct task_struct *idle_task(int cpu)
 {
 	return cpu_rq(cpu)->idle;
 }
+EXPORT_SYMBOL_GPL(idle_task);
 
 /**
  * find_process_by_pid - find a process with a matching PID value.
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index ace23d3..e83dc5d 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -238,6 +238,7 @@ void clocksource_touch_watchdog(void)
 {
 	clocksource_resume_watchdog();
 }
+EXPORT_SYMBOL_GPL(clocksource_touch_watchdog);
 
 /**
  * clocksource_get_next - Returns the selected clocksource
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb
index 9631ba3..413e3b8 100644
--- a/lib/Kconfig.kgdb
+++ b/lib/Kconfig.kgdb
@@ -1,6 +1,6 @@
 
 menuconfig KGDB
-	bool "KGDB: kernel debugging with remote gdb"
+	tristate "KGDB: kernel debugging with remote gdb"
 	select FRAME_POINTER
 	depends on HAVE_ARCH_KGDB
 	depends on DEBUG_KERNEL && EXPERIMENTAL
diff --git a/kernel/kgdb.c b/lib/kgdb.c
similarity index 100%
rename from kernel/kgdb.c
rename to lib/kgdb.c
index b516de0..2ef8e9d 100644
--- a/kernel/kgdb.c
+++ b/lib/kgdb.c
@@ -91,13 +91,14 @@ static int kgdb_con_registered;
 /* determine if kgdb console output should be used */
 static int kgdb_use_con;
 
+#ifdef CONFIG_KGDB
 static int __init opt_kgdb_con(char *str)
 {
 	kgdb_use_con = 1;
 	return 0;
 }
-
 early_param("kgdbcon", opt_kgdb_con);
+#endif
 
 module_param(kgdb_use_con, int, 0644);
 
@@ -1667,6 +1668,7 @@ void kgdb_breakpoint(void)
 }
 EXPORT_SYMBOL_GPL(kgdb_breakpoint);
 
+#ifdef CONFIG_KGDB
 static int __init opt_kgdb_wait(char *str)
 {
 	kgdb_break_asap = 1;
@@ -1676,5 +1678,7 @@ static int __init opt_kgdb_wait(char *str)
 
 	return 0;
 }
-
 early_param("kgdbwait", opt_kgdb_wait);
+#endif
+
+MODULE_LICENSE("GPL");

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
kgdb in git-x86#mm review, Andi Kleen, (Sun Feb 10, 9:53 pm)
Re: kgdb in git-x86#mm review, Mark Lord, (Mon Feb 11, 12:03 pm)
Re: kgdb in git-x86#mm review, Frank Ch. Eigler, (Mon Feb 11, 11:32 am)
Re: [git pull] kgdb-light -v8,, Jan Kiszka, (Mon Feb 11, 12:41 pm)
Re: [git pull] kgdb-light -v8,, Ingo Molnar, (Mon Feb 11, 12:54 pm)
[git pull] kgdb-light -v9, Ingo Molnar, (Mon Feb 11, 7:03 pm)
Re: [git pull] kgdb-light -v9, Andi Kleen, (Tue Feb 12, 6:03 am)
[git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 7:27 am)
Re: [git pull] kgdb-light -v10, Domenico Andreoli, (Tue Feb 12, 9:18 am)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Tue Feb 12, 9:59 am)
Re: [git pull] kgdb-light -v10, Domenico Andreoli, (Tue Feb 12, 11:45 am)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 8:19 am)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 8:38 am)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Tue Feb 12, 9:30 am)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 10:39 am)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Tue Feb 12, 10:35 am)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 11:36 am)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Tue Feb 12, 12:21 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 1:10 pm)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Tue Feb 12, 12:48 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 9:50 am)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 11:28 am)
Re: [git pull] kgdb-light -v10, Linus Torvalds, (Tue Feb 12, 12:46 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 2:20 pm)
Re: [git pull] kgdb-light -v10, Andrew Morton, (Tue Feb 12, 2:20 pm)
Re: [git pull] kgdb-light -v10, Frank Ch. Eigler, (Tue Feb 12, 3:34 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 4:16 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 3:16 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 5:01 pm)
Re: [git pull] kgdb-light -v10, Linus Torvalds, (Tue Feb 12, 2:11 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 3:22 pm)
Re: [git pull] kgdb-light -v10, Linus Torvalds, (Tue Feb 12, 3:01 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 1:01 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 1:10 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 12:11 pm)
Re: [git pull] kgdb-light -v10, Linus Torvalds, (Tue Feb 12, 12:25 pm)
Re: [git pull] kgdb-light -v10, Jason Wessel, (Fri Feb 15, 4:36 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 12:42 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 1:07 pm)
[RFC][PATCH] modular kgdb-light (was: Re: [git pull] kgdb-li..., Jan Kiszka, (Fri Feb 15, 8:35 am)
Re: [RFC][PATCH] modular kgdb-light, Jason Wessel, (Fri Feb 15, 4:24 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 12:24 pm)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 1:01 pm)
Re: [git pull] kgdb-light -v10, Ingo Molnar, (Tue Feb 12, 11:16 am)
Re: [git pull] kgdb-light -v10, Andi Kleen, (Tue Feb 12, 11:28 am)
Re: [git pull] kgdb-light -v9, Roland McGrath, (Tue Feb 12, 6:26 am)
Re: [git pull] kgdb-light -v9, Ingo Molnar, (Tue Feb 12, 6:34 am)
Re: [git pull] kgdb-light -v9, Sam Ravnborg, (Tue Feb 12, 5:35 am)
Re: kgdb in git-x86#mm review, Andi Kleen, (Mon Feb 11, 12:11 pm)
speck-geostationary