From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE90AC54EED for ; Mon, 30 Jan 2023 18:31:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F23BB85936; Mon, 30 Jan 2023 19:31:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="ZpP1RO9f"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F247485936; Mon, 30 Jan 2023 19:31:19 +0100 (CET) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B70388593E for ; Mon, 30 Jan 2023 19:31:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82b.google.com with SMTP id v17so1080459qto.3 for ; Mon, 30 Jan 2023 10:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sH5Y907TIfIF96cX5FFwt2quYzI7gwXfQ2r5qWBlVu0=; b=ZpP1RO9fUbogJSYGiK17KbmS/eLUemfeAq2qm8Quks2TR8KlrUBzocaPT2Fk5cTpny aSN7t2QnHUGqkqb0/Y8u6ASgZXhtup7EZJEL5PeYnKrSxoD7OgxRxFq/GTZrVMWICCnV E9AlPSr4/t6kUJN52439OVtaUh64NCvQ9bFoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sH5Y907TIfIF96cX5FFwt2quYzI7gwXfQ2r5qWBlVu0=; b=rPx6Q1tzXtIbq90J/IqEa2u95GK10Y/mVpOpoIDsNq6WYOWjEoG6HPCky3OtKEd4LQ jo2EdULRYptsZXaHhNYZ+pqZX6pSA4ZuvGmN3h3WMT2nWPoBT1VQ3udv3ZBT1XYD86Ao 7jDBjR+8dey9dPQdERHTTnOL/N22m88XcVu2kd3qHh6CN5P27p2+ob6tP0xAug08oxGL /82txZ4oTRDzSMTT9KuEV63aQYf4Z415Hkhtk8NYITVa2Hu+xk+EEyAURdl8dnn/uj0O 1s9X1LdMYieZWLy5Q2p2XxcoqQCzG6B3oOtnbgWAgNynKKUgQG8Z+g0q0MmxEuCIN3Qf 0GaA== X-Gm-Message-State: AO0yUKWTmLku8VosMfoWBkmRBAwjGAQRRcTD1X3MKAKKiQP06z43/P/L 7buWJ4rqxpRO30DCExLkGxfmAthrr9DMhqtH+Fc= X-Google-Smtp-Source: AK7set+wbQuvmPIocpktn94RDg43NUVD567ZqCQhDXcXKVG0qxrfw6z5v7AAYXN01famGVeVLvVhAg== X-Received: by 2002:ac8:7dc2:0:b0:3b8:68df:fc75 with SMTP id c2-20020ac87dc2000000b003b868dffc75mr9086961qte.31.1675103451787; Mon, 30 Jan 2023 10:30:51 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-31da-0362-f50e-b4ac.res6.spectrum.com. [2603:6081:7b00:6400:31da:362:f50e:b4ac]) by smtp.gmail.com with ESMTPSA id 8-20020a05620a078800b0070383f1b6f1sm8515788qka.31.2023.01.30.10.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 10:30:51 -0800 (PST) Date: Mon, 30 Jan 2023 13:30:49 -0500 From: Tom Rini To: Heinrich Schuchardt Cc: Ilias Apalodimas , u-boot@lists.denx.de, Andre Przywara Subject: Re: [PATCH 1/1] efi_loader: stop watchdogs in ExitBootServices() Message-ID: References: <20230128085745.18389-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LIziLQMmWN/gqMR/" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean --LIziLQMmWN/gqMR/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > > The UEFI specification requires for ExitBootServices() that "the boot > > services watchdog timer is disabled". We already disable the software > > watchdog. We should additionally disable the hardware watchdogs. > >=20 > > Reported-by: Andre Przywara > > Signed-off-by: Heinrich Schuchardt > > --- > > lib/efi_loader/efi_boottime.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > >=20 > > diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottim= e.c > > index ba28989f36..71215af9d2 100644 > > --- a/lib/efi_loader/efi_boottime.c > > +++ b/lib/efi_loader/efi_boottime.c > > @@ -19,6 +19,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -2171,6 +2172,11 @@ static efi_status_t EFIAPI efi_exit_boot_service= s(efi_handle_t image_handle, > > list_del(&evt->link); > > } > > =20 > > + /* Disable watchdogs */ > > + efi_set_watchdog(0); > > + if IS_ENABLED(CONFIG_WDT) > > + wdt_stop_all(); > > + > > if (!efi_st_keep_devices) { > > bootm_disable_interrupts(); > > if (IS_ENABLED(CONFIG_USB_DEVICE)) > > @@ -2196,10 +2202,6 @@ static efi_status_t EFIAPI efi_exit_boot_service= s(efi_handle_t image_handle, > > =20 > > /* Recalculate CRC32 */ > > efi_update_table_header_crc32(&systab.hdr); > > - > > - /* Give the payload some time to boot */ > > - efi_set_watchdog(0); > > - schedule(); > > out: > > if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) { > > if (ret !=3D EFI_SUCCESS) >=20 > 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. --=20 Tom --LIziLQMmWN/gqMR/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPYDNkACgkQFHw5/5Y0 tyx7/Av8DrMq8HuVtbQWmqpnjXusAKPdToznzvNU1DP8IVW8vV7mM7jYxRttN0iC nVXOJfGyTDpaYf1ErVuUvxc8KnwFJyc9+N+lBRjLPDWMf8VF/OciCKfqlvWPmnL7 RZcmH50PgaH8fPaqEdIQdc06cLD3PFv42T1tdZwDVbqvIHuka3OrRXG7Mq7NSNIN RioZJs4rGk+hFnrPRULNcVpQvxt799xJYlVHjQIwpmPEsJQGrK9/YLQgsmgMJ0ha 60MT3dTfkLdZutBNyqNfgY+U85bNMUEh+4JFZMq7WFDaDcsUMuSa1QB5n010TpoI qx9zuHGye4S0Ky0usSjNjcgDoC5I8Lz2TqRc5n2v0bZLnEZK8nZfWCTq7mokvuAr zZmB3wzz1hT4Y8POYDrDD13uwsUrKIC9XioRsuO07CrymY504h7MJCQWMgcIE8xS 1mvAA4rDn/Wh8GFBahMcuC25MoCxLly5rxH6whyHEggvV3Zrygs3B6bbT4ozaq6W zqIxIM+b =QNxJ -----END PGP SIGNATURE----- --LIziLQMmWN/gqMR/--