-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎯 Sync smart & scheduler codes #8537
Conversation
67fdcbb
to
00bb5b9
Compare
改动这么大,是不是有些测试结果给出来,是不是确实优化了,性能提高了多少😂 |
bbac067
to
8519468
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我阻塞一下合入按钮,这个准备好了麻烦让我review一下
b616303
to
83ab91c
Compare
新增 UTEST 集
|
麻烦基于最新基线重新rebase一下 并通过CI |
Add Support for ~FUTEX_PRIVATE, and futex requeue and futex pi feature. Co-authored-by: xqyjlj <[email protected]> Signed-off-by: Shell <[email protected]>
In the previous implementation, each call will create a new timer object for the process. But according to the manual, the itimer is a singleton object per-process. This un-compatible semantic will corrupt the API by a call to cancel previous setup timer. Signed-off-by: Shell <[email protected]>
83ab91c
to
ef759b9
Compare
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 <[email protected]>
Signed-off-by: Shell <[email protected]>
ef759b9
to
cb50021
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我关心的问题已经都解决。
|
||
int main(void) | ||
{ | ||
printf("Hello RT-Thread!\n"); | ||
rt_kprintf("Hello RT-Thread!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在内核里用printf和rt_kprintf的讲究是啥?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
尽量用rt_kprintf吧 这个只是编程习惯~ printf里边乱七八糟一堆东西不可控
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
musl 工具链会串到 stdio 那个地方,然后跑飞了。总之内核态还是不要用用户态的 print 为好,两边实现思路都不一样。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果是我 我也不用printf,这玩意完全依赖第三方libc。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后面mlibc需要提上日程了,smart最终还得依赖于mlibc的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在还有个头文件的问题。仓库里面不同的 BSP 用的工具链自带的头文件,因为跨架构,有些甚至是直接拿的 x86 Linux ,存在很多不兼容的定义。比如 time.h
里面的 struct timeval
。
RT_ASSERT(_dfs_page_insert(aspace, page) == 0); | ||
if (_dfs_page_insert(aspace, page)) | ||
{ | ||
RT_ASSERT(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不如将RT_ASSERT在不开debug的选项的时候让他求表达式,例如:
#define RT_ASSERT(EX) \
do { \
rt_base_t val; \
val = (exp); \
} while (0)
因为ASSERT是对值进行断言,如果调用者使用了复合表达式,那应该要执行他的符合表达式。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个变量不使用的话,编译器还是可以优化掉的吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过感觉这样改会有兼容性问题,还是先别动了,可以做为一个讨论。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还是建议不要在ASSERT内写太复杂的计算,而更多是判断。所以,最好也用不ASSERT的方式编译过代码,运行过代码。
未来也可以加入,RT_ASSERT_RET(condition, ret)的方式来处理condition不满足时应该返回,跳出函数的处理。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RT_ASSERT_RET(condition, ret) 好建议~ 我创建了一个issue 后续可以处理 #8553
这个 PR 主要是功能修复和 smart 的 IPC 研发分支同步。功能在 qemu aa64, a9, rv64 以及星火一号,rpi4b 64 平台上面测试过所有的内核 UTEST。新加入的 UTEST 结果参考 #8537 (comment) 。 性能方面,在 arm64 多核平台下测试,PR 前后 cyclictest 的 MIN/AVG 指标分别有 42.31%/41.94% 的优化,MAX 降低了 50.77%。iperf 带宽抖动明显减小,多核性能和单核性能基本一致。 |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up