svn commit: r347791 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Hans Petter Selasky
hselasky at FreeBSD.org
Thu May 16 17:01:40 UTC 2019
Author: hselasky
Date: Thu May 16 17:01:39 2019
New Revision: 347791
URL: https://svnweb.freebsd.org/changeset/base/347791
Log:
MFC r347185:
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.
Submitted by: kib@
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 16:44:40 2019 (r347790)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Thu May 16 17:01:39 2019 (r347791)
@@ -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: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 16:44:40 2019 (r347790)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Thu May 16 17:01:39 2019 (r347791)
@@ -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