git: 9820afb99e6f - main - LinuxKPI: introduce LINUXKPI_DEBUG to enable LinuxKPI debugging
Date: Sat, 10 Oct 2026 18:29:03 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=9820afb99e6fdc471cb820f321530c52ed2c31ac
commit 9820afb99e6fdc471cb820f321530c52ed2c31ac
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-11-25 17:17:55 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-10-10 18:28:33 +0000
LinuxKPI: introduce LINUXKPI_DEBUG to enable LinuxKPI debugging
This allows us to build kernels which will (if the sysctl is enabled
too) show pr_debug() and pr_devel() output.
Enable it by default for debug kernels.
This option can later also be used for other LinuxKPI parts, like
skbuffs, netdevice, rcu, ... to conditionally compile in debugging
support to further justify its existence beyond an in-code #define.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D54060
---
sys/compat/linuxkpi/common/include/linux/kernel.h | 6 ++++--
sys/conf/kmod.mk | 1 +
sys/conf/options | 3 +++
sys/conf/std.debug | 1 +
sys/conf/std.nodebug | 1 +
5 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 3fcc6c1a925e..43aea5985ab4 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -30,6 +30,8 @@
#ifndef _LINUXKPI_LINUX_KERNEL_H_
#define _LINUXKPI_LINUX_KERNEL_H_
+#include "opt_linuxkpi.h"
+
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/param.h>
@@ -176,9 +178,9 @@ scnprintf(char *buf, size_t size, const char *fmt, ...)
/*
* The "pr_debug()" and "pr_devel()" macros should produce zero code
- * unless DEBUG is defined:
+ * unless LINUXKPI_DEBUG is defined:
*/
-#ifdef DEBUG
+#ifdef LINUXKPI_DEBUG
extern int linuxkpi_debug;
#define pr_debug(fmt, ...) \
do { \
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index c35116dfcaa8..c2081be0da5a 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -103,6 +103,7 @@ LINUXKPI_GENSRCS+= \
pci_iov_if.h \
pcib_if.h \
vnode_if.h \
+ opt_linuxkpi.h \
opt_stack.h
.if ${MK_USB} != "no"
diff --git a/sys/conf/options b/sys/conf/options
index c9d72fdfdbb3..d14fe964949e 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -908,6 +908,9 @@ TDMA_TXRATE_QUARTER_DEFAULT opt_tdma.h
TDMA_TXRATE_11NA_DEFAULT opt_tdma.h
TDMA_TXRATE_11NG_DEFAULT opt_tdma.h
+# LinuxKPI
+LINUXKPI_DEBUG opt_linuxkpi.h
+
# VideoMode
PICKMODE_DEBUG opt_videomode.h
diff --git a/sys/conf/std.debug b/sys/conf/std.debug
index 0149779b3e5c..4ec89de4b407 100644
--- a/sys/conf/std.debug
+++ b/sys/conf/std.debug
@@ -17,3 +17,4 @@ options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default
options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence
options KDTRACE_MIB_SDT # Add SDT probes to network counters
options TCP_HPTS_KTEST # Add KTEST support for HPTS
+options LINUXKPI_DEBUG # Add LinuxKPI pr_debug/pr_devel support
diff --git a/sys/conf/std.nodebug b/sys/conf/std.nodebug
index f8c908cc9936..ac5d27cedd36 100644
--- a/sys/conf/std.nodebug
+++ b/sys/conf/std.nodebug
@@ -17,6 +17,7 @@ nooptions MALLOC_DEBUG_MAXZONES
nooptions QUEUE_MACRO_DEBUG_TRASH
nooptions KDTRACE_MIB_SDT
nooptions TCP_HPTS_KTEST
+nooptions LINUXKPI_DEBUG
# Net80211 debugging
nooptions IEEE80211_DEBUG