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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF8FCC4727D for ; Tue, 6 Oct 2020 11:56:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77E0B208B8 for ; Tue, 6 Oct 2020 11:56:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="umUwmQCn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbgJFL4V (ORCPT ); Tue, 6 Oct 2020 07:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726032AbgJFL4V (ORCPT ); Tue, 6 Oct 2020 07:56:21 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7BF0C061755; Tue, 6 Oct 2020 04:56:19 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id 26so12300386ois.5; Tue, 06 Oct 2020 04:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to; bh=JNHgnUkVCcHnTYb9aD+ejOV1q+BxbD2oTjD0QUoKHLM=; b=umUwmQCnLwmmp5iMp8nPNFyjp0ehREyrq0z5X2q9Xs2jTgp7kXNvswN+4NPXm9/JZh z08dh/uiCCKjl7mFaZgK+IIwc+RzLOC0u3fxxWrLl+KHz2yddjSKo0R4W4mr0HsuXWSY 5L2d/pP9lOylMF7EGy795YuT2z/hJQme0gM0sLSlg5jF7iJjgToTwFQqsvsdNFwujm8b qBfA7VXiSnLYxBwV3eQhY2X4nLHSlWkk2vjgeoeoF/l4sTOpAzcLWjNModx8VbTTDran l4btJ5mxhIzL9EdLVIT627pF5c4xVHQVxWICQ5KnWrwRrRnEqq1Coo5eRfi6beIjTY0n vwbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to; bh=JNHgnUkVCcHnTYb9aD+ejOV1q+BxbD2oTjD0QUoKHLM=; b=SJ7f9UuMzTLx08N4d4lTQzHo4HzFmzO2kpX7oE2z/cUtu/KyilU5Ph+jWVEiC0NkzG V17FvHou71JfvsCP1lDx0yysEcR+y/bbzvKwWi5eF9mkKUtpxeelxvhAgVvt0F5DZs5T cmnXYTAKQkiXWRQ21Mu9OvRFQsiVqDlpp8x3JSn7APRKpL5naGjTAiPwqx9dQ3+D0oYG hpLj15oUFo5ll/u8A+f6l7ECjl6bQLpv4a+JOmbyWDNLvSbThKU+xLa8BoyJfJYoOtkN 7VhqEJ+cGpNu5aNb8nh6ubS01PX6ihKjXxsyBSfxjxcBJ8obtGrwrNm1xYGNIw6VHKMg /NRg== X-Gm-Message-State: AOAM5315k4uo77lpFbWjrjbIPewUH3NPrObE71BSchQNIy6MfhuhLxGp u/R/5npvPXGYzInr6CW7CuY= X-Google-Smtp-Source: ABdhPJw3573ebO+CDzLiaIx8g3x6CssDiBihHtvtobq1wY1tFMbb1MMikEbtKfWT9BhwW9M0R50vhQ== X-Received: by 2002:a05:6808:7c9:: with SMTP id f9mr2587971oij.60.1601985379116; Tue, 06 Oct 2020 04:56:19 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u9sm819308otq.54.2020.10.06.04.56.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Oct 2020 04:56:18 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [RFC] Using a watchdog as system reset To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Wim Van Sebroeck , Rob Herring , Frank Rowand Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de References: <20201006102949.dbw6b2mrgt2ltgpw@pengutronix.de> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFug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v82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <460aa962-9da5-6e1e-b5db-3f9f1d78110a@roeck-us.net> Date: Tue, 6 Oct 2020 04:56:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201006102949.dbw6b2mrgt2ltgpw@pengutronix.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WQODpNfZgrxoq7AEGCHz66hUzA9sr7HHw" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WQODpNfZgrxoq7AEGCHz66hUzA9sr7HHw Content-Type: multipart/mixed; boundary="FyYnKfEh6zJBMIBpR7mCNOTRFUEs2AnEz" --FyYnKfEh6zJBMIBpR7mCNOTRFUEs2AnEz Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10/6/20 3:29 AM, Uwe Kleine-K=F6nig wrote: > Hello, >=20 > I have an i.MX25 system here with an external watchdog (using the > gpio_wdt driver). So the internal watchdog (imx2_wdt) is unused. >=20 > The problem with the unused imx2_wdt is that this usually provides the > restart handler and now a reboot ends with >=20 > reboot: Restarting system > Reboot failed -- System halted >=20 > until eventually the watchdog bites and resets the machine. >=20 > I imagine that this is a common enough issue to warrant a generic > solution. My suggestion is to formalize and implement something like: >=20 > watchdog { > compatible =3D "linux,wdt-gpio"; > ... > provide-system-reset; > } >=20 > with the sematic of: "This is the dedicated mechanism to reset this > machine." >=20 Some systems have more than one means to reset it, which is why restart handlers have a priority. This in turn suggests that we should maybe have a means to set that priority dynamically for the imx2_wdt driv= er (or for watchdog drivers in general) instead of having it fixed at 128. That would also solve your problem, assuming there is a different (currently lower priority) means to reset the hardware in your system. Alternatively, can't you just blacklist the imx2-wdt driver ? > (OK, I could enable the imx2_wdt driver and make sure with some udev > magic that the gpio watchdog is the one being fed by userspace. But > having two watchdogs fills me with some trepidation.) >=20 Hmm - that suggests that the reset may fail because the reset code in imx2_wdt doesn't work, not because it isn't wired. If so, the driver code handling the reset may be buggy or incomplete. Have you tried setting (or not setting) the fsl,ext-reset-output property ? > Having said that, I wonder what the typical restart callback does > different from setting the timeout to a minimal value, start it and the= n > maybe call delay() to not return until the watchdog triggers. At least > that's what I would do for a watchdog that doesn't provide an explicit > .restart handler but has the provide-system-reset property. The intent of the callback was to handle situations where the watchdog hardware also generates the system reset. The secondary use was for syste= ms which don't have a means to reset the system other than what you describe= above. Guenter >=20 > In my eyes this is somewhat of a hardware property, but I can imagine > that others don't agree and argue this shouldn't go into the device > tree. @Rob: What is your position here? >=20 > Does this sound sane? Do we also need a property like > "no-provide-system-reset" to better maintain backward compatibility? > (which then would result in not registering the watchdog as reset > trigger even if the driver provides a .restart.) > Does someone know a better name for the property? >=20 > Best regards > Uwe >=20 --FyYnKfEh6zJBMIBpR7mCNOTRFUEs2AnEz-- --WQODpNfZgrxoq7AEGCHz66hUzA9sr7HHw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAl98W2AACgkQyx8mb86f mYEx5Q//WnaG1XV8kZRM9t1hTpU954UiTZlKELiWX5w3tF4DQMwpUEBNxPivfSGN zLqK2oPrdMMQqliT+quFuiw2JqSlguGZEJYvGdZFEV6V1rtgcnYHrUCzoN41Nn5b wAK24NtPya8OWHiyd8BM+wK0X6fqrJxBo8QusTPJFW3O+i8E1pYpz3Shqqm/KRA5 zfpOk+dEOMK3mfzMbbOwrHDOav1wdaguZIR3rtOjTkcdsS8oXgO4EbjcDrF7uyiX PLGwGq08VApRollCz/XFwXur8F1fT2JEqmc7HNQPXGbNRVd84jC+6GPDOPFEnE35 Z86TlpurLwefDsi/RV4eTomaC++iOIN98a/gApVogro/Ft6vPh6q5CKNtdHTbm6V LOBAi26xNSKg7FEsJ3ieLNW+BjOv4yIxbKGWOXGleCjvAr5GgSkB3PQkcIWQH70X 2Mt4GQW8GMxU7jNWgLDBK3xVFUXfogIw4Y5i783x/aJHWQa7kog5lnnN5AgxnyH6 ceXJO2q1FSLJsPpRlpeEUmKJ+ew2vBrVmEVuRrm34s8NmJRO15lrIj1viSNSJnIV RxMdvV00rJTNSv9GYP9cP/sABrFD5mzTGOdaBzeIhlVPOihgV7udQSlBHNk99vkd xohWjgKxAVGV/iGfLyXhFzjXvmGJYtFRdvOMWH+O2SrVf14HnPI= =XKjw -----END PGP SIGNATURE----- --WQODpNfZgrxoq7AEGCHz66hUzA9sr7HHw--