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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C709C433EF for ; Sat, 6 Nov 2021 13:54:07 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DFC5C611EF for ; Sat, 6 Nov 2021 13:54:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DFC5C611EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72BD183769; Sat, 6 Nov 2021 14:54:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (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="jlS4oIT7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 772AF83769; Sat, 6 Nov 2021 14:54:01 +0100 (CET) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (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 78C4983769 for ; Sat, 6 Nov 2021 14:53:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82d.google.com with SMTP id m25so398663qtq.13 for ; Sat, 06 Nov 2021 06:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WovaXxphon0u27xLn6UT5H6C4TDIMoc0R+lhY+otrzA=; b=jlS4oIT73akhCbAIjWBg9MelnzPc53btkanzKc3clhIZCYXJkNORmleDYn5tVPspFv TB0ahPUUe70wloxWqWFr1qwRXSbjF5Umi3oVrYKKTWYj213iwscIxdUmyxyxq1/s2rrO x1j1CgpaWw1E9mSNNlnwU0lqHbKyCFtPhwe0U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WovaXxphon0u27xLn6UT5H6C4TDIMoc0R+lhY+otrzA=; b=vLoEPYYK7gyIAGiVpefz18c/jFLgW2r/6jbeNoWyvKx9IA0OOlxtg0Pg2OI8UmyFct yl6KRJbYThFCjaGEb3l88+HpbYGZF9YyTSw7c7YVu9e2exc2Imde+Wri+UEuREo2S9bA b/2Hw4wIraCMmxHMZy3OyiAei0Yp06lu0HhCBzUpzZ7ueHxtAB7bMkOXCZfH2Yh2egAN KFfmnqAb6SBX+i0HAOF+2mlNzVYxJSs6DB3ZGYWm4mesnYejbYVaelaZu/m68L4zoxoz 1AnUePxR5JqzZ2yzFc6SWDjgKtuyT8/EztM20tA9eqM3wH7/k+tvs4mmHJELNf/RxF5n DYxA== X-Gm-Message-State: AOAM532JtEDacBZWWgkd5QCzt1q2PMtBP09EFUZf825IctbHP8Jt6J6Z voroZKvzUmVqHmJVH0kILn0Qug== X-Google-Smtp-Source: ABdhPJyADFgp0pxVecdscp8yr8YfF5Qz97iMlnQKxCiB7KA5A43GQ2kMEbP3WQ5GiJ0tuWLwwTwZvA== X-Received: by 2002:a05:622a:50a:: with SMTP id l10mr70579925qtx.73.1636206835137; Sat, 06 Nov 2021 06:53:55 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-dcf7-3600-6b4c-294c.res6.spectrum.com. [2603:6081:7b01:cbda:dcf7:3600:6b4c:294c]) by smtp.gmail.com with ESMTPSA id p16sm7283460qtx.92.2021.11.06.06.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Nov 2021 06:53:54 -0700 (PDT) Date: Sat, 6 Nov 2021 09:53:52 -0400 From: Tom Rini To: Heinrich Schuchardt Cc: Andre Przywara , Samuel Holland , Stefan Roese , Harald Seiler , u-boot@lists.denx.de, Jagan Teki , Bin Meng , Sean Anderson , Simon Glass Subject: Re: [PATCH v3 0/6] Improved sysreset/watchdog uclass integration Message-ID: <20211106135352.GL24579@bill-the-cat> References: <20211105100419.617375a7@donnerap.cambridge.arm.com> <53ead8ab-bd0b-afff-b738-c92366080333@denx.de> <20211105142120.GS24579@bill-the-cat> <9562b6e2-73d1-09c6-5c1e-fcecade5d0fb@canonical.com> <20211105191735.GW24579@bill-the-cat> <20211105225634.GJ24579@bill-the-cat> <20211106015230.1d1895cf@slackpad.fritz.box> <8f221d27-7065-2f19-c850-4e889a238c72@canonical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="X1gmFB0VGnFkIrKA" Content-Disposition: inline In-Reply-To: <8f221d27-7065-2f19-c850-4e889a238c72@canonical.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean --X1gmFB0VGnFkIrKA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 06, 2021 at 04:55:44AM +0100, Heinrich Schuchardt wrote: >=20 >=20 > On 11/6/21 02:52, Andre Przywara wrote: > > On Fri, 5 Nov 2021 18:56:34 -0400 > > Tom Rini wrote: > >=20 > > > On Fri, Nov 05, 2021 at 09:38:50PM +0100, Heinrich Schuchardt wrote: > > > > On 11/5/21 20:17, Tom Rini wrote: > > > > > On Fri, Nov 05, 2021 at 07:37:02PM +0100, Heinrich Schuchardt wro= te: > > > > > > On 11/5/21 17:12, Simon Glass wrote: > > > > > > > Hi, > > > > > > >=20 > > > > > > > On Fri, 5 Nov 2021 at 08:21, Tom Rini wr= ote: > > > > > > > >=20 > > > > > > > > On Fri, Nov 05, 2021 at 12:14:47PM +0100, Stefan Roese wrot= e: > > > > > > > > > Hi Andre, > > > > > > > > >=20 > > > > > > > > > Added Tom to Cc. > > > > > > > > >=20 > > > > > > > > > On 05.11.21 11:04, Andre Przywara wrote: > > > > > > > > > > On Thu, 4 Nov 2021 20:02:41 -0600 > > > > > > > > > > Simon Glass wrote: > > > > > > > > > >=20 > > > > > > > > > > Hi, > > > > > > > > > > > On Thu, 4 Nov 2021 at 19:22, Stefan Roese wrote: > > > > > > > > > > > >=20 > > > > > > > > > > > > Hi Andre, > > > > > > > > > > > >=20 > > > > > > > > > > > > On 05.11.21 00:11, Andre Przywara wrote: > > > > > > > > > > > > > On Thu, 4 Nov 2021 11:37:57 +0100 > > > > > > > > > > > > > Stefan Roese wrote: > > > > > > > > > > > > >=20 > > > > > > > > > > > > > Hi Stefan, > > > > > > > > > > > > > > On 04.11.21 04:55, Samuel Holland wrote: > > > > > > > > > > > > > > > This series hooks up the watchdog uclass to a= utomatically register > > > > > > > > > > > > > > > watchdog devices for use with sysreset, doing= a bit of minor cleanup > > > > > > > > > > > > > > > along the way. > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > The goal is for this to replace the sunxi boa= rd-level non-DM reset_cpu() > > > > > > > > > > > > > > > function. I was surprised to find that the wd= t_reboot driver requires > > > > > > > > > > > > > > > its own undocumented device tree node, which = references the watchdog > > > > > > > > > > > > > > > device by phandle. This is problematic for us= , because sunxi-u-boot.dtsi > > > > > > > > > > > > > > > file covers 20 different SoCs with varying wa= tchdog node phandle names. > > > > > > > > > > > > > > > So it would have required adding a -u-boot.dt= si file for each board. > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > Hooking things up automatically makes sense t= o me; this is what Linux > > > > > > > > > > > > > > > does. However, I put the code behind a new op= tion to avoid surprises for > > > > > > > > > > > > > > > other platforms. > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > Changes in v3: > > > > > > > > > > > > > > > - Move condition to wdt-uclass.c to fi= x build errors. > > > > > > > > > > > > > > > - Include watchdog name in error messa= ge. > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > Changes in v2: > > > > > > > > > > > > > > > - Extend the "if SYSRESET" block to th= e end of the file. > > > > > > > > > > > > > > > - Also make gpio_reboot_probe function= static. > > > > > > > > > > > > > > > - Rebase on top of 492ee6b8d0e7 (now h= andle all watchdogs). > > > > > > > > > > > > > > > - Added patches 5-6 as an example of h= ow the new option will be used. > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > Samuel Holland (6): > > > > > > > > > > > > > > > sysreset: Add uclass Kconfig dependen= cy to drivers > > > > > > > > > > > > > > > sysreset: Mark driver probe functions= as static > > > > > > > > > > > > > > > sysreset: watchdog: Move watchdog ref= erence to plat data > > > > > > > > > > > > > > > watchdog: Automatically register devi= ce with sysreset > > > > > > > > > > > > > > > sunxi: Avoid duplicate reset_cpu with= SYSRESET enabled > > > > > > > > > > > > > > > sunxi: Use sysreset framework for pow= eroff/reset > > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > > arch/arm/Kconfig |= 3 +++ > > > > > > > > > > > > > > > arch/arm/mach-sunxi/board.c |= 2 ++ > > > > > > > > > > > > > > > drivers/sysreset/Kconfig |= 11 ++++++-- > > > > > > > > > > > > > > > drivers/sysreset/sysreset_gpio.c |= 2 +- > > > > > > > > > > > > > > > drivers/sysreset/sysreset_resetctl.c |= 2 +- > > > > > > > > > > > > > > > drivers/sysreset/sysreset_syscon.c |= 2 +- > > > > > > > > > > > > > > > drivers/sysreset/sysreset_watchdog.c |= 40 ++++++++++++++++++++++------ > > > > > > > > > > > > > > > drivers/watchdog/wdt-uclass.c |= 8 ++++++ > > > > > > > > > > > > > > > include/sysreset.h |= 10 +++++++ > > > > > > > > > > > > > > > 9 files changed, 67 insertions(+), 13 = deletions(-) > > > > > > > > > > > > > >=20 > > > > > > > > > > > > > > Applied to u-boot-marvell > > > > > > > > > > > > >=20 > > > > > > > > > > > > > Mmmh, why u-boot-marvell, > > > > > > > > > > > >=20 > > > > > > > > > > > > Because I'm handling watchdog related changed since= a few years and we > > > > > > > > > > > > did not create a specific subsystem repo for this a= nd I'm usually > > > > > > > > > > > > using my "marvell" one for this. > > > > > > > >=20 > > > > > > > > And fwiw, there's a few other cases like this. If it's too= confusing, > > > > > > > > maybe we should just roll out a few more repositories, I th= ink it's > > > > > > > > easier to do that now than pre-gitlab? > > > > > > > > > > > > > and why did this end up already in master? > > > > > > > > > > > > > Isn't that material for the next merge window? Af= ter all this changes > > > > > > > > > > > > > quite a bit, for a lot of boards, and I did not h= ave a closer look at > > > > > > > > > > > > > the sunxi parts yet. > > > > > > > > > > > >=20 > > > > > > > > > > > > I was hesitating also a bit. But since this patchse= t is on the list in > > > > > > > > > > > > v1 since over 2 months now (2021-08-21) I thought i= t was "ready" for > > > > > > > > > > > > inclusion now. We are at -rc1 and I think we still = have enough time to > > > > > > > > > > > > fix any resulting problems in this release cycle. > > > > > > > > > >=20 > > > > > > > > > > Why do we have the merge window then? This is clearly n= ot a regression or > > > > > > > > > > general fix. > > > > > > > > >=20 > > > > > > > > > AFAIU, we are a bit less strict here in U-Boot. Patches t= hat were posted > > > > > > > > > before the merge-window and skipped the review process (m= ost likely > > > > > > > > > because of lack of time) are often still integrated in th= e early rcX > > > > > > > > > cycles. At least this is how I handle it usually. > > > > > > > > >=20 > > > > > > > > > Tom, is my understanding here correct? > > > > > > > >=20 > > > > > > > > Yes. We are not as strict as the kernel is about what can = come in > > > > > > > > between rc1 and rc2 (and to a certain degree, post rc2). I= leave things > > > > > > > > up to the discretion of the custodians. People tend of hav= e less time > > > > > > > > to handle U-Boot changes than other stuff, so I try and be = flexible in > > > > > > > > picking things up. > > > > > > > > > > > Yes I agree, that should be plenty of time for people= to review it. > > > > > > > > > >=20 > > > > > > > > > > Well, if there would be people to review the sunxi part= s :-( > > > > > > > > > > I am totally fine with the generic patches (as they hav= e been reviewed), > > > > > > > > > > but the sunxi integration is somewhat risky. > > > > > > > > > > I was explicitly deprioritising that in my queue, as it= really doesn't > > > > > > > > > > change, add or fix anything, it's mere refactoring, fro= m the user's point > > > > > > > > > > of view. > > > > > > > > > > > > Do you see any specific issues? > > > > > > > > > >=20 > > > > > > > > > > Patch 6/6 changes the config for all 157 Allwinner boar= ds, so I think that > > > > > > > > > > deserves at least some testing, *before* merging it. > > > > > > > > >=20 > > > > > > > > > I expect that Samuel did some testing. But still, I agree= that it > > > > > > > > > would be much better, if these patches - especially the A= llwinner parts > > > > > > > > > got more extensive testing. > > > > > > > > > > I will do as much testing now as possible, but I am not= happy about that > > > > > > > > > > situation. > > > > > > > > >=20 > > > > > > > > > Understood. Should we revert patch 6/6 for now? > > > > > > > >=20 > > > > > > > > FWIW, given Samuel has been doing a number of allwinner cha= nges, I had > > > > > > > > also assumed it was sufficiently tested, which is why I did= n't raise a > > > > > > > > further concern when I saw the widespread nature of the ove= rall changes, > > > > > > > > just figured it was a few more ready-to-go cleanups that we= ren't quite > > > > > > > > picked up in time. Please do speak up if you want me to re= vert the last > > > > > > > > part. > > > > > > >=20 > > > > > > > Also it is often true that people find problems by testing on= master > > > > > > > so applying it helps to shake the tree a bit. > > > > > > >=20 > > > > > > > Regards, > > > > > > > Simon > > > > > >=20 > > > > > > We don't actually have a problem with this series but with a pr= evious > > > > > > watchdog patch. The culprit according to bisecting is: > > > > > >=20 > > > > > > b147bd3607f8 ("sunxi: Enable watchdog timer support by default") > > > > > >=20 > > > > > > When booting the OrangePi PC the watchdog triggers while Linux = is booting, > > > > > > ca. 16 s after leaving the UEFI subsystem. This matches WDT_MAX= _TIMEOUT in > > > > > > drivers/watchdog/sunxi_wdt.c. > > > > > >=20 > > > > > > If I run > > > > > > =3D> wdt dev watchdog@1c20ca0 > > > > > > =3D> wdt stop > > > > > >=20 > > > > > > before the bootefi command booting succeeds. > > > > > >=20 > > > > > > We don't disarm the watchdog and Linux does not do it for us in= time. > > > > > >=20 > > > > > > The UEFI specification requires that the default watchdog reset= time is 300 > > > > > > s. We should never arm the Sunxi hardware watchdog except withi= n the > > > > > > watchdog reset driver. > > > > > >=20 > > > > > > The solution is to disable CONFIG_WATCHDOG_AUTOSTART on SUNXI. = See > > > > > >=20 > > > > > > [PATCH 1/1] watchdog: don't autostart watchdog on Sunxi boards > > > > > > https://lists.denx.de/pipermail/u-boot/2021-November/466318.html > > > > >=20 > > > > > This means we never did come up with a satisfactory to everyone s= olution > > > > > to what UEFI thinks a watchdog should do, and what other types of > > > > > deployment think a watchdog should do, yes? > > > >=20 > > > > Dear Tom, > > > >=20 > > > > The issue is *not* UEFI specific. > > > >=20 > > > > A watchdog timeout of 16 seconds is too short for Linux to boot no = matter > > > > whether you use the EFI stub or the legacy entry point. > > > >=20 > > > > I only referred to the UEFI specification as it indicates what can = be > > > > considered as a reasonable timeout interval: 300 seconds. > > >=20 > > > 16 seconds from the last time we pet the watchdog in U-Boot to the > > > kernel being able to take over is quite reasonable. > >=20 > > How do we know that the kernel takes over? What if the kernel/EFI > > payload doesn't have a watchdog driver? I was assuming that the > > watchdog would be disabled as soon as we boot a kernel or an EFI app > > calls ExitBootServices (maybe even earlier). > > But this sounds like a generic problem, not sunxi specific. So how do > > other platforms solve this? > >=20 > > Cheers, > > Andre >=20 > The UEFI specification has this requirement in chapter "3.1.2 Load Option > Processing": >=20 > "... the boot manager must enable the watchdog timer for 5 minutes by usi= ng > the EFI_BOOT_SERVICES.SetWatchdogTimer() boot service prior to calling > EFI_BOOT_SERVICES.StartImage(). If a boot option returns control to the b= oot > manager, the boot manager must disable the watchdog timer with an additio= nal > call to the SetWatchdogTimer() boot service." >=20 > This means that having an armed watchdog when starting the kernel is > correct. >=20 > If you start a watchdog in the firmware which is not disabled or reset by > the operating system, you are out of luck and won't be able to boot. >=20 > Current Linux has driver drivers/watchdog/sunxi_wdt.c compatible to > "allwinner,sun4i-a10-wdt","allwinner,sun6i-a31-wdt" and enabled by > CONFIG_SUNXI_WATCHDOG. This driver was introduced in Linux v3.12. It > originally had compatible "allwinner,sun4i-wdt" only. >=20 > Debian Bullseye has the driver enabled as a module. In the bootlog of the > Orange Pi PC I find: > [ 12.321909] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=3D16= sec, > nowayout=3D0) > This message appears approximately *20 seconds* after the EFI stub hands > over to the main kernel. Adding the driver to initrd shortens this to *18 > seconds*. The message occurs after file system checks which can be a leng= thy > operation. In Debian systemd manages the watchdog. >=20 > As I said: 16 seconds is way too short for a hardware watchdog timeout. What's the time if you build it in? --=20 Tom --X1gmFB0VGnFkIrKA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmGGiPAACgkQFHw5/5Y0 tyyfFgwAkiNKh3CHVbFV/bS11XWn2rW2GxUWr+niCTh1WnFaZzOJuOy9iOoe0HwR nMiKiKjzeBufCHUcM91/rflRYdpxLclB0L3l1lfVKuczR2nlM+Dy+QvO9ed4Cifj 6+msygmTlA4nfkWT8KHNdP1IkEYdgQaH35xIUTURjCYAjHnsL5cEF8JcKzJ/ERUp Roz8s3FZlvDsU8zMlCpDIgu1OdaGp8hC133l5PeNxKSiSDBRftKp9OHYtuoU4Vlq kiaIFUDSapjeiRNaGjyL2TOHwLSYSwOAkxj9RGd8WCHyX6rrfXH8vbieWn3CHVH6 5qNelLVwms9Ow1yjsuGHqajCaTAn9SBsMNt4cT0i+OVjqGKbzsrtE8fK9iLe+Xqw C+GVkSFq1l7ZQzPDRxXnZjTbFJyV31DX+T6h/C7T544MSgjBd38wCL45E2f5pv41 4sqjtpU0QWCeSG7jHp78J6X7pHD8rAS0F5LAzPGjZu9ouRsLegW6ZNJYptkS53zH nC/0diEc =lqk/ -----END PGP SIGNATURE----- --X1gmFB0VGnFkIrKA--