public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] dynamic_debug: Add config option of DYNAMIC_DEBUG_CORE
@ 2020-03-18 19:03 Orson Zhai
  2020-03-18 19:23 ` Andy Shevchenko
  2020-03-18 21:18 ` Jason Baron
  0 siblings, 2 replies; 9+ messages in thread
From: Orson Zhai @ 2020-03-18 19:03 UTC (permalink / raw)
  To: Jason Baron, Andrew Morton, Changbin Du, Randy Dunlap,
	Masahiro Yamada, Shuah Khan, Krzysztof Kozlowski,
	Masami Hiramatsu, Brendan Higgins, Herbert Xu, Ard Biesheuvel,
	Gary Hook, Andy Shevchenko, David Gow, Mark Rutland
  Cc: orsonzhai, linux-kernel, kernel-team, Orson Zhai

There is the requirement from new Android that kernel image (GKI) and
kernel modules are supposed to be built at differnet places. Some people
want to enable dynamic debug for kernel modules only but not for kernel
image itself with the consideration of binary size increased or more
memory being used.

By this patch, dynamic debug is divided into core part (the defination of
functions) and macro replacement part. We can only have the core part to
be built-in and do not have to activate the debug output from kenrel image.

Signed-off-by: Orson Zhai <orson.unisoc@gmail.com>
---
 include/linux/dynamic_debug.h |  2 +-
 lib/Kconfig.debug             | 18 ++++++++++++++++--
 lib/Makefile                  |  2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 4cf02ec..abcd5fd 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -48,7 +48,7 @@ struct _ddebug {
 
 
 
-#if defined(CONFIG_DYNAMIC_DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG_CORE)
 int ddebug_add_module(struct _ddebug *tab, unsigned int n,
 				const char *modname);
 extern int ddebug_remove_module(const char *mod_name);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 69def4a..78a7256 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -97,8 +97,7 @@ config BOOT_PRINTK_DELAY
 config DYNAMIC_DEBUG
 	bool "Enable dynamic printk() support"
 	default n
-	depends on PRINTK
-	depends on DEBUG_FS
+	select DYNAMIC_DEBUG_CORE
 	help
 
 	  Compiles debug level messages into the kernel, which would not
@@ -164,6 +163,21 @@ config DYNAMIC_DEBUG
 	  See Documentation/admin-guide/dynamic-debug-howto.rst for additional
 	  information.
 
+config DYNAMIC_DEBUG_CORE
+	bool "Enable core functions of dynamic debug support"
+	depends on PRINTK
+	depends on DEBUG_FS
+	help
+	  Enable this option to build ddebug_* and __dynamic_* routines
+	  into kernel. If you want enable whole dynamic debug features,
+	  select CONFIG_DYNAMIC_DEBUG directly and this option will be
+	  automatically selected.
+
+	  This option is selected when you want to enable dynamic debug
+	  for kernel modules only but not for the kernel base. Especailly
+	  in the case that kernel modules are built out of the place where
+	  kernel base is built.
+
 config SYMBOLIC_ERRNAME
 	bool "Support symbolic error names in printf"
 	default y if PRINTK
diff --git a/lib/Makefile b/lib/Makefile
index 611872c..2096d83 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -183,7 +183,7 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o
 
 obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
 
-obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o
+obj-$(CONFIG_DYNAMIC_DEBUG_CORE) += dynamic_debug.o
 obj-$(CONFIG_SYMBOLIC_ERRNAME) += errname.o
 
 obj-$(CONFIG_NLATTR) += nlattr.o
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-21  4:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-18 19:03 [RFC PATCH] dynamic_debug: Add config option of DYNAMIC_DEBUG_CORE Orson Zhai
2020-03-18 19:23 ` Andy Shevchenko
2020-03-18 20:11   ` Orson Zhai
2020-03-18 20:12     ` Joe Perches
2020-03-18 21:18 ` Jason Baron
2020-03-19 15:28   ` Orson Zhai
2020-03-19 20:19     ` Jason Baron
2020-03-20 18:30       ` Orson Zhai
2020-03-21  4:25   ` Orson Zhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox