Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp7312472pxv; Fri, 30 Jul 2021 15:42:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt/9ObQHIrfF8Incv45qFVTWJiNgIbaps7nbge3sRSnNoJaKJ2kRfgTBt+17/KxMIvWgew X-Received: by 2002:a5e:9743:: with SMTP id h3mr2762998ioq.52.1627684957374; Fri, 30 Jul 2021 15:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627684957; cv=none; d=google.com; s=arc-20160816; b=UNG3zIgAWfHE/A5Tl75CgrbxkVxRWbX3G/+QdUiJsV7kZASvMTQvPqOvHSg3CMyzaT 8n8E5j5KoGhVK4dJ9EibIld72UJLrE26QjbsFyOL0JP0y6PzXEPBj7DOrWq9g+K68hzH N6IUo+3d5rvZypfIqJ1qS0nKf7TRRbPjBdFXuoo4vFKJqF3XkhnRAwm0G+arWFNA0XPk TdpvrnXbARVp4p95RKLMtW4gI40Kvw6M9jWfwQEgxz9ZblwH7sg0oL4BijqNrclp61z2 LJxCQSDSVbrGm2dyIg1KvMnLc6KuEsmXt9qeL21bjX4Q0857ZwRaMeGSL5CMUDyg6RcU ql8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:sender:dkim-signature; bh=kHsJiQapAD/4QVzp2UfVWPI1mPGl8hWS1HwKG0EoffI=; b=zGlfZLUiXq/1opwjbRTIxu+Gyszq7p/dZLp88U2VK5SVpvrlP5VUQ0Bgh1iccd7W6R 6AbtPfyI6dJzmbUdMCKExPN9zw/SdJxWoCOReG47cCkG/DHthxa/x9KFEUw/caJReCMQ HebxKRDglFDZTmVJQuW/c2fb8Dp+FMDmN2uZmLY7zW3xpiUG7sCmRn1ZWtAt5uDG5ZWm KF8xiB/KUZnpFTuYcsBeehP5eT/7JPf1xHrzcxKCkfRzM1WYSaHRsO4CkPBU0epAykoY qHzVzznMWqS85J5Bu0U5y0gseG5j/j4M5T0F8/ShZYDmWTMulV7cMSnUiH4NHRuuGynO Ki6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EknXuDek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si3234658jat.115.2021.07.30.15.42.25; Fri, 30 Jul 2021 15:42:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EknXuDek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233461AbhG3WjK (ORCPT + 99 others); Fri, 30 Jul 2021 18:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhG3WjK (ORCPT ); Fri, 30 Jul 2021 18:39:10 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D548CC06175F; Fri, 30 Jul 2021 15:39:03 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id o20so15229838oiw.12; Fri, 30 Jul 2021 15:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kHsJiQapAD/4QVzp2UfVWPI1mPGl8hWS1HwKG0EoffI=; b=EknXuDek8jF0zTx1Y6OGTJgCoMEk2IHb0z2K9LcvMEFrTwZafNc4Epex8TgdgFHEJZ 8YU1LCLDv/YS9tpv58B29IyQ2sUIATKtitdjroBIVHnxCv7Gy+Q1ex/B+ezdvTFJ+OXv LBsp/720y8GMxzZ0VQXEFJoBmCyBgeX+RADeukUeqkr4YISjb/nRaO7jPvmcRMcNygAS ZDpfkhI6YE6FgMwDABZWkwdAqvgd/9MMIG7I34el74iwm/hY4JG1VXb4A15LTcM56s6M dl1p+K7sv607ACwtL7NqmGMLLAgpTcAgAAU1PJA1gauZP6hwABsHLy3vFPpmecJZJ8dz +IhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:cc:references:from:subject:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kHsJiQapAD/4QVzp2UfVWPI1mPGl8hWS1HwKG0EoffI=; b=INDxjFki8P0kui09iaia2mrXEkAcUenauYy7PBy/IoLy3IYpvfRBhBj1SPJrYrx1uU SvUR1NsV6o5Bc4pEFXAIbgRYuq0DHBonfvlapAOKRMtZoIPFIZT6oHPIMUmw+8pj7aH0 qf9Flx/0PuwtETDNVtzseKZBIADvfkkPr3eXd3UGwEpGKnCpeVyEcQrwmFkn9qJ3iRmF Au5xyUOzA0VeZZSXYJ1T/LXcyn01H1qnmNiR8s0uY5WT6SXJG/TPeeNTlRVRj79ypUs6 GkFN6cmlVzc5zaPtzFChlTBRRvonX9h+MJqRgyFurLTV2yiMjpEgXmRWrUrsTeTOpHck i23Q== X-Gm-Message-State: AOAM531+HxCYgaPI5tWWC1LKoe9aH61ZClsa7u0EVwWKCW9b2j1iBGt5 ADYQLbUFg/f2iL024e5A2Ds= X-Received: by 2002:a54:4d8f:: with SMTP id y15mr3682712oix.32.1627684743299; Fri, 30 Jul 2021 15:39:03 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id i20sm463729ook.12.2021.07.30.15.39.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Jul 2021 15:39:02 -0700 (PDT) Sender: Guenter Roeck To: Jan Kiszka , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Cc: Linux Kernel Mailing List , Tero Kristo References: <211cd54b-29b4-e58a-341b-beffc05cfe85@roeck-us.net> From: Guenter Roeck Subject: Re: [PATCH] watchdog: Respect handle_boot_enabled when setting last last_hw_keepalive Message-ID: Date: Fri, 30 Jul 2021 15:39:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/21 2:37 PM, Jan Kiszka wrote: > On 30.07.21 22:49, Guenter Roeck wrote: >> On 7/30/21 12:39 PM, Jan Kiszka wrote: >>> From: Jan Kiszka >>> >>> We must not pet a running watchdog when handle_boot_enabled is off >>> because this requests to only start doing that via userspace, not during >>> probing. >>> >> >> The scope of the changed function is quite limited. See the >> definition of watchdog_set_last_hw_keepalive(). On top of that, >> __watchdog_ping() does a bit more than just ping the watchdog, >> and it only pings the watchdog in limited circumstances. On top of that, >> the scope of handle_boot_enabled is different: If enabled, it tells >> the watchdog core to keep pinging a watchdog until userspace opens >> the device. This is about continuous pings, not about an initial one. >> Given that, I'd rather have the watchdog subsystem issue an additional >> ping than risking a regression. >> >> The only driver calling watchdog_set_last_hw_keepalive() is rti_wdt.c. >> Does this patch solve a specific problem observed with that watchdog ? > > Yes, it unbreaks support for handle_boot_enabled=no by not starting the > automatic pinging of the kernel until userspace opens the device. > Without this fix, the core will prematurely start kernel-side pinging, > and hanging userspace will never be detected. > Good point. You are correct. I think it should also check for watchdog_hw_running(wdd), though. The function should not really be called if the watchdog isn't running, but it should still not ping the watchdog in that case. Something like if (watchdog_hw_running(wdd) && handle_boot_enabled) return __watchdog_ping(wdd); return 0; Also, I think it would make sense to add your additional comment to the patch description. The problem isn't only that the watchdog is pinged once, the problem is that it starts _automatic_ pinging which it really should not do. Thanks, Guenter