Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1460485pxf; Fri, 9 Apr 2021 08:58:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDlFMGWT/cEuS867We+WX4qCrEyV32U1k8pU9wvugJXSPV9HBwNixlMeHqqsIDdi3jpBJu X-Received: by 2002:a05:6402:1517:: with SMTP id f23mr18614899edw.272.1617983888057; Fri, 09 Apr 2021 08:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617983888; cv=none; d=google.com; s=arc-20160816; b=P/Fw+PrNpkz2uUaOpApqghtBbH4FrVEt3oiJcB1hQRklcwPtIzsZEOG9clZUZlbxNy L1lMFvOuOWOe+d86eQRR1FWsE7IgfUeFTeSsUidssQDrGFT5z3fiZp9f290cNoss4hWk tPCweDw7EPItnQ+I8P8YBgTdgTU82d7Dh2GgtCKaq/Kt5tluUo30QF+vImxldHyS5GGj LvJ626CKwz28AxF+4555tGINcndTi7vaFciUpXql4N5GfsR1akNbwUlMmmMmX2e1ruTj pIGOpmjJDS2hbMLh0Jr1IkZFdvfTUC2ZbvomM9lArDks1vkC6yDdiviGbPGv0q4k37d9 qkeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=zS4oOL5HKDn9FDzihO/lTrV8DNOB2FWtFwRfLW84+lc=; b=GCJVOA+vKgw4fVhXQwpY35+Sx5z/HflMgLD3FcqwOnCYQOkfpNaBcn2xIflSksLdmM 2c9LaXAMpF80ogbWKF7VyCswgFnPcF36mE7wqnmnO37k686UH/R8K/wptv4340M2dVUD I276N8g6/jFogyEZwIbgJcw0DimlDPOwk4Uyz8792Iv/UVe6Mpn5U8C4LLA8CUmqYqQ4 avMN8OGWDg4nGBtCzLC7+wz2DjYs/ODCQTehRgU7FAf1AFxOeaFpEOplk4g3l9pZwFl7 +GA1Xm64KligrNvwVOoevKw31uBbKgVCQfxahRzhXhok0su/HNEzLVSU1m7xbfBs79gM /Dlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IWHF1EDZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x16si2243598eju.428.2021.04.09.08.57.45; Fri, 09 Apr 2021 08:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IWHF1EDZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233599AbhDIP45 (ORCPT + 99 others); Fri, 9 Apr 2021 11:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232796AbhDIP44 (ORCPT ); Fri, 9 Apr 2021 11:56:56 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC8E4C061760; Fri, 9 Apr 2021 08:56:43 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id r17-20020a4acb110000b02901b657f28cdcso1441796ooq.6; Fri, 09 Apr 2021 08:56:43 -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:content-language :content-transfer-encoding; bh=zS4oOL5HKDn9FDzihO/lTrV8DNOB2FWtFwRfLW84+lc=; b=IWHF1EDZ2QLXkKVqTO1X36F2AQAvhhQ7gxF8ExGQvugxEsH+sx38REIWFnjLPTIlwD Qe0CKfy04fPJjAzDVhTdhX4wXo9w3CEf/s7vnJxCXUhEhEDnYooA+i8ltu7ia9XJA8oY 83syYVfr40Lj16+wAJZeM7CXnLPpTbFEdeQpPLy8xDk9Rf/5lqyfpFU+0lIOrx8C3SF0 SdbTBfdCz52LNe/Nsu/kz1kn5CSB4HdI2KtSuv/kfFmBYE+I9UqbakNvvnOwqYQMRCMd agXUPyXQRg0cXJ4VyXKuNNJfpap99w1HRMvirU43FNhQ5TFSVaCD/5H39Cb5UnygbhnX uPCw== 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 :content-language:content-transfer-encoding; bh=zS4oOL5HKDn9FDzihO/lTrV8DNOB2FWtFwRfLW84+lc=; b=jFstaeIHSu5C4+wEZqpsoMqp4cOUfbGNoEBQDw0PfZhpVfFe5B7MNztelrFNHdC01D jBZHKGS85mRsd+YGiHQAzslmMKSVgwHMZsg7hzH8oSJngkt1dGx9A9srxc/O4zouYlqN S6nXUdpNXN8+vV/ln7G5Oj4BOLd19ki4Aq6q0BjumbtbxfbmQCzTvEHZYgbZD7q/Do9i RfE4k+vCwJR/rH+87ptXov87Cbj+F8RZStH9MdLwTLHEpH6UTFJyBMPPpWHn2JZ6/A7D q1Ca0m3eMzHRnfO6lkBXxYcUP77iennOwQGyeFFWj8NXC2fd3Tq8ZEPcaXXcbFe3r5gn clyQ== X-Gm-Message-State: AOAM533g7t/qCTGlf/RBq0HNrUIRD4QYprFO0KQpAb10nlbIqKgSpKYm zLB00ogCBhpZqHlkUH9Lb2Vycp0y/Uc= X-Received: by 2002:a4a:d10f:: with SMTP id k15mr12474691oor.82.1617983802774; Fri, 09 Apr 2021 08:56:42 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id a7sm587160ooo.30.2021.04.09.08.56.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Apr 2021 08:56:41 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH v1] watchdog: add new parameter to start the watchdog on module insertion To: Flavio Suligoi , Wim Van Sebroeck Cc: Mika Westerberg , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210409093434.2089459-1-f.suligoi@asem.it> 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/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d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Mg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Fri, 9 Apr 2021 08:56:39 -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: <20210409093434.2089459-1-f.suligoi@asem.it> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/9/21 2:34 AM, Flavio Suligoi wrote: > The new parameter "start_enabled" starts the watchdog at the same time > of the module insertion. > This feature is very useful in embedded systems, to avoid cases where > the system hangs before reaching userspace. > > This function can be also enabled in the kernel config, so can be > used when the watchdog driver is build as built-in. > > This parameter involves the "core" section of the watchdog driver; > in this way it is common for all the watchdog hardware implementations. > > Note: to use only for watchdog drivers which doesn't support this > parameter by itself. > > Signed-off-by: Flavio Suligoi > --- > Documentation/watchdog/watchdog-parameters.rst | 5 +++++ > drivers/watchdog/Kconfig | 14 ++++++++++++++ > drivers/watchdog/watchdog_core.c | 12 ++++++++++++ > 3 files changed, 31 insertions(+) > > diff --git a/Documentation/watchdog/watchdog-parameters.rst b/Documentation/watchdog/watchdog-parameters.rst > index 223c99361a30..623fd064df91 100644 > --- a/Documentation/watchdog/watchdog-parameters.rst > +++ b/Documentation/watchdog/watchdog-parameters.rst > @@ -21,6 +21,11 @@ watchdog core: > timeout. Setting this to a non-zero value can be useful to ensure that > either userspace comes up properly, or the board gets reset and allows > fallback logic in the bootloader to try something else. > + start_enabled: > + Watchdog is started on module insertion. This option can be also > + selected by kernel config (default=kernel config parameter). > + Use only for watchdog drivers which doesn't support this parameter > + by itself. Why ? > > ------------------------------------------------- > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 0470dc15c085..c2a668d6bbbc 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -47,6 +47,20 @@ config WATCHDOG_NOWAYOUT > get killed. If you say Y here, the watchdog cannot be stopped once > it has been started. > > +config WATCHDOG_START_ENABLED > + bool "Start watchdog on module insertion" > + help > + Say Y if you want to start the watchdog at the same time when the > + driver is loaded. > + This feature is very useful in embedded systems, to avoid cases where > + the system could hang before reaching userspace. > + This parameter involves the "core" section of the watchdog driver, > + in this way it is common for all the watchdog hardware > + implementations. "This parameter applies to all watchdog drivers.". The rest is implementation detail and irrelevant here. > + > + Note: to use only for watchdog drivers which doesn't support this > + parameter by itself. > + This comment is quite useless in the Kconfig description. If enabled, it is enabled, period. > config WATCHDOG_HANDLE_BOOT_ENABLED > bool "Update boot-enabled watchdog until userspace takes over" > default y > diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c > index 5df0a22e2cb4..5052ae355219 100644 > --- a/drivers/watchdog/watchdog_core.c > +++ b/drivers/watchdog/watchdog_core.c > @@ -43,6 +43,11 @@ static int stop_on_reboot = -1; > module_param(stop_on_reboot, int, 0444); > MODULE_PARM_DESC(stop_on_reboot, "Stop watchdogs on reboot (0=keep watching, 1=stop)"); > > +static bool start_enabled = IS_ENABLED(CONFIG_WATCHDOG_START_ENABLED); > +module_param(start_enabled, bool, 0444); > +MODULE_PARM_DESC(start_enabled, "Start watchdog on module insertion (default=" > + __MODULE_STRING(IS_ENABLED(CONFIG_WATCHDOG_START_ENABLED)) ")"); > + > /* > * Deferred Registration infrastructure. > * > @@ -224,6 +229,13 @@ static int __watchdog_register_device(struct watchdog_device *wdd) > * corrupted in a later stage then we expect a kernel panic! > */ > > + /* If required, start the watchdog immediately */ > + if (start_enabled) { > + set_bit(WDOG_HW_RUNNING, &wdd->status); > + wdd->ops->start(wdd); > + pr_info("Watchdog enabled\n"); > + } > + > /* Use alias for watchdog id if possible */ > if (wdd->parent) { > ret = of_alias_get_id(wdd->parent->of_node, "watchdog"); >