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 <yangtiezhu@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 <jpoimboe@redhat.com>
*/
+#ifdef CONFIG_LIVEPATCH_DEBUG
+#define DEBUG
+#endif
+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cpu.h>
--
2.42.0
Hi, On Tue, 9 Sep 2025, Tiezhu Yang wrote: > 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. I do not have a strong opinion but is it really worth it? Configuring dynamic debug is not difficult, it is more targetted (you can enable it just for a subset of functions in livepatch subsystem) and it can also be done on the command line. Miroslav
On 2025/9/11 下午9:50, Miroslav Benes wrote: > Hi, > > On Tue, 9 Sep 2025, Tiezhu Yang wrote: > >> 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. > > I do not have a strong opinion but is it really worth it? Configuring This is an alternative way, there are some similar usages: drivers/iommu/exynos-iommu.c: #ifdef CONFIG_EXYNOS_IOMMU_DEBUG #define DEBUG #endif drivers/mtd/nand/raw/s3c2410.c: #ifdef CONFIG_MTD_NAND_S3C2410_DEBUG #define DEBUG #endif drivers/usb/storage/usb.c: #ifdef CONFIG_USB_STORAGE_DEBUG #define DEBUG #endif > dynamic debug is not difficult, it is more targetted (you can enable it > just for a subset of functions in livepatch subsystem) and it can also be > done on the command line. Yes, this is true. It is up to the maintainers to apply this patch or not. Thanks, Tiezhu
On Fri, 12 Sep 2025, Tiezhu Yang wrote: > On 2025/9/11 下午9:50, Miroslav Benes wrote: > > Hi, > > > > On Tue, 9 Sep 2025, Tiezhu Yang wrote: > > > >> 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. > > > > I do not have a strong opinion but is it really worth it? Configuring > > This is an alternative way, there are some similar usages: > > drivers/iommu/exynos-iommu.c: > #ifdef CONFIG_EXYNOS_IOMMU_DEBUG > #define DEBUG > #endif > > drivers/mtd/nand/raw/s3c2410.c: > #ifdef CONFIG_MTD_NAND_S3C2410_DEBUG > #define DEBUG > #endif > > drivers/usb/storage/usb.c: > #ifdef CONFIG_USB_STORAGE_DEBUG > #define DEBUG > #endif > > > dynamic debug is not difficult, it is more targetted (you can enable it > > just for a subset of functions in livepatch subsystem) and it can also be > > done on the command line. > > Yes, this is true. It is up to the maintainers to apply this patch > or not. Right and I do not see the point to have it in the tree for the reasons above. Miroslav
© 2016 - 2025 Red Hat, Inc.