Make EFI watchdog behaviour configurable
PATCH 1/1 Make EFI watchdog behaviour configurable
Starting with d9a0c9413e81d3c0affc6383693bdd28dc863a5c, GRUB unconditionally disables watchdog on EFI platforms. This opens up a window (starting at GRUB's grub_efi_init(), until OS re-enables it) when EFI system operates w/o watchdog. If an EFI system gets stuck in that window, the chipset will never reset the system.
Add `--enable-efi-watchdog' configure argument, which defaults to Off. When enabled, efi watchdog will not be disabled.
Otherwise, efi watchdog will be disabled.
Create a command line interface to enable/disable watchdog:
efi-watchdog (enable|disable) <timeout>
--- configure.ac | 18 +++++++++++++- docs/grub.texi | 8 ++++++ grub-core/kern/efi/init.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-)
configure.ac +17 -1
@@ -211,7 +211,10 @@ esac case "$platform" in coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; + efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" + if test x"$enable_efi_watchdog" = xyes ; then + machine_CPPFLAGS="$machine_CPPFLAGS -DEFI_WATCHDOG_LEAVE_ALONE=1" + fi ;; xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;; ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
@@ -1705,6 +1708,10 @@ if test x"$enable_werror" != xno ; then HOST_CFLAGS="$HOST_CFLAGS -Werror" fi +AC_ARG_ENABLE([efi-watchdog], + [AS_HELP_STRING([--enable-efi-watchdog], + [Do not explicitly disable EFI watchdog])]) + TARGET_CPP="$TARGET_CC -E" TARGET_CCAS=$TARGET_CC
@@ -1899,6 +1906,15 @@ echo efiemu runtime: Yes else echo efiemu runtime: No "($efiemu_excuse)" fi + +if [ x"$platform" = xefi ]; then +if [ x"$enable_efi_watchdog" != xyes ]; then +echo disable EFI watchdog: Yes +else +echo disable EFI watchdog: No +fi +fi + if [ x"$grub_mkfont_excuse" = x ]; then echo grub-mkfont: Yes else
docs/grub.texi +8 -0
@@ -3784,6 +3784,7 @@ you forget a command, you can run the command @command{help} * distrust:: Remove a pubkey from trusted keys * drivemap:: Map a drive to another * echo:: Display a line of text +* efi-watchdog:: Manipulate EFI watchdog * eval:: Evaluate agruments as GRUB commands * export:: Export an environment variable * false:: Do nothing, unsuccessfully
@@ -4192,6 +4193,13 @@ When interpreting backslash escapes, backslash followed by any other character will print that character. @end deffn +@node efi-watchdog +@subsection efi-watchdog + +@deffn Command efi-watchdog enable|disable <timeout> +Enable or disable the system's watchdog timer. Only available in EFI targeted +GRUB. +@end deffn @node eval @subsection eval
grub-core/kern/efi/init.c +59 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.9.5
10.09.2015 03:11, Arthur Mesh пишет:
Quoted 10 lines
Starting with
d9a0c9413e81d3c0affc6383693bdd28dc863a5c, GRUB unconditionally disables watchdog on EFI platforms. This opens up a window (starting at GRUB'sgrub_efi_init(), until OS re-enables it) when EFI system operates w/o watchdog. If an EFI system gets stuck in that window, the chipset will never reset the system.Add `--enable-efi-watchdog' configure argument, which defaults to Off. When enabled, efi watchdog will not be disabled.
Otherwise, efi watchdog will be disabled.
Please, no. This will result in incompatible binaries without any indication at run-time that allows to distinguish between them.
Quoted 2 lines
Create a command line interface to enable/disable watchdog:
efi-watchdog (enable|disable) <timeout>
Why is it not enough? You can always add it to your grub.cfg.
Quoted 8 lines · On 9/11/15, 7:32 AM, "[email protected] on behalf…
10.09.2015 03:11, Arthur Mesh пишет:
Quoted 4 lines
Add `--enable-efi-watchdog' configure argument, which defaults to Off. When enabled, efi watchdog will not be disabled.
Otherwise, efi watchdog will be disabled.Please, no. This will result in incompatible binaries without any indication at run-time that allows to distinguish between them.
That's true, but I see no way around that w/o avoiding the initial call to disable the watchdog in the efi init routine (and Vladimir is against that idea).
Quoted 5 lines
Quoted 3 lines
Create a command line interface to enable/disable watchdog:
efi-watchdog (enable|disable) <timeout>Why is it not enough? You can always add it to your grub.cfg.
Well, it still leaves a window of time where the system operates w/o a watchdog. It could be a problem if grub.cfg resides on a network file system, and is not accessible, in which case the system would hang.
Spasibo
11.09.2015 17:53, Arthur Mesh пишет:
Quoted 20 lines · On 9/11/15, 7:32 AM, "[email protected] on behalf…
Quoted 9 lines
10.09.2015 03:11, Arthur Mesh пишет:
Quoted 4 lines
Add `--enable-efi-watchdog' configure argument, which defaults to Off. When enabled, efi watchdog will not be disabled.
Otherwise, efi watchdog will be disabled.Please, no. This will result in incompatible binaries without any indication at run-time that allows to distinguish between them.
That's true, but I see no way around that w/o avoiding the initial call to disable the watchdog in the efi init routine (and Vladimir is against that idea).
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Create a command line interface to enable/disable watchdog:
efi-watchdog (enable|disable) <timeout>Why is it not enough? You can always add it to your grub.cfg.
Well, it still leaves a window of time where the system operates w/o a watchdog. It could be a problem if grub.cfg resides on a network file system, and is not accessible, in which case the system would hang.
I'm fine with making it controlled by parameter passed to grub invocation or EFI variable. We discussed parameters several times but did not come to definitive conclusion hos interface should look like.
Quoted 9 lines · Andrei Borzenkov
Quoted 5 lines
Quoted 1 line
Why is it not enough? You can always add it to your grub.cfg.
Well, it still leaves a window of time where the system operates w/o a watchdog. It could be a problem if grub.cfg resides on a network file system, and is not accessible, in which case the system would hang.
I'm fine with making it controlled by parameter passed to grub invocation or EFI variable. We discussed parameters several times but did not come to definitive conclusion hos interface should look like.
BIOS wouldn't know when to tell GRUB to disable the watchdog. If it did, BIOS wouldn't have to enable the watchdog to begin with.
EFI variables is a better idea, but unless we have a well defined interface, it will get unwieldy very quickly..
Can we compromise and simply proceed with the efi-watchdog cli? If so, I'll gladly submit a new patch.
Thanks
Signature · 3 lines
Arthur Mesh <[email protected]> Juniper Networks +1 408 936-4968