aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/watchdog
Commit message (Collapse)AuthorAgeFilesLines
* watchdog: Fix a couple type issuesJustin Hibbits2026-06-101-2/+2
| | | | | | | | | | | | | * Force the type of the literal `1` passed to nstosbt() to ensure it's a 64-bit type (or larger). Otherwise it gets inconveniently typed to int, resulting in truncation. * Use `flsll()` when converting sbt to power-of-2-nanoseconds to fix 32-bit compatibility. PR: 292616 Obtained from: Hewlett Packard Enterprise Fixes: 26d6617f3 ("watchdog: Convert to using sbintime_t format") MFC after: 3 days
* watchdog: ifdef wd_ioctl_patpat on COMPAT_FREEBSD14Mateusz Guzik2025-10-011-0/+2
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* watchdog: Convert to using sbintime_t formatJustin Hibbits2025-08-141-93/+107
| | | | | | | | | | | | | | Summary: Some watchdogs are now based on a countdown timer instead of a bit check. To deal with these, convert the watchdog framework to use sbintime_t instead of power-of-2-nanoseconds. This allows more precision, and more variety of watchdog timeouts. Keep the old method as a compatibility layer, so that drivers can be migrated slowly, as needed. Reviewed by: jhb Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D49183
* watchdog: Add a new "Control" ioctlJustin Hibbits2025-08-141-0/+20
| | | | | | | | | | Summary: In preparation for a new watchdog timeout interface using sbintime_t, add a new control ioctl to arm, pat, and disarm the watchdog. Reviewed by: jhb, phk Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D49182
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* watchdog: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365133
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* make SW_WATCHDOG dynamicMike Karels2018-01-031-0/+15
| | | | | | | | | | | | | | | | | | | | Enable the hardclock-based watchdog previously conditional on the SW_WATCHDOG option whenever hardware watchdogs are not found, and watchdogd attempts to enable the watchdog. The SW_WATCHDOG option still causes the sofware watchdog to be enabled even if there is a hardware watchdog. This does not change the other software-based watchdog enabled by the --softtimeout option to watchdogd. Note that the code to reprime the watchdog during kernel core dumps is no longer conditional on SW_WATCHDOG. I think this was previously a bug. Reviewed by: imp alfred bjk MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D13713 Notes: svn path=/head/; revision=327505
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Some cosmetic polishing for pre-timeouts.Alexander Motin2017-04-201-4/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=317185
* CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenJung-uk Kim2015-05-221-2/+2
| | | | | | | | | | | | | years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent. Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks Notes: svn path=/head/; revision=283291
* Add a missing include of an options header.Ryan Stone2015-02-281-0/+3
| | | | | | | | | | | watchdog.c does an #ifdef DDB but does not #include "opt_ddb.h". Fixing this turned up a missing include file. MFC after: 1 week X-MFC-With: r261495, r279410 Notes: svn path=/head/; revision=279413
* Use right buffer to print to.Ed Schouten2014-02-041-1/+1
| | | | | | | | | PR: kern/176597 Submitted by: Christoph Mallon <christoph mallon gmx de> MFC after: 2 weeks Notes: svn path=/head/; revision=261495
* Fix watchdog pretimeout.Alfred Perlstein2013-07-271-4/+70
| | | | | | | | | | | The original API calls for pow2ns, however the new APIs from Linux call for seconds. We need to be able to convert to/from 2^Nns to seconds in both userland and kernel to fix this and properly compare units. Notes: svn path=/head/; revision=253719
* watchdogd(8) and watchdog(4) enhancements.Alfred Perlstein2013-02-271-18/+224
| | | | | | | | | | | | | | | | | | | | | | The following support was added to watchdog(4): - Support to query the outstanding timeout. - Support to set a software pre-timeout function watchdog with an 'action' - Support to set a software only watchdog with a configurable 'action' 'action' can be a mask specifying a single operation or a combination of: log(9), printf(9), panic(9) and/or kdb_enter(9). Support the following in watchdogged: - Support to utilize the new additions to watchdog(4). - Support to warn if a watchdog script runs for too long. - Support for "dry run" where we do not actually arm the watchdog, but only report on our timing. Sponsored by: iXsystems, Inc. MFC after: 1 month Notes: svn path=/head/; revision=247405
* - Add the possibility to reuse the already last used timeout when pattingAttilio Rao2011-04-271-13/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | the watchdog, via the watchdog(9) interface. For that, the WD_LASTVAL bitwise operation is used. It is mutually exclusive with any explicit timout passing to the watchdogs. The last timeout can be returned via the wdog_kern_last_timeout() KPI. - Add the possibility to pat the watchdogs installed via the watchdog(9) interface from the kernel. In order to do that the new KPI wdog_kern_pat() is offered and it does accept normalized nanoseconds or WD_LASTVAL. - Avoid to pass WD_ACTIVE down in the watchdog handlers. All the control bit processing should over to the upper layer functions and not passed down to the handlers at all. These changes are intended to be used in order to fix up the watchdog tripping in situation when the userland is busted, but protection is still wanted (examples: shutdown syncing / disk dumping). Sponsored by: Sandvine Incorporated Reviewed by: emaste, des, cognet MFC after: 2 weeks Notes: svn path=/head/; revision=221121
* Revisit the watchdogs: Resetting the error to EINVAL after failing to set theNick Hibma2007-03-271-0/+2
| | | | | | | | | | | watchdog might hide the succesful arming of an earlier one. Accept that on failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is returned instead of the more appropriate EINVAL. MFC after: 3 days Notes: svn path=/head/; revision=167950
* Align the interfaces for the various watchdogs and make the interfaceNick Hibma2006-12-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | behave as expected. Also: - Return an error if WD_PASSIVE is passed in to the ioctl as only WD_ACTIVE is implemented at the moment. See sys/watchdog.h for an explanation of the difference between WD_ACTIVE and WD_PASSIVE. - Remove the I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOR define. If you've lost your sense of humor, than don't add a define. Specific changes: i80321_wdog.c Don't roll your own passive watchdog tickle as this would defeat the purpose of an active (userland) watchdog tickle. ichwd.c / ipmi.c: WD_ACTIVE means active patting of the watchdog by a userland process, not whether the watchdog is active. See sys/watchdog.h. kern_clock.c: (software watchdog) Remove a check for WD_ACTIVE as this does not make sense here. This reverts r1.181. Notes: svn path=/head/; revision=165260
* Return zero when disabling watchdog, unless any of the drivers complain.Poul-Henning Kamp2005-09-291-2/+6
| | | | Notes: svn path=/head/; revision=150707
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-2/+2
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Add a generic watchdog facility which through a single device entryPoul-Henning Kamp2004-02-281-0/+89
in /dev controls all available watchdog implementations. Notes: svn path=/head/; revision=126370