[PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Jan 31 15:48:48 CET 2023


On 1/31/23 15:16, Simon Glass wrote:
> Hi,
> 
> On Tue, 31 Jan 2023 at 05:04, Ilias Apalodimas
> <ilias.apalodimas at linaro.org> wrote:
>>
>> Hi all,
>>
>> On Mon, Jan 30, 2023 at 01:30:49PM -0500, Tom Rini wrote:
>>> On Mon, Jan 30, 2023 at 01:13:55PM -0500, Tom Rini wrote:
>>>> On Sat, Jan 28, 2023 at 09:57:45AM +0100, Heinrich Schuchardt wrote:
<snip />
>>>>
>>>> I thought we had rejected going down this path since the UEFI spec is
>>>> unhelpfully wrong if it insists this?
>>>
>>> Because, to be clear, stopping hardware watchdogs is not to be done. The
>>> one in-tree caller of wdt_stop_all is very questionable. You cannot
>>> seriously stop a watchdog until someone else can hopefully resume it as
>>> that violates the function of a hardware watchdog. A pure software
>>> watchdog is one thing, and a hardware watchdog is another. I feel like
>>> the most likely answer here is that someone needs to, still, push back
>>> to the UEFI specification to get hardware watchdogs better understood
>>> and handled, as it must never be stopped once started and if you cannot
>>> reach the next stage in time, that's an engineering issue to resolve. My
>>> first guess is that ExitBootServices should service the watchdog one
>>> last time to ensure the largest window of time for the OS to take over
>>> servicing of the watchdog.
>>>
>>
>> There's two scenarios I can think of
>> 1. After U-Boot is done it can disable the hardware watchdog.
>>     The kernel will go through the EFI-stub -> kernel proper -> watchdog
>>     gets re-initialized.  In that case you are *hoping* that device won't
>>     hang in the efi-stub or until the wd is up again.
>> 2. EFI makes sure the hardware wd gets configured with the highest allowed
>>     value.  The efi-stub doesn't have any driver to refresh the wd, so we
>>     will again rely on the wd driver coming up and refreshing the timers.
>>
>>
>> None of those is perfect, but I prefer the latter
> 
> How does this work if U-Boot runs grub instead of Linux? Does grub
> update the watchdog?
> 

U-Boot will reset the watchdog when the UEFI API is invoked to read the 
console or to access the network or block devices. Just grep for 
"efi_timer_check()".

Best regards

Heinrich



More information about the U-Boot mailing list