Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp873160ybf; Fri, 28 Feb 2020 09:13:58 -0800 (PST) X-Google-Smtp-Source: APXvYqwntkZPC9S+UCRPSutBL7G9KDjjtbg4/sAXv4bY1mi4qf26TZyDpITK2k/FrxXsUcigvrrd X-Received: by 2002:a9d:d06:: with SMTP id 6mr4279243oti.176.1582910037888; Fri, 28 Feb 2020 09:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582910037; cv=none; d=google.com; s=arc-20160816; b=vAprOJpqrD43qziKnu4yAU/UM2o6q0tsVozM3/z+SFJZ5PI0RInaccJ0DuWV9hLDCh 2wDpUc8p6GmNWBTf2qoGr8BLOjeweQGylvJnoI4GmVHBL4fEcNFnmhpm528JItsDbDtE dcJh76NppY5NMgJ/uZojQRbJ0ZT88dYU4SJzDkDvLqb7B0CPKxQhJiPQRcMYFv11uDfP ZFis9dmok+HLe+kTVXtIg5qTu6tkEeEFClVnImNzWnZwO8E7IOSvQ+Jlu521KbRAlMU+ UAXQWNj8JiSv7jfDOwdDas1H/XcpSlBEvojypYZsKxXVkzu4l8cLexg++eRYlBkra7NR vmbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xJi6vZcYcttW+MZfr9/rRJo0DF++IJ1/RUDtbKhU1AY=; b=0Uwxq1v2dlKHM7PhvnktaD6pFMvtfvC6YdFdsd0HMyP8C1jS4bkAPjSR3wcCTqDPRI PjGNjMxlidsm8P2jy8nGRKhZbua7sjsAkPnCmm8TTLaPa51mD6sB4T8pnYGG3AJGRw2x 96aNl3Fe0scYAu2Uwud/S7D/MEIQ8v6kgbsEm9G66p4dLAOeTutSiIePIOsHGJ99FDyP nhWBQ5A8NrdddGk1QwlRUlAOM1+7rJ44IJoPeKxZnB7G7F8OkSTeFvdplbnckJtuuEnW DcMyvnZ6PkQWl3e/0nZ3BbCdnEW/W7t1GOhcXbfeaz4fOT904gwJ20/L+ewflIjh20kt 3KoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uEOAohEG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si1767047otp.57.2020.02.28.09.13.46; Fri, 28 Feb 2020 09:13:57 -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=fail header.i=@gmail.com header.s=20161025 header.b=uEOAohEG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726860AbgB1RNR (ORCPT + 99 others); Fri, 28 Feb 2020 12:13:17 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38715 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgB1RNQ (ORCPT ); Fri, 28 Feb 2020 12:13:16 -0500 Received: by mail-pg1-f196.google.com with SMTP id d6so1833976pgn.5; Fri, 28 Feb 2020 09:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xJi6vZcYcttW+MZfr9/rRJo0DF++IJ1/RUDtbKhU1AY=; b=uEOAohEGBRoCSThVEmWLtAKPOqOCFMCaUcBA+F58HYQJ4WlwP99B0kkn5pagoVx9ia ciyWMsE+sn335hZ75HM6QJ1hCDukb9Suie1cGGMW2CGkSeudg/JIePTCYGESVNsyzVvx 2yCpjoSiVB7B58PbXo5dzIdwKsB7nXSsB4qu/5qixVM9wJDBDP8LorAMIphl8QEyUu4w tx7Ljaicm2ngq5StYDxBLLfcaHDE9bo08CT29iQoLWRs9BnkembEXNKAuMFTbN1kZnc+ rMUXNfZRE9iQg6Pvk4U20jO1SK28BuxQMZVUdpXosWbGA1asQrgJqXSeTclTNd72OGDS 4akw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=xJi6vZcYcttW+MZfr9/rRJo0DF++IJ1/RUDtbKhU1AY=; b=hoH0F2fupTBp2Ul+dYtwWyTm5hqo9KQbuVYZAv3ddJZAE35xFfW1p9j50Zls5QYlZ1 QgEdblzqPojmIfeC/qXsoQiZ3IXoTMBzP1b9GioVUbyNXk4X5zo1sQUa8iQqzreW9stL wp0YS4Hrfy0J1jnGABhyDJpg224asygP0KmeJ4xOQnndzzGPtNyWqGPvfaIct2o1CUjL xHzMKWlU/OxlocEijIO5uzcJh0sYNwo5Q6SKdBNTa3cMNy+O3HC/rnS5bFesYPMzkThZ GZ+fuFphse9REpHumog9VTMOfQhQz/RtwKtNS1LfZJvCG7eicGbJcb9nq8exCar6xRK5 FKxQ== X-Gm-Message-State: APjAAAUSe5bLd6ffKCGMhpn/5Lb5YEimgMgKPoD2SqRwAjLhM7nzQ1ms XXSgqXE+AE91qP7hkwKNE3M= X-Received: by 2002:a63:1d22:: with SMTP id d34mr5495224pgd.21.1582909995462; Fri, 28 Feb 2020 09:13:15 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id q13sm11203198pgh.30.2020.02.28.09.13.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Feb 2020 09:13:14 -0800 (PST) Date: Fri, 28 Feb 2020 09:13:14 -0800 From: Guenter Roeck To: Tero Kristo Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] watchdog: add support for resetting keepalive timers at start Message-ID: <20200228171314.GA14594@roeck-us.net> References: <20200228142331.13716-1-t-kristo@ti.com> <20200228142331.13716-3-t-kristo@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200228142331.13716-3-t-kristo@ti.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 28, 2020 at 04:23:29PM +0200, Tero Kristo wrote: > 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; I don't think the additional flag is needed. The code should just set last_hw_keepalive. After all, it already sets last_keepalive, which determines when the next internal keepalive will be sent. It makes sense to also set last_hw_keepalive to prevent the next keepalive from being sent too early. Guenter