Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/software_requirements/index.sdoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ FILE: semaphore.sdoc
[DOCUMENT_FROM_FILE]
FILE: power_management.sdoc

[DOCUMENT_FROM_FILE]
FILE: task_watchdog.sdoc

[DOCUMENT_FROM_FILE]
FILE: thread_communication.sdoc

Expand Down
197 changes: 197 additions & 0 deletions docs/software_requirements/task_watchdog.sdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
[DOCUMENT]
TITLE: Task Watchdog
PREFIX: ZEP-SRS-20-

[GRAMMAR]
IMPORT_FROM_FILE: software_requirements.sgra

[TEXT]
STATEMENT: >>>
SPDX-License-Identifier: Apache-2.0
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-9
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Enable Task Watchdog feature
STATEMENT: >>>
The Task Watchdog feature shall be configurable to be enabled or disabled.
<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to enable the Task Watchdog feature so that I can monitor the health of my tasks.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-11
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Enable hardware failsafe option
STATEMENT: >>>
The Task Watchdog shall provide a configuration option to enable or disable the hardware watchdog failsafe.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added action in #97 to rephrase to "The Zephyr RTOS"
No action needed

<<<
USER_STORY: >>>
As a safety system designer, I want a hardware watchdog failsafe so that the system can recover from a critical failure where the Task Watchdog itself stops operating.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-12
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Configure hardware watchdog timeout period
STATEMENT: >>>
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the hardware watchdog timeout period to be configured.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the hardware watchdog timeout period to be configured.
When the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the hardware watchdog timeout period to be configurable.

<<<
USER_STORY: >>>
As a safety system designer, I want to configure the hardware watchdog timeout period so that I can ensure the system resets within the time constraints required for functional safety.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between 12 and 13?
Can you relate to task_wdt/Kconfig or the code?
TASK_WDT_HW_FALLBACK_DELAY vs TASK_WDT_MIN_TIMEOUT maybe?

STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Configure maximum feed period
STATEMENT: >>>
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the maximum hardware watchdog feed period to be configured.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the maximum hardware watchdog feed period to be configured.
When the hardware watchdog failsafe is enabled, the Task Watchdog shall allow the maximum hardware watchdog feed period to be configured.

<<<
USER_STORY: >>>
Information: The Task Watchdog schedules a timer to either feed the hardware watchdog, or detect the next software task timeout, whichever comes first.

As a Zephyr RTOS user, I want to control the hardware watchdog feed period so that I can guarantee the hardware watchdog is serviced frequently enough to prevent an unintended reset.

As a Zephyr RTOS user, I want to align the feed period with my task timeouts so that I can optimize system performance by avoiding unnecessary timer events.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-10
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Configure maximum task watchdog timers
STATEMENT: >>>
The Task Watchdog shall allow the maximum number of supported task watchdog timers to be configured.
<<<
USER_STORY: >>>
As a developer, I want to configure the maximum number of watchdog channels so that I can balance memory usage with the number of tasks I need to monitor.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-8
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Initialize feature
STATEMENT: >>>
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall start the hardware watchdog upon initialization.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon initialization of what?
I am not an expert, but can we refer to a Zephyr state? Or rephrase "upon initialization of the HW task watchdog" or "upon its initialization"?
Could also maybe leave the concept of Zephyr initialization out and talk about when the HW watchdog feeding should start? (abstract ourselves from the implementation/architecture)

Suggested change
Where the hardware watchdog failsafe is enabled, the Task Watchdog shall start the hardware watchdog upon initialization.
When the hardware watchdog failsafe is enabled, the Task Watchdog shall start the hardware watchdog upon initialization of the Task Watchdog component.

<<<
USER_STORY: >>>
As a safety system designer, I want the hardware watchdog to start automatically with the Task Watchdog so that the system is protected by the failsafe mechanism from the very beginning of operation.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-1
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Start monitoring task
STATEMENT: >>>
The Task Watchdog shall provide a method to start monitoring a task watchdog timer.
<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to start monitoring a task with a watchdog timer so that I can guarantee the task is executing as intended.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-15
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Set callback function
STATEMENT: >>>
When starting a task watchdog timer, the Task Watchdog shall accept a callback function to be invoked if the timer expires.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When starting a task watchdog timer, the Task Watchdog shall accept a callback function to be invoked if the timer expires.
When starting a task watchdog timer, the Task Watchdog shall accept a callback function to be invoked when the timer expires.

<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to provide a custom callback function for a watchdog timer so that I can implement specific corrective actions if a task becomes unresponsive.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-16
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Set callback user data
STATEMENT: >>>
When starting a task watchdog timer, the Task Watchdog shall accept user data to be passed as an argument to the callback function.
<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to associate custom data with a watchdog timer so that I can receive context-specific information in my callback function to identify which task or instance failed.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-2
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Stop monitoring task
STATEMENT: >>>
The Task Watchdog shall provide a method to stop monitoring a task watchdog timer.
<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to stop monitoring a task so that I can prevent false timeouts when a task completes its work and is no longer expected to run.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-3
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Feed task watchdog timer
STATEMENT: >>>
The Task Watchdog shall provide a method to feed the task watchdog timer.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To stay consistent with ZEP-SRS-20-2

Suggested change
The Task Watchdog shall provide a method to feed the task watchdog timer.
The Task Watchdog shall provide a method to feed a task watchdog timer.

<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want to periodically feed a task watchdog timer so that I can signal that my task is running correctly and prevent a timeout.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-4
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Callback on task failure
STATEMENT: >>>
Where a callback function is configured for a monitored task watchdog timer, if the timer expires, then the Task Watchdog shall invoke that function.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Where a callback function is configured for a monitored task watchdog timer, if the timer expires, then the Task Watchdog shall invoke that function.
When callback function is configured for a monitored task watchdog timer, when the timer expires, then the Task Watchdog shall invoke that function.

<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want my registered callback function to be executed when a watchdog expires so that my custom error-handling logic is triggered automatically.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-5
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Reset on task failure
STATEMENT: >>>
Where a callback function is not configured for a monitored task watchdog timer, if the timer expires, then the Task Watchdog shall reset the device.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Zephyr is running in a hypervisor, we likely do not have control over the device it is running on.

Suggested change
Where a callback function is not configured for a monitored task watchdog timer, if the timer expires, then the Task Watchdog shall reset the device.
When a callback function is not configured for a monitored task watchdog timer, when the timer expires, then the Task Watchdog shall reset the RTOS.

Not blocking: Also, general comment: Should Zephyr allow for that "default" mechanism to be configurable?
One may want an RTOS restart, another something else?
Added a suggestion in #97

<<<
USER_STORY: >>>
As a Zephyr RTOS user, I want the system to reset by default when a critical task hangs so that it can be returned to a known-good state without complex recovery code.
<<<

[REQUIREMENT]
UID: ZEP-SRS-20-6
STATUS: Draft
TYPE: Functional
COMPONENT: Task Watchdog
TITLE: Auto feed hardware watchdog
STATEMENT: >>>
Where the hardware watchdog failsafe is enabled, while all monitored tasks are feeding their respective watchdog timers, the Task Watchdog shall periodically feed the hardware watchdog.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Periodically requires refinement, consider using the predefined term (req above) "maximum hardware watchdog feed period"
Also consider removing the "while ..." part which only seems to be there because the implementation mechanism mixes feeding hw wdt and triggering a hw wdt feeding depending on other wdt.

Suggested change
Where the hardware watchdog failsafe is enabled, while all monitored tasks are feeding their respective watchdog timers, the Task Watchdog shall periodically feed the hardware watchdog.
When the hardware watchdog failsafe is enabled, the Task Watchdog shall feed the hardware watchdog at least every maximum hardware watchdog feed period.

<<<
USER_STORY: >>>
As a safety system designer, I want the Task Watchdog to manage feeding the hardware watchdog so that a failure on any monitored task will still cause a corrective reset.
<<<
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get this pull going, I will be logging items in #97 for:

  1. task_wdt_resume
  2. task_wdt_suspend
  3. TASK_WDT_HW_FALLBACK_DELAY (depending on answers)
  4. TASK_WDT_HW_FALLBACK_PAUSE_IN_SLEEP
  5. TASK_WDT_SHELL