diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2021-11-02 15:52:46 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2021-11-02 15:53:34 +0000 |
commit | 2390a1441effaba0e3d0f2f447f448aaf20428f1 (patch) | |
tree | f76115bff931a94ba98fc6e892d00fddce8bfbcc /sys/compat/linuxkpi/common/include | |
parent | a670e1c13a522df4fb8c63bb023b88b1d65de797 (diff) | |
download | src-2390a1441effaba0e3d0f2f447f448aaf20428f1.tar.gz src-2390a1441effaba0e3d0f2f447f448aaf20428f1.zip |
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
Diffstat (limited to 'sys/compat/linuxkpi/common/include')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/kernel.h | 25 |
1 files changed, 14 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() |