watchdog: add setting to configure pretimeout governor
This commit is contained in:
@@ -140,6 +140,7 @@ static usec_t arg_reboot_watchdog;
|
||||
static usec_t arg_kexec_watchdog;
|
||||
static usec_t arg_pretimeout_watchdog;
|
||||
static char *arg_early_core_pattern;
|
||||
static char *arg_watchdog_pretimeout_governor;
|
||||
static char *arg_watchdog_device;
|
||||
static char **arg_default_environment;
|
||||
static char **arg_manager_environment;
|
||||
@@ -575,6 +576,20 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
}
|
||||
}
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "systemd.watchdog_pretimeout_governor")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value) || isempty(value)) {
|
||||
arg_watchdog_pretimeout_governor = mfree(arg_watchdog_pretimeout_governor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!string_is_safe(value)) {
|
||||
log_warning("Watchdog pretimeout governor '%s' is not valid, ignoring.", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return free_and_strdup_warn(&arg_watchdog_pretimeout_governor, value);
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "systemd.clock_usec")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
@@ -732,6 +747,7 @@ static int parse_config_file(void) {
|
||||
{ "Manager", "ShutdownWatchdogSec", config_parse_watchdog_sec, 0, &arg_reboot_watchdog }, /* obsolete alias */
|
||||
{ "Manager", "KExecWatchdogSec", config_parse_watchdog_sec, 0, &arg_kexec_watchdog },
|
||||
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
|
||||
{ "Manager", "RuntimeWatchdogPreGovernor", config_parse_safe_string, 0, &arg_watchdog_pretimeout_governor },
|
||||
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
|
||||
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
|
||||
#if HAVE_SECCOMP
|
||||
@@ -856,6 +872,7 @@ static void set_manager_defaults(Manager *m) {
|
||||
}
|
||||
|
||||
static void set_manager_settings(Manager *m) {
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
||||
@@ -871,6 +888,9 @@ static void set_manager_settings(Manager *m) {
|
||||
manager_set_watchdog(m, WATCHDOG_REBOOT, arg_reboot_watchdog);
|
||||
manager_set_watchdog(m, WATCHDOG_KEXEC, arg_kexec_watchdog);
|
||||
manager_set_watchdog(m, WATCHDOG_PRETIMEOUT, arg_pretimeout_watchdog);
|
||||
r = manager_set_watchdog_pretimeout_governor(m, arg_watchdog_pretimeout_governor);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set watchdog pretimeout governor to '%s', ignoring: %m", arg_watchdog_pretimeout_governor);
|
||||
|
||||
manager_set_show_status(m, arg_show_status, "commandline");
|
||||
m->status_unit_format = arg_status_unit_format;
|
||||
@@ -1618,6 +1638,7 @@ static int become_shutdown(
|
||||
* shutdown binary to repeatedly ping it.
|
||||
* Disable the pretimeout watchdog, as we do not support it from the shutdown binary. */
|
||||
(void) watchdog_setup_pretimeout(0);
|
||||
(void) watchdog_setup_pretimeout_governor(NULL);
|
||||
r = watchdog_setup(watchdog_timer);
|
||||
watchdog_close(r < 0);
|
||||
|
||||
@@ -2473,6 +2494,7 @@ static void reset_arguments(void) {
|
||||
arg_pretimeout_watchdog = 0;
|
||||
arg_early_core_pattern = NULL;
|
||||
arg_watchdog_device = NULL;
|
||||
arg_watchdog_pretimeout_governor = mfree(arg_watchdog_pretimeout_governor);
|
||||
|
||||
arg_default_environment = strv_free(arg_default_environment);
|
||||
arg_manager_environment = strv_free(arg_manager_environment);
|
||||
|
||||
Reference in New Issue
Block a user