From nobody Sat Jun 20 17:32:51 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 696C02D3ED1 for ; Sun, 12 Apr 2026 08:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775982140; cv=none; b=G2+CkIdCjXH2kwSNBKLiTzZ8pJoB8zTXjq4EvxGhKyX6GozekwHdH1fXYr4xRUjzham8To/xR7Vw1X8GR9J+9Cb1qiqKu3Of/mPeRzK1yeHILw5LH7nstRQZKh5umqUsnBxJOl3cH2Uz/ocGMjJ/5FTFg1x5COWbB2bFNjjQ5ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775982140; c=relaxed/simple; bh=07CBgzXeAUWv4NrmNUnsSFnmCkQR2o04FGbGs92uPQ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jv4t520ObP5gt3uxpep+71bW/iZ5fnDrkgY5HoGxQHGbV+cGSzg/dXevyARXN1v4bTW+jaDJccQadSFxm5aHCoJUiZWTWpmlW2rKFM+OAc3ra1ToOTVAvwctd2h4SbOFQa8YELdUViL3uHAfVl9bgI2JOMvDoSTXIw7nvRxKazc= 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=aQLfiFB9; arc=none smtp.client-ip=209.85.216.49 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="aQLfiFB9" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-35da9c0c007so3257889a91.2 for ; Sun, 12 Apr 2026 01:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775982139; x=1776586939; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NIdNWDTJB8MnCsFnYSBxZ8TNMLf27pK1qRPFQutjdXY=; b=aQLfiFB91mXJE7xmdEgsnoQ3zJWvpbSFYG4vhs0XdpL0gdwH90WLM+P5PQUlPPz/LF pQSG9M+C2JpPXyf7rFr3NpobOs7rsGE1/aavAfv7Yml56XK5lPhom43Yw+OUyc9YkQhe fymHieeFwSZhXlsvkwnpe70Nu/LWLtjJtI6r/Ah+XKKX+ltE3OKpc12rGknh3umzCUV6 cPL/xvSfst4tjwEGk0hxDyPZ0G47MPrVDst2JG2ZcZvW7N2eKEnEWqvVfRjl8Ny1hSvH BxzkkfuhEGCDmoJLFhd4BWIvfBHd1BMFREkWfjJKHAFuDGUnD1s1W8zH2+y/OInGf+0N zatg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775982139; x=1776586939; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NIdNWDTJB8MnCsFnYSBxZ8TNMLf27pK1qRPFQutjdXY=; b=pvgYErmqRH+IDXhRoMLCxfAHT8H6sCou7B9vnN4xyg5fGJYklhM4hylV4Lev18I+/b Rp1THJPXPxOAki9xRAFw8UYzJYVQQgusbXGqiGuykAeU9L9BQ2qeDm8ouWdfgg0HTBJD PWr9vakfnZslt3lYlauT2xOuGNKK2oefahyOCrL1t+EOOhQEnpnPpkFnWuZNJ90T/MmP 2foh79Vce2UucZWT2KP+i8anqF6p8YLK4Adf0f/219uKOnXJCJT+rikKvz4BcVkMiIw1 Gnj2yRWwv8fMDVtOul5Rp8u9oJpoxUwpGjPHE8TXmr6z5r0jMbAWZ5qRKYcSCNONAqj1 PKnw== X-Forwarded-Encrypted: i=1; AFNElJ+toNfkEbjBeBWk4MEfRHPDG74DCzyrDCfHiSRw0tDfV343SjEuOtTz1ALWYK3FqByDIRBmj5IpektBSnY=@vger.kernel.org X-Gm-Message-State: AOJu0YwxfBAdxGcrZi/pL4JB2f52skNhQ7lblue0GL8zjQ4+i0D4M217 nH37PDF6HjHnBRaLiBP4bqVKaU8mLnLIyslTEf7yiF/tC+N49jWO/UN+ X-Gm-Gg: AeBDiescFyv52n2y5vOBOqQz+XNfTwrxLupb1nwhGpbkBfdw+M9ikJ/spCs5iZFEtPo 8Fjd1PwseIBpSGXNfkfqduavEw6wvGQ1v801RTPQlS8ceOXoKES2NRaNw3djsfGcL/TOshwfTWM XRw9MCkCe7sgXm7YXRBKQjzZJrb8Xk9JAP3lasyZWJuIazqG8MrTMOhoC6/FVIzK8U6P7EEPP36 HAGbPtC+c/3PmIfqzQDhv8REB47RLYz1TdWgc4Pi6G/3kdU5uza7B++EKk/zFwQ20ZzPdUOv6T/ 6+IEYDczWrcFY3eVYu0l6mnt7W+r8apRsB0o9kgCLHkbXhCL0CXHqQhaAHiMHbjItUlYRT1hge1 zdrJECjNGdxmebgNMhJuWCRnkzzRAdCkgd5Jbl8FnX8qr56i+Oayiox/im6ycIzzKllzEACNA9S Un38BN/F1Rz4JS3pN2IjSKqBHWBMY3C2N8AKSC+cj5hDGHzv1RYuN+EYI= X-Received: by 2002:a17:90b:390d:b0:35b:929f:7e92 with SMTP id 98e67ed59e1d1-35e42827fbbmr9779773a91.18.1775982138636; Sun, 12 Apr 2026 01:22:18 -0700 (PDT) Received: from tech-Alienware-m15-R6.. ([122.171.18.84]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35e4131d1desm8593167a91.9.2026.04.12.01.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2026 01:22:18 -0700 (PDT) From: Sunny Patel To: linux-doc@vger.kernel.org Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, corbet@lwn.net, wim@linux-watchdog.org, linux@roeck-us.net, rdunlap@infradead.org, Sunny Patel Subject: [PATCH v3] Documentation: Refactored watchdog old doc Date: Sun, 12 Apr 2026 13:52:05 +0530 Message-ID: <20260412082210.31352-1-nueralspacetech@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260411150922.20536-1-nueralspacetech@gmail.com> References: <20260411150922.20536-1-nueralspacetech@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Mark WDIOC_GETTEMP and WDIOS_TEMPPANIC as deprecated since neither is implemented by the watchdog core and both are only present in a small number of legacy drivers. Add documentation for previously undocumented status bits WDIOF_MAGICCLOSE and WDIOF_ALARMONLY in the options field. Add documentation for WDIOF_PRETIMEOUT and WDIOF_SETTIMEOUT status bits describing their respective ioctls. Fix the following issues in existing documentation: - Remove version-specific reference to Linux 2.4.18 from the GETTIMEOUT ioctl description - Fix duplicate "was is" in printf format strings - Replace [FIXME] placeholder with proper descriptions for WDIOS_DISABLECARD, WDIOS_ENABLECARD and WDIOS_TEMPPANIC Signed-off-by: Sunny Patel --- Changes in v3: - Replaced .. deprecated:: with .. note:: to avoid Sphinx build warning due to missing version argument - Fixed WDIOF_MAGICCLOSE description: corrected inverted behaviour =E2=80=94 without 'V', watchdog remains active and reboots, it does not disable unconditionally - Fixed comma splice: "Magic Close feature, The" -> "Magic Close feature. The" - Fixed WDIOF_ALARMONLY table alignment (malformed table) - Fixed "driver-specific," -> "driver-specific;" (semicolon) - Fixed identity row indentation in watchdog_info table Note: This is sent as v3 and not v4. The previous submission was v2 and this directly addresses the review comments on it. The version was not bumped to v4 to keep the revision history consistent with the actual number of review cycles this patch has gone through. Documentation/watchdog/watchdog-api.rst | 63 +++++++++++++++++++++---- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/Documentation/watchdog/watchdog-api.rst b/Documentation/watchd= og/watchdog-api.rst index 78e228c272cf..83848d02959d 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 @@ -42,7 +42,7 @@ activates as soon as /dev/watchdog is opened and will reb= oot unless the watchdog is pinged within a certain time, this time is called the timeout or margin. The simplest way to ping the watchdog is to write some data to the device. So a very simple watchdog daemon would look -like this source file: see samples/watchdog/watchdog-simple.c +like this source file: see samples/watchdog/watchdog-simple.c =20 A more advanced driver could for example check that a HTTP server is still responding before doing the write call to ping the watchdog. @@ -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,12 +144,12 @@ 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 =20 -All watchdog drivers are required return more information about the system, +All watchdog drivers are required to return more information about the sys= tem, some do temperature, fan and power level monitoring, some can tell you the reason for the last reboot of the system. The GETSUPPORT ioctl is available to ask what the device can do:: @@ -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 timeout. 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 character 'V' is written to /dev/watchdog before the file descriptor +is closed. Without writing 'V' before closing, the watchdog remains active +and will trigger a reboot after the timeout expires. + + =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 @@ -254,6 +274,11 @@ returned value is the temperature in degrees Fahrenhei= t:: int temperature; ioctl(fd, WDIOC_GETTEMP, &temperature); =20 +.. note:: + ``WDIOC_GETTEMP`` is not implemented by the watchdog core and is + considered deprecated. It is only supported by a small number of + legacy drivers. New drivers should not implement it. + Finally the SETOPTIONS ioctl can be used to control some aspects of the cards operation:: =20 @@ -268,4 +293,22 @@ 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. + +.. note:: + ``WDIOS_TEMPPANIC`` is not implemented by the watchdog core and is + considered deprecated. It is only present in a small number of + legacy drivers. New drivers should not implement it. --=20 2.43.0