Christian Mauderer created a merge request: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1594

Project:Branches: c-mauderer/rtems:up6/thread-timeout to rtems/rtos/rtems:6
Author: Christian Mauderer
Assignee: Christian Mauderer

## Summary

This is a backport of !1481 and would close #5825.

**NOTE: This contains an API change!**

>From the original MR description:

**Problem:** The watchdog code drops its lock before it calls a timeout 
handler. If a thread's wait is satisfied in that gap and the thread starts a 
new wait, the late `_Thread_Timeout()` cancels the new wait. The thread gets a 
false `STATUS_TIMEOUT`, or its watchdog leaks and corrupts the watchdog tree. 
On SMP every timed wait is exposed. On uniprocessor it needs a 
`rtems_clock_set()` or `clock_settime()`. Rate monotonic periods have the same 
race.

**Fix:**
* Run the time of day tickle and `rtems_clock_tick()` with thread dispatch 
disabled, so no thread can run in the gap on uniprocessor.
* Give the thread wait flags a generation and hand it to the handler in a new 
watchdog token. On SMP, `_Thread_Timeout()` and `_Rate_monotonic_Timeout()` 
ignore a token of an old wait.

## Generative AI

### Prompt used

None as a single prompt. Interactive Claude Code session: run the simulator 
test suites, diagnose each failure and fix the cause. I directed and reviewed 
every change.

### AI model used

Claude Opus 5 (claude-opus-5), through Claude Code.

### How AI was used for the contribution

* ( ) Formatting
* (x) Test creation.
* (x) Code comments.
* ( ) The entire contribution was generated using AI
* ( ) AI code completion such as Copilot in VSCode.

Diagnosis, code, tests and commit messages were written in that session under 
the authors direction.

### Access

The author has legitimate access to the tool, and it claims no copyright in its 
output.

<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1594
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/namespace/49/sent_notifications/6-36xrpu38i25uatk60foht3scj-1d/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to