Date: Mon, 6 May 2019 16:00:20 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347185 - in head/sys/compat/linuxkpi/common: include/linux src Message-ID: <201905061600.x46G0Kas098614@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905061600.x46G0Kas098614>