Merge pull request #21002 from poettering/watchdog-off

minor tweaks to watchdog configuration logic
This commit is contained in:
Luca Boccassi
2021-10-13 20:03:06 +01:00
committed by GitHub
5 changed files with 36 additions and 16 deletions

View File

@@ -386,8 +386,9 @@
<term><varname>systemd.default_timeout_start_sec=</varname></term>
<listitem>
<para>Overwrites the default start job timeout <varname>DefaultTimeoutStartSec=</varname> at boot. For details,
see <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<para>Overrrides the default start job timeout <varname>DefaultTimeoutStartSec=</varname> at
boot. For details, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>
@@ -395,7 +396,20 @@
<term><varname>systemd.watchdog_device=</varname></term>
<listitem>
<para>Overwrites the watchdog device path <varname>WatchdogDevice=</varname>. For details, see
<para>Overrrides the watchdog device path <varname>WatchdogDevice=</varname>. For details, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>systemd.watchdog_sec=</varname></term>
<listitem>
<para>Overrrides the watchdog timeout settings otherwise configured with
<varname>RuntimeWatchdog=</varname>, <varname>RebootWatchdog=</varname> and
<varname>KExecWatchdogSec=</varname>. Takes a time value (if no unit is specified, seconds is the
implicitly assumed time unit) or the special strings <literal>off</literal> or
<literal>default</literal>. For details, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</listitem>
</varlistentry>

View File

@@ -135,11 +135,13 @@
<listitem><para>Configure the hardware watchdog at runtime and at reboot. Takes a timeout value in
seconds (or in other time units if suffixed with <literal>ms</literal>, <literal>min</literal>,
<literal>h</literal>, <literal>d</literal>, <literal>w</literal>). If set to zero the watchdog logic
is disabled: no watchdog device is opened, configured, or pinged. If set to the special string
<literal>default</literal> the watchdog is opened and pinged in regular intervals, but the timeout
is not changed from the default. If set to any other time value the watchdog timeout is configured to
the specified value (or a value close to it, depending on hardware capabilities).</para>
<literal>h</literal>, <literal>d</literal>, <literal>w</literal>), or the special strings
<literal>off</literal> or <literal>default</literal>. If set to <literal>off</literal>
(alternatively: <literal>0</literal>) the watchdog logic is disabled: no watchdog device is opened,
configured, or pinged. If set to the special string <literal>default</literal> the watchdog is opened
and pinged in regular intervals, but the timeout is not changed from the default. If set to any other
time value the watchdog timeout is configured to the specified value (or a value close to it,
depending on hardware capabilities).</para>
<para>If <varname>RuntimeWatchdogSec=</varname> is set to a non-zero value, the watchdog hardware
(<filename>/dev/watchdog</filename> or the path specified with <varname>WatchdogDevice=</varname> or

View File

@@ -6347,6 +6347,8 @@ int config_parse_watchdog_sec(
void *data,
void *userdata) {
usec_t *usec = data;
assert(filename);
assert(lvalue);
assert(rvalue);
@@ -6354,12 +6356,12 @@ int config_parse_watchdog_sec(
/* This is called for {Runtime,Reboot,KExec}WatchdogSec= where "default" maps to
* USEC_INFINITY internally. */
if (streq(rvalue, "default")) {
usec_t *usec = data;
if (streq(rvalue, "default"))
*usec = USEC_INFINITY;
return 0;
}
else if (streq(rvalue, "off"))
*usec = 0;
else
return config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
return config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
return 0;
}

View File

@@ -544,6 +544,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (streq(value, "default"))
arg_runtime_watchdog = USEC_INFINITY;
else if (streq(value, "off"))
arg_runtime_watchdog = 0;
else {
r = parse_sec(value, &arg_runtime_watchdog);
if (r < 0) {

View File

@@ -29,9 +29,9 @@
#CPUAffinity=
#NUMAPolicy=default
#NUMAMask=
#RuntimeWatchdogSec=0
#RuntimeWatchdogSec=off
#RebootWatchdogSec=10min
#KExecWatchdogSec=0
#KExecWatchdogSec=off
#WatchdogDevice=
#CapabilityBoundingSet=
#NoNewPrivileges=no