From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbbEHCp7 (ORCPT ); Thu, 7 May 2015 22:45:59 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:13613 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbbEHCp4 (ORCPT ); Thu, 7 May 2015 22:45:56 -0400 Date: Fri, 8 May 2015 10:41:33 +0800 From: Jisheng Zhang To: Doug Anderson , "wim@iguana.be" , "linux@roeck-us.net" CC: "linux-watchdog@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/2] watchdog: dw_wdt: keepalive the watchdog at write time Message-ID: <20150508104133.221f2c1c@xhacker> In-Reply-To: <1431036564-4189-2-git-send-email-dianders@chromium.org> References: <1431036564-4189-1-git-send-email-dianders@chromium.org> <1431036564-4189-2-git-send-email-dianders@chromium.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-05-08_01:2015-05-07,2015-05-08,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1505080034 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 May 2015 15:09:24 -0700 Doug Anderson wrote: > If you've got code that does this in a tight loop > 1. Open watchdog > 2. Send 'expect close' > 3. Close watchdog > ...you'll eventually trigger a watchdog reset. You can reproduce this > by using daisydog (1) and running: > while true; do daisydog -c > /dev/null; done > > The problem is that each time you write to the watchdog for 'expect > close' it moves the timer .5 seconds out. The timer thus never fires > and never pats the watchdog for you. > > 1: http://git.chromium.org/gitweb/?p=chromiumos/third_party/daisydog.git > > Signed-off-by: Doug Anderson > --- > drivers/watchdog/dw_wdt.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c > index 3fa2f19..ff5d734 100644 > --- a/drivers/watchdog/dw_wdt.c > +++ b/drivers/watchdog/dw_wdt.c > @@ -220,6 +220,7 @@ static ssize_t dw_wdt_write(struct file *filp, const char __user *buf, > } > > dw_wdt_set_next_heartbeat(); > + dw_wdt_keepalive(); > mod_timer(&dw_wdt.timer, jiffies + WDT_TIMEOUT); > > return len; Tested-by: Jisheng Zhang