From owner-freebsd-current@FreeBSD.ORG Mon Dec 2 08:29:24 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6ABA02D4 for ; Mon, 2 Dec 2013 08:29:24 +0000 (UTC) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 161181BE3 for ; Mon, 2 Dec 2013 08:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=from:mime-version:to:subject:content-type; s=smtpapi; bh=z/Y+mDi59VPC8YAmZSRVXv5go9Q=; b=Z3WLdZsLX7T9fE5XO4ITWSSAatfRA U89/9qj0Jg3RL/gMoOj8fHA9/bizunF6ML1AOoElzJBpVIoCKurQBlnNEEPS1FJs 5PpUHL2a4SjgW0Ws1U6oO5Z2JDJmIGu6w4gsLXl7U5WS274FBWKFMNd8qEzo/Ghc ZU1jjZa1LOEFNE= Received: by mf138.sendgrid.net with SMTP id mf138.37739.529C44E23 Mon, 02 Dec 2013 08:29:22 +0000 (GMT) Received: from mail.tarsnap.com (unknown [10.60.208.15]) by mi60 (SG) with ESMTP id 142b26d154b.5b02.13ee68 for ; Mon, 02 Dec 2013 02:29:22 -0600 (CST) Received: (qmail 12379 invoked from network); 2 Dec 2013 08:29:21 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 2 Dec 2013 08:29:21 -0000 Received: (qmail 21730 invoked from network); 2 Dec 2013 08:26:46 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 2 Dec 2013 08:26:46 -0000 Message-ID: <529C4446.6020508@freebsd.org> Date: Mon, 02 Dec 2013 00:26:46 -0800 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: FreeBSD current Subject: making PANIC_REBOOT_WAIT_TIME a tunable X-Enigmail-Version: 1.5.2 Content-Type: multipart/mixed; boundary="------------010603050706050309040401" X-SG-EID: XhyBwObMhraAR+zdwMupjQ6BIqbhdEfc+6p+uBxS7S88hDVo7wPr0+CK+tH/z+ymQiprbVAx7lRDFIv9pWSs1jcDsLGlbmnzfgKXtIZyqU/j4fgI4L+zx5CB3yBP1gCW1wj0Xu7EUvBBmGphchOYODXA80G9DwglWpFspCQfy+0= X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 08:29:24 -0000 This is a multi-part message in MIME format. --------------010603050706050309040401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all, It seems that PANIC_REBOOT_WAIT_TIME has been a compile-time setting forever; and I can't see any reason for this, but I assume there was one... at some point in the distant past. The attached patch makes it a loader tunable and sysctl. My reason for wanting this is to make EC2 images reboot faster after a panic (not that it happens very often, of course) -- there's no point waiting for a key press at the console because the EC2 console is output-only. Any objections? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid --------------010603050706050309040401 Content-Type: text/plain; charset=us-ascii; name="panic-wait-time-sysctl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="panic-wait-time-sysctl.patch" Index: sys/kern/kern_shutdown.c =================================================================== --- sys/kern/kern_shutdown.c (revision 258085) +++ sys/kern/kern_shutdown.c (working copy) @@ -89,6 +89,11 @@ #ifndef PANIC_REBOOT_WAIT_TIME #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ #endif +int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME; +SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RW | CTLFLAG_TUN, + &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 @@ -485,12 +490,12 @@ int loop; if (howto & RB_DUMP) { - if (PANIC_REBOOT_WAIT_TIME != 0) { - if (PANIC_REBOOT_WAIT_TIME != -1) { + if (panic_reboot_wait_time != 0) { + if (panic_reboot_wait_time != -1) { printf("Automatic reboot in %d seconds - " "press a key on the console to abort\n", - PANIC_REBOOT_WAIT_TIME); - for (loop = PANIC_REBOOT_WAIT_TIME * 10; + panic_reboot_wait_time); + for (loop = panic_reboot_wait_time * 10; loop > 0; --loop) { DELAY(1000 * 100); /* 1/10th second */ /* Did user type a key? */ --------------010603050706050309040401--