summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-06-27 16:33:43 +0000
committerhselasky <hselasky@FreeBSD.org>2014-06-27 16:33:43 +0000
commitbd1ed65f0faa90d56aad3c8fc1b55d874d1548d9 (patch)
tree522e12e286a7e13608cc5ce25965451047b98773 /sys/kern/kern_shutdown.c
parent465e750b1418c7bcbd18c4e34b36120ff51ae0fc (diff)
downloadFreeBSD-src-bd1ed65f0faa90d56aad3c8fc1b55d874d1548d9.zip
FreeBSD-src-bd1ed65f0faa90d56aad3c8fc1b55d874d1548d9.tar.gz
Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 4700e68..dba6a43 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -90,10 +90,9 @@ __FBSDID("$FreeBSD$");
#define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */
#endif
static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME;
-SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RWTUN,
&panic_reboot_wait_time, 0,
"Seconds to wait before rebooting after a panic");
-TUNABLE_INT("kern.panic_reboot_wait_time", &panic_reboot_wait_time);
/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
@@ -108,9 +107,8 @@ int debugger_on_panic = 0;
int debugger_on_panic = 1;
#endif
SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic,
- CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN,
+ CTLFLAG_RWTUN | CTLFLAG_SECURE,
&debugger_on_panic, 0, "Run debugger on kernel panic");
-TUNABLE_INT("debug.debugger_on_panic", &debugger_on_panic);
#ifdef KDB_TRACE
static int trace_on_panic = 1;
@@ -118,15 +116,13 @@ static int trace_on_panic = 1;
static int trace_on_panic = 0;
#endif
SYSCTL_INT(_debug, OID_AUTO, trace_on_panic,
- CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN,
+ CTLFLAG_RWTUN | CTLFLAG_SECURE,
&trace_on_panic, 0, "Print stack trace on kernel panic");
-TUNABLE_INT("debug.trace_on_panic", &trace_on_panic);
#endif /* KDB */
static int sync_on_panic = 0;
-SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RWTUN,
&sync_on_panic, 0, "Do a sync before rebooting from a panic");
-TUNABLE_INT("kern.sync_on_panic", &sync_on_panic);
static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0,
"Shutdown environment");
@@ -559,43 +555,35 @@ static int kassert_warnings = 0;
SYSCTL_NODE(_debug, OID_AUTO, kassert, CTLFLAG_RW, NULL, "kassert options");
-SYSCTL_INT(_debug_kassert, OID_AUTO, warn_only, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, warn_only, CTLFLAG_RWTUN,
&kassert_warn_only, 0,
"KASSERT triggers a panic (1) or just a warning (0)");
-TUNABLE_INT("debug.kassert.warn_only", &kassert_warn_only);
#ifdef KDB
-SYSCTL_INT(_debug_kassert, OID_AUTO, do_kdb, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, do_kdb, CTLFLAG_RWTUN,
&kassert_do_kdb, 0, "KASSERT will enter the debugger");
-TUNABLE_INT("debug.kassert.do_kdb", &kassert_do_kdb);
#endif
#ifdef KTR
-SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_RWTUN,
&kassert_do_ktr, 0,
"KASSERT does a KTR, set this to the KTRMASK you want");
-TUNABLE_INT("debug.kassert.do_ktr", &kassert_do_ktr);
#endif
-SYSCTL_INT(_debug_kassert, OID_AUTO, do_log, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, do_log, CTLFLAG_RWTUN,
&kassert_do_log, 0, "KASSERT triggers a panic (1) or just a warning (0)");
-TUNABLE_INT("debug.kassert.do_log", &kassert_do_log);
-SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, CTLFLAG_RWTUN,
&kassert_warnings, 0, "number of KASSERTs that have been triggered");
-TUNABLE_INT("debug.kassert.warnings", &kassert_warnings);
-SYSCTL_INT(_debug_kassert, OID_AUTO, log_panic_at, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, log_panic_at, CTLFLAG_RWTUN,
&kassert_log_panic_at, 0, "max number of KASSERTS before we will panic");
-TUNABLE_INT("debug.kassert.log_panic_at", &kassert_log_panic_at);
-SYSCTL_INT(_debug_kassert, OID_AUTO, log_pps_limit, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, log_pps_limit, CTLFLAG_RWTUN,
&kassert_log_pps_limit, 0, "limit number of log messages per second");
-TUNABLE_INT("debug.kassert.log_pps_limit", &kassert_log_pps_limit);
-SYSCTL_INT(_debug_kassert, OID_AUTO, log_mute_at, CTLFLAG_RW | CTLFLAG_TUN,
+SYSCTL_INT(_debug_kassert, OID_AUTO, log_mute_at, CTLFLAG_RWTUN,
&kassert_log_mute_at, 0, "max number of KASSERTS to log");
-TUNABLE_INT("debug.kassert.log_mute_at", &kassert_log_mute_at);
static int kassert_sysctl_kassert(SYSCTL_HANDLER_ARGS);
OpenPOWER on IntegriCloud