Add config LIVEPATCH_DEBUG and define DEBUG if CONFIG_LIVEPATCH_DEBUG
is set, then pr_debug() can print a debug level message, it is a easy
way to get debug information without dynamic debugging.

Signed-off-by: Tiezhu Yang <yangtie...@loongson.cn>
---
 kernel/livepatch/Kconfig      | 8 ++++++++
 kernel/livepatch/transition.c | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/kernel/livepatch/Kconfig b/kernel/livepatch/Kconfig
index 53d51ed619a3..4843665b1939 100644
--- a/kernel/livepatch/Kconfig
+++ b/kernel/livepatch/Kconfig
@@ -18,3 +18,11 @@ config LIVEPATCH
          module uses the interface provided by this option to register
          a patch, causing calls to patched functions to be redirected
          to new function code contained in the patch module.
+
+config LIVEPATCH_DEBUG
+       bool "Kernel Live Patching debug"
+       depends on LIVEPATCH
+       help
+         Say Y here to print a debug level message with pr_debug() for
+         the Kernel Live Patching code, it is a easy way to get debug
+         information without dynamic debugging.
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index 2351a19ac2a9..0ab3e5684680 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -5,6 +5,10 @@
  * Copyright (C) 2015-2016 Josh Poimboeuf <jpoim...@redhat.com>
  */
 
+#ifdef CONFIG_LIVEPATCH_DEBUG
+#define DEBUG
+#endif
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/cpu.h>
-- 
2.42.0


Reply via email to