Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 17:01:39 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r347791 - in stable/11/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201905161701.x4GH1dhL089361@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905161701.x4GH1dhL089361>