Received: by 10.223.164.202 with SMTP id h10csp248197wrb; Thu, 9 Nov 2017 05:52:05 -0800 (PST) X-Google-Smtp-Source: ABhQp+SzwIrbQ2ZG2Bw3avBzu5yANP2UJN5XDx8LePo+Hb75V+t9K38Vx93MmvYpsCdPhOwz/DYq X-Received: by 10.99.53.14 with SMTP id c14mr550544pga.440.1510235525339; Thu, 09 Nov 2017 05:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510235525; cv=none; d=google.com; s=arc-20160816; b=wr2zr1GVHYukVcHfBQ9znc/DV3OH3ifcuJuoKBKWtig9pZc6IHrqoMQzp2EyaIvwG1 SGWnkTn+aIj9DGcjX0xmhOVSe1HMzxagSMY3oSaRnanRcsdvnJCPUg6iu0lGUo3F6gTI FmgAMpD6dJ70azVeh3cITwvC15dyqvO38sFyKxT7y0AkUXB1dwHbGVZbiRRTD8MG+njD /7SENOgDuT9aEqSE/pNuC3gP2RRsPfwcxVGmnb6UlZK6n+0O3Y6jdDrGlpfdgAStvnBt dvT8N2xhWf9QU2mKS/vUXVXjHFtlvT4RMg7LOyiBYn3w8y7x60wyBArV3F+yYjYxaXn2 CY0Q== 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 :arc-authentication-results; bh=B/2IY9n2wM51HZqGMu5v/4PT+lree1L20kc1JS1/ey4=; b=MRIveNW9COLgBNnk4REODDJbKAsfxj+dU9V85+2fGBlgRpx+SN/UfjvDJNix5ERZwh MCwWSyDrSXdEw9YDEJ1rySIuvIySSoxJYxnypV+s2s6IX56JHMKqYpkmWCCPY/FQJhcL qNH0NcIitGhgAfQcGDiqIkLUTyMllBoopwm9rkQQPJwDAlEs4cGhoUmw3EONX6IEi6vN 6nY0I4gJnYVpW9Uc5D6i+9V8gdDnyd2AiTKL/bkCLxK0OcXL9OS0ZjXtN/mSoqTOBt3v tkxrtGkEjveG2fSLrDed98qFgePPRVbWrpsTFcE8yM+T49hi8upzmUsfb72WDrqTv68+ mWow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@prevas.dk header.s=ironport2 header.b=0u2R0LlV; 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 m5si6904262pfg.275.2017.11.09.05.51.53; Thu, 09 Nov 2017 05:52:05 -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=@prevas.dk header.s=ironport2 header.b=0u2R0LlV; 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 S1754924AbdKINuI (ORCPT + 80 others); Thu, 9 Nov 2017 08:50:08 -0500 Received: from mail02.prevas.se ([62.95.78.10]:8183 "EHLO mail02.prevas.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754658AbdKINuG (ORCPT ); Thu, 9 Nov 2017 08:50:06 -0500 X-Greylist: delayed 599 seconds by postgrey-1.27 at vger.kernel.org; Thu, 09 Nov 2017 08:50:05 EST DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=2056; q=dns/txt; s=ironport2; t=1510235406; x=1541771406; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=cLPUy4AzjjcnjKZ73olZQU2b2mNmUPXM8GAOGsaSBoE=; b=0u2R0LlV4T0HQTMIaPEbd3SEZBb1+bL5sccS2PjFe3iqDWrnpYlidK5O JkB4sbViqyDu/WqDaRPwzLe+ZVb7G1DWPabXCJs76s/4zsPpN8A1EUF+J csOJdMe2VakVjl5hBvbY9ISI8bUqtDhhs2b8Zp8EZvEq0mCtFuZWXlHZh c=; X-IronPort-AV: E=Sophos;i="5.44,370,1505772000"; d="scan'208";a="2664621" Received: from vmprevas4.prevas.se (HELO smtp.prevas.se) ([172.16.8.104]) by ironport2.prevas.se with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 14:40:04 +0100 Received: from prevas-ravi.prevas.se (172.16.8.31) by smtp.prevas.se (172.16.8.104) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 9 Nov 2017 14:40:04 +0100 From: Rasmus Villemoes To: Guenter Roeck CC: , , Rasmus Villemoes Subject: [PATCH] watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop Date: Thu, 9 Nov 2017 14:39:55 +0100 Message-ID: <1510234795-25881-1-git-send-email-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20171108181548.GA19661@roeck-us.net> References: <20171108181548.GA19661@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.16.8.31] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first patch above (https://patchwork.kernel.org/patch/9970181/) makes the oops go away, but it just papers over the problem. The real problem is that the watchdog core clears WDOG_HW_RUNNING in watchdog_stop, and the gpio driver fails to set it in its stop function when it doesn't actually stop it. This means that the core doesn't know that it now has responsibility for petting the device, in turn causing the device to reset the system (I hadn't noticed this because the board I'm working on has that reset logic disabled). How about this (other drivers may of course have the same problem, I haven't checked). One might say that ->stop should return an error when the device can't be stopped, but OTOH this brings parity between a device without a ->stop method and a GPIO wd that has always-running set. IOW, I think ->stop should only return an error when an actual attempt to stop the hardware failed. From: Rasmus Villemoes The watchdog framework clears WDOG_HW_RUNNING before calling ->stop. If the driver is unable to stop the device, it is supposed to set that bit again so that the watchdog core takes care of sending heart-beats while the device is not open from user-space. Update the gpio_wdt driver to honour that contract (and get rid of the redundant clearing of WDOG_HW_RUNNING). Fixes: 3c10bbde10 ("watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function") Signed-off-by: Rasmus Villemoes --- drivers/watchdog/gpio_wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index cb66c2f..7a6279d 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -80,7 +80,8 @@ static int gpio_wdt_stop(struct watchdog_device *wdd) if (!priv->always_running) { gpio_wdt_disable(priv); - clear_bit(WDOG_HW_RUNNING, &wdd->status); + } else { + set_bit(WDOG_HW_RUNNING, &wdd->status); } return 0; -- 2.7.4 From 1583579166476003820@xxx Thu Nov 09 09:12:59 +0000 2017 X-GM-THRID: 1583579166476003820 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread