Date: Tue, 2 Nov 2021 15:54:29 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 2390a1441eff - main - LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. Message-ID: <202111021554.1A2FsTOi050903@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2390a1441effaba0e3d0f2f447f448aaf20428f1 commit 2390a1441effaba0e3d0f2f447f448aaf20428f1 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2021-11-02 15:52:46 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2021-11-02 15:53:34 +0000 LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's. The purpose of this change is to reduce the amount of dmesg(8) noise when VT switching after a panic. Submitted by: Greg V <greg@unrelenting.technology> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30174 Sponsored by: NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/kernel.h | 25 +++++++++++++---------- sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 6cbd95c4ac64..94af8f29c4d7 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -121,28 +121,31 @@ extern const volatile int lkpi_build_bug_on_zero; } \ } while (0) +extern int linuxkpi_warn_dump_stack; #define WARN_ON(cond) ({ \ - bool __ret = (cond); \ - if (__ret) { \ + bool __ret = (cond); \ + if (__ret) { \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define WARN_ON_SMP(cond) WARN_ON(cond) #define WARN_ON_ONCE(cond) ({ \ - static bool __warn_on_once; \ - bool __ret = (cond); \ - if (__ret && !__warn_on_once) { \ + static bool __warn_on_once; \ + bool __ret = (cond); \ + if (__ret && !__warn_on_once) { \ __warn_on_once = 1; \ printf("WARNING %s failed at %s:%d\n", \ __stringify(cond), __FILE__, __LINE__); \ - linux_dump_stack(); \ - } \ - unlikely(__ret); \ + if (linuxkpi_warn_dump_stack) \ + linux_dump_stack(); \ + } \ + unlikely(__ret); \ }) #define oops_in_progress SCHEDULER_STOPPED() diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index a62cf93dbd82..6440f7bdcff4 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -103,6 +103,11 @@ int linuxkpi_debug; SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); +int linuxkpi_warn_dump_stack = 0; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, warn_dump_stack, CTLFLAG_RWTUN, + &linuxkpi_warn_dump_stack, 0, + "Set to enable stack traces from WARN_ON(). Clear to disable."); + static struct timeval lkpi_net_lastlog; static int lkpi_net_curpps; static int lkpi_net_maxpps = 99;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111021554.1A2FsTOi050903>