Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp718641ybf; Fri, 28 Feb 2020 06:25:19 -0800 (PST) X-Google-Smtp-Source: APXvYqwhxSeQQvaLJRO6lMxmdcBGU7nB7l2z/4UEQMg1QOG/XE8j4K4PX/82+y9BBRuiS6gyH0HO X-Received: by 2002:a9d:4c14:: with SMTP id l20mr3511959otf.125.1582899919024; Fri, 28 Feb 2020 06:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582899919; cv=none; d=google.com; s=arc-20160816; b=la49bhzFCEaN2PeFRyupD0VHiFzLzVlFBqQZmoIN+Ui5dRWrNSInrvIFDaIXUD1tSF ZHPDrzg8KFy50O/8Not6SMYXnebODJTAN4178o4J85IoytFTALfbCFoegSpWX9plEdaV YW4rG5uT6UyESOVnPfouWzvtI/ElNGpbs+wTP4zPoOMAOhZj06iRKgz/sXQHIeSiAnqP dsJ9uT+KlAl17B9RVtSLqhX2YWE4GnHAtTPnmdVQhFZIGdCk9aD0vPkmKzpGB/MOklSO 96zI1YGqc17AFjhXF4NOl27uM4NWJ3RMHg4jSepeUphC91jJzxyamD9+8AYcqFn45VuQ 8VGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gFf3iMUyi6ZJJ+RWZCMBD5YGM1y98+HWlMtKDjZYE1Q=; b=U92FF+KJbGzV60EGbqxdoBrerhKCHTDQFDa7CKHF5XJA0dzLASIblOaTH4b3mdpZQS AG+2nuZdBUUoPjeJhTwYILO1B9VlL6qAtex5zwByDVulnskAeTYs5/3husgREY5bPboi HO8cF6YSc3Djl3qDOkbdbDae7bx6WJiZbhQEzUpq3ZGV8VRO3lsxsTOAq4VprnJP35iI wjAYg5uLNnxvEsj9qW51Q+EZlfgInFO4D1Mp6qnksgvrC0KqQnB8OlljEGumqCnwKiF0 Q5497G/8YXekW+1bP4AiDMQCDiCR0RRWmQYQ1hSmA0mRXqZAWIRoJEep5CwEylL6AbID bTAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zPcTgXaR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si1780750oti.124.2020.02.28.06.25.07; Fri, 28 Feb 2020 06:25:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zPcTgXaR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgB1OYR (ORCPT + 99 others); Fri, 28 Feb 2020 09:24:17 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47642 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbgB1OYQ (ORCPT ); Fri, 28 Feb 2020 09:24:16 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01SENwnb053696; Fri, 28 Feb 2020 08:23:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582899838; bh=gFf3iMUyi6ZJJ+RWZCMBD5YGM1y98+HWlMtKDjZYE1Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zPcTgXaRJ4JSp2y+F2uLiZGqv66FBx3oqcAII53m4HNVo+ldnrWpdRD7ilZSxNzPE XMhIk/xBP0wf1mqMtHfRsl0PJ+O+n2uBoR4SDYtcdfMXowWO3QNWuEmRIF1AsmWsSl 2X4RBKbvlN8ShzaDTjpefWZ021tSta/6y5XdPR7c= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01SENv7G086299; Fri, 28 Feb 2020 08:23:57 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 28 Feb 2020 08:23:46 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Fri, 28 Feb 2020 08:23:46 -0600 Received: from sokoban.bb.dnainternet.fi (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01SENf40049600; Fri, 28 Feb 2020 08:23:45 -0600 From: Tero Kristo To: , , CC: Subject: [PATCH 2/4] watchdog: add support for resetting keepalive timers at start Date: Fri, 28 Feb 2020 16:23:29 +0200 Message-ID: <20200228142331.13716-3-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200228142331.13716-1-t-kristo@ti.com> References: <20200228142331.13716-1-t-kristo@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current watchdog core pets the timer always after the initial keepalive time has expired from boot-up. This is incorrect for certain timers that don't like to be petted immediately when they are started, if they have not been running over the boot. To allow drivers to reset their keepalive timers during startup, add a new watchdog flag to the api, WDOG_RESET_KEEPALIVE. Signed-off-by: Tero Kristo --- drivers/watchdog/watchdog_dev.c | 2 ++ include/linux/watchdog.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 8b5c742f24e8..131e40c21703 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -283,6 +283,8 @@ static int watchdog_start(struct watchdog_device *wdd) set_bit(WDOG_ACTIVE, &wdd->status); wd_data->last_keepalive = started_at; watchdog_update_worker(wdd); + if (test_bit(WDOG_RESET_KEEPALIVE, &wdd->status)) + wd_data->last_hw_keepalive = started_at; } return err; diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 417d9f37077a..b56e3f1b1ec3 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -116,6 +116,7 @@ struct watchdog_device { #define WDOG_STOP_ON_REBOOT 2 /* Should be stopped on reboot */ #define WDOG_HW_RUNNING 3 /* True if HW watchdog running */ #define WDOG_STOP_ON_UNREGISTER 4 /* Should be stopped on unregister */ +#define WDOG_RESET_KEEPALIVE 5 /* Reset keepalive timers at start */ struct list_head deferred; }; -- 2.17.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki