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 D8DADC433F5 for ; Mon, 10 Oct 2022 18:14:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA1F484E35; Mon, 10 Oct 2022 20:14:35 +0200 (CEST) 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="MQyXUB3i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AF60284EF3; Mon, 10 Oct 2022 20:14:33 +0200 (CEST) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (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 30E7784E34 for ; Mon, 10 Oct 2022 20:14:29 +0200 (CEST) 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-qk1-x732.google.com with SMTP id s7so3195744qkj.1 for ; Mon, 10 Oct 2022 11:14:29 -0700 (PDT) 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=JZJ1D81JK00kwOqBID+yQHtjEJFPoT4oXQZK1FJj/hc=; b=MQyXUB3i3bWNq8m0oUNIlx9cn6d7Z8HAQf3FkJhunHopoPvhNabtjugVaOqAwpIYfz BlicEFp+WzwRLqZkcP9KVg4HXURHm9n170ZwlXdr04RvJ2SSfx1sykf29b6P1j4raZ0w CjhFZqV8GwmOvFj9ZG6CitDjmMdDu+/tkpOX4= 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=JZJ1D81JK00kwOqBID+yQHtjEJFPoT4oXQZK1FJj/hc=; b=opsG2h5hoLi1eqs0sahRb+Zxy6zNRBr2IZ9mhTA2YBjR9qy6wAUm4B3molcR/q5iCr lDC6UqX+a2Ov/RzmmwORWFjgpVJq+wTjTZIVB34f0ydKU4gklYHeK5+D1Qx8IFyQW+yp 21QK8A5EtAxYpxF1Ag5N7dCW3MxlBP4OfAMPd32Cp2aW29+eL1CVvVq42SMWULu+S+sA /YxjXLXSSRm42OlE3fS7p4UcvaNEvx2vaY4cCtGaRasslHxzP1vepGTDKmEziV1vVDJZ PNbE07SWrPegM1/egL0IHxmANhVndJRyqubTBW23EptCMtu5gMug6wWhpKcQboLM5dYj vi5A== X-Gm-Message-State: ACrzQf3yciHXONp8fqqZPdvx0lh/S/Ok55pup5rVY/ejoY+7yzrBXkBW TvG8bGAKZRDAr/MJ3/ui0v5mBQ== X-Google-Smtp-Source: AMsMyM4ChxdzFWV3lCd+JyWth7c53U/9UFtG3N2S/0umA47aiQBzJMWKdruOCDuZDDYG3drF1M23MA== X-Received: by 2002:a37:ae87:0:b0:6d1:debe:4cf4 with SMTP id x129-20020a37ae87000000b006d1debe4cf4mr13994080qke.655.1665425667881; Mon, 10 Oct 2022 11:14:27 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-9534-07b5-32fb-791d.res6.spectrum.com. [2603:6081:7b00:6400:9534:7b5:32fb:791d]) by smtp.gmail.com with ESMTPSA id f11-20020a05620a280b00b006ce515196a7sm10877601qkp.8.2022.10.10.11.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 11:14:27 -0700 (PDT) Date: Mon, 10 Oct 2022 14:14:25 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Stefan Roese , u-boot@lists.denx.de Subject: Re: Broken watchdog in u-boot master branch Message-ID: <20221010181425.GR2020586@bill-the-cat> References: <20221009191225.65jwebefhqng3qbi@pali> <20221010162818.GM2020586@bill-the-cat> <20221010172256.jb4qwvgsbcucwejf@pali> <20221010174038.GP2020586@bill-the-cat> <20221010174405.5rvz7aclukn567gj@pali> <20221010175610.GQ2020586@bill-the-cat> <20221010180123.p7p4gfo2aa6u6zi3@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TN8pJM9vJMHHFgJc" Content-Disposition: inline In-Reply-To: <20221010180123.p7p4gfo2aa6u6zi3@pali> 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 --TN8pJM9vJMHHFgJc Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 10, 2022 at 08:01:23PM +0200, Pali Roh=E1r wrote: > On Monday 10 October 2022 13:56:10 Tom Rini wrote: > > On Mon, Oct 10, 2022 at 07:44:05PM +0200, Pali Roh=E1r wrote: > > > On Monday 10 October 2022 13:40:38 Tom Rini wrote: > > > > On Mon, Oct 10, 2022 at 07:22:56PM +0200, Pali Roh=E1r wrote: > > > > > On Monday 10 October 2022 12:28:18 Tom Rini wrote: > > > > > > On Sun, Oct 09, 2022 at 09:12:25PM +0200, Pali Roh=E1r wrote: > > > > > > > Hello! Watchdog code seems to be broken in u-boot master bran= ch. > > > > > > > On Nokia N900 I'm getting following message in qemu: > > > > > > >=20 > > > > > > > cyclic function rx51_watchdog took too long: 10000us vs 1000u= s max, disabling > > > > > > >=20 > > > > > > > Seems that watchdog core code is not prepared for "slower" wa= tchdogs > > > > > > > which communicate over slower i2c bus, like it is the case fo= r N900. > > > > > > >=20 > > > > > > > Disabling slower watchdog is a bad idea as it would result in= reboot > > > > > > > loop instead of slower - but working code. > > > > > >=20 > > > > > > So, looking at this in more detail, we have > > > > > > CONFIG_CYCLIC_MAX_CPU_TIME_US as a configuration option (which = is where > > > > > > the too long comes from). And picking a random CI run: > > > > > > https://source.denx.de/u-boot/u-boot/-/jobs/511177 > > > > > > I do see we hit this in CI once, but not every time, QEMU runs = here. Is > > > > > > that the max time is configurable enough to satisfy your concer= ns here? > > > > >=20 > > > > > It is needed to investigate, how to _properly_ fix this issue, no= t just > > > > > workarounded it. Probably other boards may be affected. > > > >=20 > > > > So it's the cyclic watchdog code, which we merged as early as possi= ble > > > > that's the reason here. And it was merged as early as we could to s= ee if > > > > there's problems. Are there problems? We're seeing "system too slow, > > > > disabling" on QEMU, sometimes, and the value of too slow is > > > > configurable. I know you reported other problems with n900 HW, so we > > > > can't see if it's failing there > > >=20 > > > I was tested it with older asm code (as described in that other email, > > > via git checkout commit -- file) on n900 HW and watchdog problem is > > > there too. Phone reboots in about 20 seconds. But as I do not have > > > serial console, I do not know if that "disabling" message is printed > > > there too (but I guess it is). > >=20 > > I think I'm a bit baffled at this point, honestly. The watchdog timeout > > is 60 seconds. If you're confident in it being about 20 seconds, > > consistently, changing WATCHDOG_TIMEOUT_MSECS to say 10000 (so, 10 > > seconds) should let you see if U-Boot has configured the watchdog and > > it's being tripped, or if it's still at the prior stage value. >=20 > $ git grep CONFIG_WATCHDOG_TIMEOUT_MSECS configs/nokia_rx51_defconfig > configs/nokia_rx51_defconfig:CONFIG_WATCHDOG_TIMEOUT_MSECS=3D31000 >=20 > Also watchdog is started by NOLO (which loads and execute U-Boot) so > there can be some smaller timeout. >=20 > So I have feeling that on the real HW is same issue. cyclic code > disabled watchdog kicking and then watchdog restarted phone. >=20 > I do not remember exact time (if it is 20s or 25s; I have not measured > it precisely), but it sounds plausible. OK, so what happens if you increase CONFIG_CYCLIC_MAX_CPU_TIME_US to something very high (so we should still enable the watchdog and configure the timeout) along with CONFIG_WATCHDOG_TIMEOUT_MSECS being high too (so if we can't service it in time really it's so long as to be noticeable) ? Or CONFIG_WATCHDOG_TIMEOUT_MSECS to something much lower (so that if the device is resetting quicker we're crashing elsewhere) ? --=20 Tom --TN8pJM9vJMHHFgJc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmNEYP4ACgkQFHw5/5Y0 tyw9nQv7BIaqfkxyr2/JIAS7yD1sVIsjL2V7EX+2HIQ0TJnpJHHoJIgllT55q08i JwDDQ5Js/y+KYcnOe7hjBA5QvusuNjBuC+gSOvIORTPDVWF3r5Otti9xXUFzKgqT N4LL5ciNNJodUs7rQ/0uTNmz94OvWW3Xe7IBb4UvlyD8cPCuN4Rajv/5MZ2YuxGC TPmmdNojg289Z3qsmBeuaOP9zM6eMvxs0fYWJqY1kCrfDnDEPZ0jnALzfv1PIC6N N246SotiC/oqpFAm6KwqYhW52nODlMkCYwFWFSUB2jWBCoKD+N11JH8PROEl+Kzn d7PSGd4XMkijQRCYFZ0nxw/rEr6fYghxBlslf1uYcLx200AIDRsOdcKwQvJ1lGF3 ByDJrXkcLZf5Tgh8MSwNKrDXDL5wNtyZSCEnO0YxCIz5S5Zk1pF7MITE+hNgamJJ 2F//jjYV3cymK91me/Qrf4kzx2xbwLztNlah73PMM+qejY2QgvPEfLpa/+rOpdBI /s8NcrxF =Z9T2 -----END PGP SIGNATURE----- --TN8pJM9vJMHHFgJc--