Add kern.reboot_wait_time sysctl

Historic FreeBSD behaviour (dating back to 1994-04-02) when rebooting
is to print "Rebooting..." and then
	/* wait 1 sec for printf's to complete and be read */

Prior to April 1994, there was a 100 ms delay (added 1993-11-12).

Since (a) most users will already be aware that the system is rebooting
and do not need to take time to read an additional message to that
effect, and (b) most FreeBSD systems don't have anyone actively looking
at the console anyway, this delay no longer serves much purpose.

This commit adds a kern.reboot_wait_time sysctl which defaults to 0;
historic behaviour can be regained by setting it to 1.

Reviewed by:	imp
Relnotes:	FreeBSD now reboots faster; to restore the traditional
		wait after printing "Rebooting..." to the console, set
		kern.reboot_wait_time=1 (or more).
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35796
This commit is contained in:
Colin Percival 2022-07-12 17:42:26 -07:00
parent 4e2121c10a
commit 84ec7df0d7

View File

@ -111,6 +111,10 @@ static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME;
SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RWTUN,
&panic_reboot_wait_time, 0,
"Seconds to wait before rebooting after a panic");
static int reboot_wait_time = 0;
SYSCTL_INT(_kern, OID_AUTO, reboot_wait_time, CTLFLAG_RWTUN,
&reboot_wait_time, 0,
"Seconds to wait before rebooting");
/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
@ -710,7 +714,7 @@ shutdown_reset(void *junk, int howto)
{
printf("Rebooting...\n");
DELAY(1000000); /* wait 1 sec for printf's to complete and be read */
DELAY(reboot_wait_time * 1000000);
/*
* Acquiring smp_ipi_mtx here has a double effect: