svn commit: r347185 - in head/sys/compat/linuxkpi/common: include/linux src
Hans Petter Selasky
hselasky at FreeBSD.org
Mon May 6 16:00:22 UTC 2019
Author: hselasky
Date: Mon May 6 16:00:20 2019
New Revision: 347185
URL: https://svnweb.freebsd.org/changeset/base/347185
Log:
Allow controlling pr_debug at runtime in the LinuxKPI.
Turning on pr_debug at compile time make it non-optional at runtime.
This often means that the amount of the debugging is unbearable.
Allow developer to turn on pr_debug output only when needed.
Build tested drm-current-kmod prior to commit.
MFC after: 1 week
Submitted by: kib@
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/include/linux/kernel.h
head/sys/compat/linuxkpi/common/src/linux_compat.c
Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 6 15:20:18 2019 (r347184)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 6 16:00:20 2019 (r347185)
@@ -177,8 +177,12 @@ scnprintf(char *buf, size_t size, const char *fmt, ...
* unless DEBUG is defined:
*/
#ifdef DEBUG
-#define pr_debug(fmt, ...) \
- log(LOG_DEBUG, fmt, ##__VA_ARGS__)
+extern int linuxkpi_debug;
+#define pr_debug(fmt, ...) \
+ do { \
+ if (linuxkpi_debug) \
+ log(LOG_DEBUG, fmt, ##__VA_ARGS__); \
+ } while (0)
#define pr_devel(fmt, ...) \
log(LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__)
#else
Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 6 15:20:18 2019 (r347184)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 6 16:00:20 2019 (r347185)
@@ -92,6 +92,10 @@ __FBSDID("$FreeBSD$");
SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW, 0, "LinuxKPI parameters");
+int linuxkpi_debug;
+SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN,
+ &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable.");
+
MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat");
#include <linux/rbtree.h>
More information about the svn-src-all
mailing list