Zepp-Hanzj opened a new pull request, #19433:
URL: https://github.com/apache/nuttx/pull/19433

   ## Summary
   
   Fix watchdog capture-based automonitor handling for lower-half drivers that 
invoke the capture callback with a `NULL` argument, and make timeout notifier 
delivery match the documented automonitor contract.
   
   ## Changes
   
   - Associate the active capture automonitor upper-half with the generic 
watchdog driver when the lower-half does not pass callback context.
   - Clear the association when automonitor stops and safely ignore a pending 
capture interrupt after stop.
   - Perform the hardware keepalive before invoking timeout notifiers, 
preserving the short EWI-to-reset window.
   - Call `watchdog_automonitor_timeout()` from the capture interrupt path when 
timeout notifiers are enabled.
   - Standardize notifier delivery to `WATCHDOG_NOTIFIER_ACTION` with `data == 
NULL`.
   - Document interrupt-context restrictions for notifier callbacks.
   - Add an independent simulator defconfig that registers only 
`cmocka_driver_watchdog`.
   - Include reproducible hardware and simulator validation evidence.
   
   ## Design limitation
   
   The fallback context is required only for lower-halves that call the capture 
handler with `arg == NULL`. Such a lower-half can support at most one active 
capture automonitor instance. Lower-halves that provide a per-instance callback 
argument remain instance-safe. This limitation is documented in the source and 
validation report; supporting multiple NULL-context lower-halves would require 
an instance-level callback/context interface in each affected lower-half.
   
   ## Validation
   
   ### Simulator
   
   - Notifier ordering and duplicate-registration behavior.
   - Repeated timeout notifications.
   - Unregister behavior.
   - Correct action and `NULL` data.
   - Concurrent register/timeout/unregister race.
   - Capture-stop pending-interrupt guard (validated with a temporary injection 
test; the injection hook was removed after validation).
   - All supported automonitor backends built and exercised: capture, watchdog, 
worker, oneshot, timer, and idle.
   
   Observed cmocka result:
   
   ```text
   [==========] tests: 2 test(s) run.
   [  PASSED  ] 2 test(s).
   ```
   
   ### STM32F407 hardware
   
   - Real WWDG EWI -> capture -> hardware keepalive -> notifier path.
   - Repeated notifier output with matching capture/monitor/timeout counters.
   - No-feed WWDG reset loop, confirmed by a new NSH banner after reset.
   - Long-running capture/notifier execution without HardFault or abnormal 
rapid reset.
   - WWDG `WDIOC_STOP` limitation recorded: STM32 WWDG cannot be stopped after 
it has been started, so a stop-race test cannot use the hardware stop ioctl as 
a success criterion.
   
   ## Evidence
   
   - [Validation report](docs/watchdog_automonitor_validation.md)
   - [STM32 WWDG reset UART 
log](docs/validation-evidence/watchdog/04-stm32-reset-cycle-0714.log)
   - [STM32 reset before 
screenshot](docs/validation-evidence/watchdog/04-stm32-reset-cycle-before.png)
   - [STM32 reset after 
screenshot](docs/validation-evidence/watchdog/04-stm32-reset-cycle-after.png)
   - [STM32 notifier UART 
log](docs/validation-evidence/watchdog/05-stm32-notifier-isr-0714.log)
   - [STM32 notifier 
screenshot](docs/validation-evidence/watchdog/05-stm32-notifier-isr-0714.png)
   - [Simulator notifier race 
log](docs/validation-evidence/watchdog/06-simulator-notifier-race-0714.log)
   - [STM32 lifecycle 
log](docs/validation-evidence/watchdog/07-stm32-lifecycle-0714.log)
   - [STM32 lifecycle 
screenshot](docs/validation-evidence/watchdog/07-stm32-lifecycle-0714.png)
   - [Simulator capture-stop race 
log](docs/validation-evidence/watchdog/08-simulator-capture-stop-race-0714.log)
   
   ## Relationship to nuttx-apps
   
   The companion test-only change is submitted separately in `nuttx-apps` as 
`fix/watchdog-notifier-tests`. Merge this core PR before enabling the companion 
test configuration.
   
   ## Checklist
   
   - [x] Core implementation change is isolated from board support and flashing 
scripts.
   - [x] Documentation and validation evidence are included.
   - [x] `git diff --check` passes.
   - [x] Simulator and STM32 validation completed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to