Author: mav Date: Tue Sep 14 04:48:04 2010 New Revision: 212600 URL: http://svn.freebsd.org/changeset/base/212600
Log: Add some foot shooting protection by checking singlemul value correctness. Rephrase sysctls descriptions. Suggested by: edmaste Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Tue Sep 14 04:22:27 2010 (r212599) +++ head/sys/kern/kern_clocksource.c Tue Sep 14 04:48:04 2010 (r212600) @@ -105,7 +105,7 @@ static int profiling = 0; /* Profiling static char timername[32]; /* Wanted timer. */ TUNABLE_STR("kern.eventtimer.timer", timername, sizeof(timername)); -static u_int singlemul = 0; /* Multiplier for periodic mode. */ +static int singlemul = 0; /* Multiplier for periodic mode. */ TUNABLE_INT("kern.eventtimer.singlemul", &singlemul); SYSCTL_INT(_kern_eventtimer, OID_AUTO, singlemul, CTLFLAG_RW, &singlemul, 0, "Multiplier for periodic mode"); @@ -425,6 +425,7 @@ setuptimer(void) periodic = 0; else if (!periodic && (timer->et_flags & ET_FLAGS_ONESHOT) == 0) periodic = 1; + singlemul = MIN(MAX(singlemul, 1), 20); freq = hz * singlemul; while (freq < (profiling ? profhz : stathz)) freq += hz; @@ -614,7 +615,7 @@ cpu_initclocks_bsp(void) * We want to run stathz in the neighborhood of 128hz. * We would like profhz to run as often as possible. */ - if (singlemul == 0) { + if (singlemul <= 0 || singlemul > 20) { if (hz >= 1500 || (hz % 128) == 0) singlemul = 1; else if (hz >= 750) @@ -844,7 +845,7 @@ sysctl_kern_eventtimer_timer(SYSCTL_HAND } SYSCTL_PROC(_kern_eventtimer, OID_AUTO, timer, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, - 0, 0, sysctl_kern_eventtimer_timer, "A", "Kernel event timer"); + 0, 0, sysctl_kern_eventtimer_timer, "A", "Chosen event timer"); /* * Report or change the active event timer periodicity. @@ -867,6 +868,6 @@ sysctl_kern_eventtimer_periodic(SYSCTL_H } SYSCTL_PROC(_kern_eventtimer, OID_AUTO, periodic, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, - 0, 0, sysctl_kern_eventtimer_periodic, "I", "Kernel event timer periodic"); + 0, 0, sysctl_kern_eventtimer_periodic, "I", "Enable event timer periodic mode"); #endif _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"