Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2017 12:18:17 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Ronald Klop <ronald-lists@klop.ws>
Cc:        src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Warner Losh <imp@freebsd.org>
Subject:   Re: svn commit: r325785 - in head: sys/kern tools/tools/sysdoc
Message-ID:  <CANCZdfodh3VUeCGy=iDztayt_UMwz%2B%2BmaBiJDtgG8P1f1v2TbQ@mail.gmail.com>
In-Reply-To: <op.y9pimnx6kndu52@joepie>
References:  <201711140029.vAE0TEVO024994@repo.freebsd.org> <op.y9pimnx6kndu52@joepie>

next in thread | previous in thread | raw e-mail | index | archive | help
As implemented today, the power cycle shutdown handler has a higher
priority than the power off handlers. So, if you have IPMI enabled, the
power cylce will take precedence and that will happen. If not (or the IPMI
fails to power off within the timeout period), then the power off will
happen.

Warner

On Tue, Nov 14, 2017 at 11:50 AM, Ronald Klop <ronald-lists@klop.ws> wrote:

> Just out of curiosity. What happens if you enable both?
>
> Regards,
> Ronald.
>
>
>
> On Tue, 14 Nov 2017 01:29:14 +0100, Warner Losh <imp@freebsd.org> wrote:
>
> Author: imp
>> Date: Tue Nov 14 00:29:14 2017
>> New Revision: 325785
>> URL: https://svnweb.freebsd.org/changeset/base/325785
>>
>> Log:
>>   Add two new tunables / sysctls to controll reboot after panic:
>>  kern.poweroff_on_panic which, when enabled, instructs a system to
>>   power off on a panic instead of a reboot.
>>  kern.powercyle_on_panic which, when enabled, instructs a system to
>>   power cycle, if possible, on a panic instead of a reboot.
>>  Sponsored by: Netflix
>>   Differential Revision: https://reviews.freebsd.org/D13042
>>
>> Modified:
>>   head/sys/kern/kern_shutdown.c
>>   head/tools/tools/sysdoc/tunables.mdoc
>>
>> Modified: head/sys/kern/kern_shutdown.c
>> ============================================================
>> ==================
>> --- head/sys/kern/kern_shutdown.c       Mon Nov 13 23:33:07 2017
>> (r325784)
>> +++ head/sys/kern/kern_shutdown.c       Tue Nov 14 00:29:14 2017
>> (r325785)
>> @@ -134,6 +134,14 @@ static int sync_on_panic = 0;
>>  SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RWTUN,
>>         &sync_on_panic, 0, "Do a sync before rebooting from a panic");
>> +static bool poweroff_on_panic = 0;
>> +SYSCTL_BOOL(_kern, OID_AUTO, poweroff_on_panic, CTLFLAG_RWTUN,
>> +       &poweroff_on_panic, 0, "Do a power off instead of a reboot on a
>> panic");
>> +
>> +static bool powercycle_on_panic = 0;
>> +SYSCTL_BOOL(_kern, OID_AUTO, powercycle_on_panic, CTLFLAG_RWTUN,
>> +       &powercycle_on_panic, 0, "Do a power cycle instead of a reboot on
>> a panic");
>> +
>>  static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0,
>>      "Shutdown environment");
>> @@ -797,6 +805,10 @@ vpanic(const char *fmt, va_list ap)
>>         /* thread_unlock(td); */
>>         if (!sync_on_panic)
>>                 bootopt |= RB_NOSYNC;
>> +       if (poweroff_on_panic)
>> +               bootopt |= RB_POWEROFF;
>> +       if (powercycle_on_panic)
>> +               bootopt |= RB_POWERCYCLE;
>>         kern_reboot(bootopt);
>>  }
>>
>> Modified: head/tools/tools/sysdoc/tunables.mdoc
>> ============================================================
>> ==================
>> --- head/tools/tools/sysdoc/tunables.mdoc       Mon Nov 13 23:33:07
>> 2017        (r325784)
>> +++ head/tools/tools/sysdoc/tunables.mdoc       Tue Nov 14 00:29:14
>> 2017        (r325785)
>> @@ -1035,6 +1035,20 @@ is attempting to comply with.
>>  This is a read-only variable.
>> ---
>> +kern.powercycle_on_panic
>> +bool
>> +
>> +In the event of a panic, this variable controls whether or not the
>> +system should try to power cycle instead of rebooting.
>> +
>> +---
>> +kern.poweroff_on_panic
>> +bool
>> +
>> +In the event of a panic, this variable controls whether or not the
>> +system should try to power off instead of rebooting.
>> +
>> +---
>>  kern.proc.all
>> ---
>> _______________________________________________
>> svn-src-all@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/svn-src-all
>> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
>>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfodh3VUeCGy=iDztayt_UMwz%2B%2BmaBiJDtgG8P1f1v2TbQ>