From nobody Mon Jun 15 10:45:34 2026 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B15BD2E7162 for ; Thu, 9 Apr 2026 17:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775757191; cv=none; b=QJ8IcFBs8MYbb4lZrQ/N7wkIk+FJj5TmrDD9cqZKVXBKe2DVoEOPr6W46yi1T/xVk762Y/IDXOpbcGr8Bw70SGu/+r0VP5DGBlyvlDtSyiEBo14plyPW6ObChxT+Y9gQpLck8pq/QKNu5LYQKYBy9lfdNw1pXDdbR0adUUM/zYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775757191; c=relaxed/simple; bh=mm6VZqCRkab8GZnSK4FaXiFdyAa0ocA3azLFcvPZj6I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=G/TUek4MX7OqJmHf7Q8dFAEVXrl01uhUnwGcNHqgSNVjNAuR9phfK0dUy0a3hq8+RLXuz42ulhOyEVNuvh7AJdIjBKRO9OWpXXS8b/3I8BuJIdbSim6qIVmGMpxRUzluiSMy6RzAuAiqZqf7kZdVmp/keMqEvzgESGRzC6wkjs4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qE5XTpm+; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qE5XTpm+" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-82a655cfab5so1163931b3a.1 for ; Thu, 09 Apr 2026 10:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775757190; x=1776361990; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aJq3rYsQ60yHYBH9wgTwGBJ0UIOoD7LqWc0lT9QqzeA=; b=qE5XTpm+vD/pSt6vhIWj8Ic2USGW4Eb2VmHexzTDxjViEM1ppdO3PNL0r9hfMVPDcr 7xibKWXT2eDovlBtHJap1UwpPztLlZE0CX9blzNGCe6WE4XbrJxyZ7CT93u+k1P9Jpxy hVXnziDDngRVlCk+h3sBEMZGbgJ/AH/N51DdjLyxywSw3hxmKGlhRO5pa980pBp4KCPb obmft2ULHiW+Im5ydqsu9h/xspyLtr0/wqRYCwB3YZlKjBGL0LH/w1YSQ7UkC0z9fOAi VGAwnQwZoGC9EoeOBhit9fe/ewHYzDanpV7kNDhxc3a0at+Y6m8dEC/foi73HGc2ARJi NVgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775757190; x=1776361990; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aJq3rYsQ60yHYBH9wgTwGBJ0UIOoD7LqWc0lT9QqzeA=; b=a+LKxpaUYt4uZUQIsxxkKtwC+zz58WUayP2Jx469cm54+/D3shBuot7NIQs2TdfO+Q fl24LbOJH7jmWguTT4BpeNC0eruj/m18WMByuxX5tQvxWab5A6Hb/rC2I/0M6KRvsw9d Hslr7tOoQlvQx1XCHT/g85pJHLkw9BBhFfSYAsF47BkLSa5ijY/GOzDZEp5DpvxrRTni 4AhkjkSiOaopy91IsRkVhKZT1cDLh3vrRwZv1wMhBMtLyr/sQ8TqA+vtKsVSEMsq1Svh p7+GlaRdFp4YUMsXqQ1bXk+Zf3uJJZGGsIdo3ceMV0SCHQgbPsv8JiiS9I/37tFSl4ko oIFg== X-Forwarded-Encrypted: i=1; AJvYcCVuIB3ka1nN/UBl0nKRlJxr66v8LGjuBqsATcbFZTxX9voGm0rIiPN3/aKQhBMHkhOyg5qepKvKb3FmKNs=@vger.kernel.org X-Gm-Message-State: AOJu0YxTDxpphiLRLZQhL/CBtc/3WKTRcmNQek0lfgw8N2BQ3qJhegFW P3ykrbCaJrnx/dtB4eva4TogsNFJipq9DQmWY3gkt03ga1kL9rrQCEJW X-Gm-Gg: AeBDieuU5NQF0MsmkdqtcFWl8sgmiGFNFihZi9cqkYpu0QthccK0BRlITaDe7T+pPEx 9u0mccV1jWMjNq05sQEi7kHEDI4Q0DHIQ7uNMuWbPZpciGMV3E4fH3YIKacy1b5acdNSzTA+eJA GAZmJ3XNSf9zv10pDoeJpEeCuhOaOtrxasLHFhMQ4TFCf+I0Gw3YDgnwpMLosIPu8wfin72Uyuk 7d68wFqdia3gZPcLL/QaAiOEkq4TWt+LMKLja5fJ8CbEXAWsHa6Gqw/fapv8MFVwf9tTmxpoy7V 5jwH2D538hsF+Zx3Qct7syRkWOLwCPNIb3hkVo+Va1emJ1dd3PmKg4OnlDjkOZSKINq282sMQXs wR5F72fQnuQK+gGw99P8kipTxwQgTZNTehxICUzBnIQ4H6PR2OklB9uPFstVM1CH5iBy7RWKcSb fjpPUYBpxdnNUs0mArax19xreHG4U3eaONaTFoyhb7uG2rAVLQad7CGZxU X-Received: by 2002:a05:6a00:3007:b0:82a:955:50d3 with SMTP id d2e1a72fcca58-82f0c2e4290mr127537b3a.45.1775757189921; Thu, 09 Apr 2026 10:53:09 -0700 (PDT) Received: from tech-Alienware-m15-R6.. ([122.171.16.234]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f0c52cf05sm30817b3a.61.2026.04.09.10.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2026 10:53:09 -0700 (PDT) From: Sunny Patel To: Jonathan Corbet Cc: Wim Van Sebroeck , Guenter Roeck , Shuah Khan , linux-watchdog@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sunny Patel Subject: [PATCH] Documentation: Refactored watchdog old doc Date: Thu, 9 Apr 2026 23:23:01 +0530 Message-ID: <20260409175301.22902-1-nueralspacetech@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Revisited old doc of watchdog and did some cleanup. Also added support for new api in doc. Signed-off-by: Sunny Patel --- Documentation/watchdog/watchdog-api.rst | 49 +++++++++++++++++++++---- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/Documentation/watchdog/watchdog-api.rst b/Documentation/watchd= og/watchdog-api.rst index 78e228c272cf..446f961852ec 100644 --- a/Documentation/watchdog/watchdog-api.rst +++ b/Documentation/watchdog/watchdog-api.rst @@ -2,7 +2,7 @@ The Linux Watchdog driver API =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 -Last reviewed: 10/05/2007 +Last reviewed: 04/08/2026 =20 =20 =20 @@ -106,11 +106,10 @@ the requested one due to limitation of the hardware:: This example might actually print "The timeout was set to 60 seconds" if the device has a granularity of minutes for its timeout. =20 -Starting with the Linux 2.4.18 kernel, it is possible to query the -current timeout using the GETTIMEOUT ioctl:: +It is also possible to get the current timeout with the GETTIMEOUT ioctl:: =20 ioctl(fd, WDIOC_GETTIMEOUT, &timeout); - printf("The timeout was is %d seconds\n", timeout); + printf("The timeout is %d seconds\n", timeout); =20 Pretimeouts =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -133,7 +132,7 @@ seconds. Setting a pretimeout to zero disables it. There is also a get function for getting the pretimeout:: =20 ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout); - printf("The pretimeout was is %d seconds\n", timeout); + printf("The pretimeout is %d seconds\n", timeout); =20 Not all watchdog drivers will support a pretimeout. =20 @@ -145,7 +144,7 @@ before the system will reboot. The WDIOC_GETTIMELEFT is= the ioctl that returns the number of seconds before reboot:: =20 ioctl(fd, WDIOC_GETTIMELEFT, &timeleft); - printf("The timeout was is %d seconds\n", timeleft); + printf("The timeout is %d seconds\n", timeleft); =20 Environmental monitoring =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -227,12 +226,33 @@ The watchdog saw a keepalive ping since it was last q= ueried. WDIOF_SETTIMEOUT Can set/get the timeout =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -The watchdog can do pretimeouts. +The watchdog supports timeout set/get via the WDIOC_SETTIMEOUT and +WDIOC_GETTIMEOUT ioctls. =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 +The watchdog supports a pretimeout, a warning interrupt that fires before +the actual reboot tiemout. USE WDIOC_SETPRETIMEOUT and WDIOC_GETPRETIMEOUT +to set/get the pretimeout. + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + WDIOF_MAGICCLOSE Supports magic close char + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The driver supports the Magic Close feature, The watchdog is only disabled +if the characted 'V' is written to /dev/watchdog before the file descriptor +is closed. Without this, closing the device disables the watchdog +unconditionally. + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + WDIOF_ALARMONLY Not a reboot watchdog + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The watchdog will not reboot the system when it expires. Instead it +triggers a management or other external alarm. Userspace should not +rely on a system reboot occurring. =20 For those drivers that return any bits set in the option field, the GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current @@ -268,4 +288,17 @@ The following options are available: WDIOS_TEMPPANIC Kernel panic on temperature trip =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -[FIXME -- better explanations] +``WDIOS_DISABLECARD`` stops the watchdog timer. The driver will cease +pinging the hardware watchdog, allowing a controlled shutdown without +a forced reboot. This is equivalent to the watchdog being disarmed. + +``WDIOS_ENABLECARD`` starts the watchdog timer. if the watchdog was +previously stopped via ``WDIOS_DISABLECARD``,this will re-enable it. The +hardware watchdog will begin counting down from the configured timeout. + +``WDIOS_TEMPPANIC`` enables temperature-based kernel panic. When set, +the driver will call ``panic()`` (or ``kernel_power_off()`` on some +drivers) if the hardware temperature sensor exceeds its threshold, +rather than only setting the ``WDIOF_OVERHEAT`` status bit. Support +for this option is driver-specific, not all watchdog drivers implement +temperature monitoring. \ No newline at end of file --=20 2.43.0