From patchwork Wed Jun 5 14:06:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 10977065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1B5992A for ; Wed, 5 Jun 2019 14:07:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3866286A2 for ; Wed, 5 Jun 2019 14:07:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7DBD289B9; Wed, 5 Jun 2019 14:07:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 057CF289BD for ; Wed, 5 Jun 2019 14:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfFEOHA (ORCPT ); Wed, 5 Jun 2019 10:07:00 -0400 Received: from mail-eopbgr30099.outbound.protection.outlook.com ([40.107.3.99]:52096 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726442AbfFEOHA (ORCPT ); Wed, 5 Jun 2019 10:07:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yOmbqRprdhOKC9UKClMD8DJWbMbYU8RgxCwhdsb2ExI=; b=sfeL0LQRCbwxVcdKDtwi6qxr6Ave63ZYJXFuwrBBozmLcP6BsbBHFx6b6CVSKV5GkLOuQ30Mpfgls2B8RP2nrCOAvzq16Q1XEywItA9NKwyTJ2D8617BdqeofCPyRTibgTUPTrVdGgveDy2bWXmYh44pn6wZgMBUttb6kJE1Ndk= Received: from VI1PR10MB2639.EURPRD10.PROD.OUTLOOK.COM (20.178.126.80) by VI1PR10MB2382.EURPRD10.PROD.OUTLOOK.COM (20.177.62.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.12; Wed, 5 Jun 2019 14:06:52 +0000 Received: from VI1PR10MB2639.EURPRD10.PROD.OUTLOOK.COM ([fe80::8844:426d:816b:f5d5]) by VI1PR10MB2639.EURPRD10.PROD.OUTLOOK.COM ([fe80::8844:426d:816b:f5d5%6]) with mapi id 15.20.1965.011; Wed, 5 Jun 2019 14:06:51 +0000 From: Rasmus Villemoes To: "linux-watchdog@vger.kernel.org" , Guenter Roeck , Wim Van Sebroeck , Jonathan Corbet CC: "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" , Esben Haabendal , Jerry Hoemann , Rasmus Villemoes Subject: [PATCH v10 2/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT Thread-Topic: [PATCH v10 2/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT Thread-Index: AQHVG6fnvbmNMtqgXU2ZaYKZCJHrKA== Date: Wed, 5 Jun 2019 14:06:43 +0000 Message-ID: <20190605140628.618-3-rasmus.villemoes@prevas.dk> References: <20190605140628.618-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20190605140628.618-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0202CA0034.eurprd02.prod.outlook.com (2603:10a6:3:e4::20) To VI1PR10MB2639.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Rasmus.Villemoes@prevas.se; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [81.216.59.226] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c8c29bd9-5366-4706-f585-08d6e9bf099c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:VI1PR10MB2382; x-ms-traffictypediagnostic: VI1PR10MB2382: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 00594E8DBA x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(39850400004)(346002)(396003)(136003)(189003)(199004)(43544003)(6436002)(66066001)(76176011)(5660300002)(52116002)(478600001)(107886003)(71200400001)(71190400001)(6486002)(74482002)(3846002)(6116002)(44832011)(72206003)(2501003)(6512007)(54906003)(6666004)(486006)(2906002)(102836004)(73956011)(110136005)(8976002)(6506007)(99286004)(7736002)(386003)(53936002)(64756008)(446003)(316002)(476003)(66946007)(66556008)(81156014)(8676002)(81166006)(66446008)(11346002)(66476007)(4326008)(14454004)(50226002)(25786009)(2616005)(305945005)(26005)(36756003)(68736007)(42882007)(186003)(256004)(8936002)(14444005)(1076003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR10MB2382;H:VI1PR10MB2639.EURPRD10.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: prevas.se does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qhmKc3aqmsF29MGOHd2j5hy8u1MM5oOB2Iyhn4RrbhWtQUBD6FPekVEGjE6U+v/uCLjE+HJFh43xr8SASR8Mx3eFLsYAz+ddUl3ZPiRIZ4DJfI4WUbln68qkBtJeGPSlcvLxQlXuXL36gQS4HHLyRCM3aXDXt8UYxDH5Juo9AvCHHujV9iWXC1sEKsrN/LFXIGMuVb78xyLm8F4+45Qb80sZIxyzIWGed8BOGvBrl9y5Xa6eFhM7gqeqEB+ChAAW0nZ0tbforAoptKeVCYscWmL6j97+kxPQm3BfwsQt+kflXiLXqfVm6OYmeum2n7QgIOd/1jO8xoyDMzFX6dLUtMPCzpmke2A5IiXBBccf27FqQ4CVtLK8skqIYmKz3mqOltX9a1Xm67cGWaJU90i6FfWDDO7wMzcX4BnYFBBj3tE= MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: c8c29bd9-5366-4706-f585-08d6e9bf099c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2019 14:06:43.1668 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Rasmus.Villemoes@prevas.dk X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2382 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This allows setting a default value for the watchdog.open_timeout commandline parameter via Kconfig. Some BSPs allow remote updating of the kernel image and root file system, but updating the bootloader requires physical access. Hence, if one has a firmware update that requires relaxing the watchdog.open_timeout a little, the value used must be baked into the kernel image itself and cannot come from the u-boot environment via the kernel command line. Being able to set the initial value in .config doesn't change the fact that the value on the command line, if present, takes precedence, and is of course immensely useful for development purposes while one has console acccess, as well as usable in the cases where one can make a permanent update of the kernel command line. Signed-off-by: Rasmus Villemoes Reviewed-by: Guenter Roeck --- Documentation/watchdog/watchdog-parameters.txt | 8 ++++---- drivers/watchdog/Kconfig | 9 +++++++++ drivers/watchdog/watchdog_dev.c | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Documentation/watchdog/watchdog-parameters.txt b/Documentation/watchdog/watchdog-parameters.txt index 32d3606caa65..ec919dc895ff 100644 --- a/Documentation/watchdog/watchdog-parameters.txt +++ b/Documentation/watchdog/watchdog-parameters.txt @@ -11,10 +11,10 @@ modules. The watchdog core parameter watchdog.open_timeout is the maximum time, in seconds, for which the watchdog framework will take care of pinging a running hardware watchdog until userspace opens the corresponding -/dev/watchdogN device. A value of 0 (the default) means an infinite -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. +/dev/watchdogN device. A value of 0 means an infinite 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. ------------------------------------------------- diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index ffe754539f5a..a8bd621e12f8 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -58,6 +58,15 @@ config WATCHDOG_HANDLE_BOOT_ENABLED the watchdog on its own. Thus if your userspace does not start fast enough your device will reboot. +config WATCHDOG_OPEN_TIMEOUT + int "Timeout value for opening watchdog device" + default 0 + help + The maximum time, in seconds, for which the watchdog framework takes + care of pinging a hardware watchdog. A value of 0 means infinite. The + value set here can be overridden by the commandline parameter + "watchdog.open_timeout". + config WATCHDOG_SYSFS bool "Read different watchdog information through sysfs" help diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index e4b51db48f0e..334b810db2cf 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -88,7 +88,7 @@ static struct kthread_worker *watchdog_kworker; static bool handle_boot_enabled = IS_ENABLED(CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED); -static unsigned open_timeout; +static unsigned open_timeout = CONFIG_WATCHDOG_OPEN_TIMEOUT; static bool watchdog_past_open_deadline(struct watchdog_core_data *data) { @@ -1214,4 +1214,5 @@ MODULE_PARM_DESC(handle_boot_enabled, module_param(open_timeout, uint, 0644); MODULE_PARM_DESC(open_timeout, - "Maximum time (in seconds, 0 means infinity) for userspace to take over a running watchdog (default=0)"); + "Maximum time (in seconds, 0 means infinity) for userspace to take over a running watchdog (default=" + __MODULE_STRING(CONFIG_WATCHDOG_OPEN_TIMEOUT) ")");