🎯 Sync smart & scheduler codes by polarvid · Pull Request #8537 · RT-Thread/rt-thread
BernardXiong
changed the title
Sync smart & scheduler codes
🎯 Sync smart & scheduler codes
Add Support for ~FUTEX_PRIVATE, and futex requeue and futex pi feature. Co-authored-by: xqyjlj <xqyjlj@126.com> Signed-off-by: Shell <smokewood@qq.com>
This patch adds an abstraction layer of scheduler(rt_sched). Following features are added: - The scheduler class (rt_sched) is added for rtthread source and ipc primitives. Critical region of scheduler is also redesigned to simplify the synchronization and acquire better performance. - Support nested lock/unlock detection for scheduler - Suspended thread and completed status tracking of rt_completion is modified for smaller footprint and easier locking. - Add suspend list - A basic building block for IPC primitives which interacts with scheduler directly. Its API is similar to a FIFO list. This new object simplify the synchronization between IPC primitives and asynchronization event like timeout, signals. And it fixed the data racing commonly found on IPC objects currently. - add RT_TIMER_FLAG_THREAD_TIMER as new type of rt_timer for rt_thread, so the timer is notified to do the necessary co-op with scheduler, as the legacy semantics required. Besides, following bugs are fixed: - _scheduler_get_highest_priority_thread() may access an empty list, and cause the codes to corrupt. - rt_thread_control(RT_THREAD_CTRL_CHANGE_PRIORITY) has data racing with scheduler codes, by the leaving of the critical region for a while which corrupts the data coherency of ready queue. - data racing on rt_completion. - in rt_timer_check(): rt_hw_cpu_id() should be called with IRQ masked. - fixup of mutex_delete(). While mutex owner did not release the mutex but delete it after taken, the prio inheritance algorithm may cause the owner thread to lose its original priority. This patch fix this issue by adding a thread priority restore on rt_mutex_delete()/ rt_mutex_detach() API. - For qemu-vexpress-a9, fixup boot-up failure while RT_CPUS_NR is config as 1. Signed-off-by: Shell <smokewood@qq.com>
polarvid
marked this pull request as ready for review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters