-
Notifications
You must be signed in to change notification settings - Fork 5.2k
🎈 perf: perf rt_hw_interrupt_disable/enable #8042
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
Conversation
需要rebase一下代码 有冲突 |
a9c783f
to
84f98ca
Compare
|
一个是需要解决代码冲突,另外前向需要合并的关联PR也列出来吧 |
22c2402
to
fe2be07
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.
对于一些情况做些说明;对于counter的,希望都过一遍,大多数场合应该是atomic方式的,另外是名称,单独的counter意义比较单薄,是否有更好的名称,例如ref_count。
关于c++的原子类型,如果在c++中启用原子类型,那么 #ifdef __cplusplus
#include <atomic> // atomic 要在extern "C" {前面,导致rtdef.h也不能被extern "C"包含
extern "C" {
#endif
typedef std::atomic<size_t> rt_atomic_t; 还有一种是c++的原子操作用硬件原子或者软件模拟原子替换,这样就是和c语言的一样的实现了 |
还有一种c++的原子类型兼容是把c++的原子通过宏重定向到软件原子或者硬件原子,undef 掉RT_USING_STDC_ATOMIC,这样就不会包含stdatomic.h引起编译报错了 |
7aa38c9
to
7a9f812
Compare
21fff9c
to
8b6da61
Compare
Including usages under lwp_pid.c, lwp_tid.c, lwp_signal.c, lwp_syscall.c, lwp_pmutex.c, lwp.c. 2 API for safety mutex take are provided - lwp_mutex_take_safe/lwp_mutex_release_safe. They will restrict and verify the usage of the mutex. Remove the hw_interrupt API in ipc.c, and switch to spin lock for synchronization. Signed-off-by: Shell <[email protected]>
rt_spin_unlock_irqrestore(&_hard_spinlock, level); | ||
/* call timeout function */ | ||
t->timeout_func(t->parameter); |
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.
个人还是不是很理解 timeout_func
前后恢复中断状态的方案,虽然它确实在理论上对提升实时性有很大帮助。个人理解,在遍历 _timer_list
的前后关中断,不就是为了确保其它线程或者中断环境不会对 _timer_list
做任何修改吗? 而此处开启中断, 但不出现问题,是否意味着其它线程或者中断环境可以在此阶段修改 timer_list
, 遍历 _timer_list
的逻辑不会被影响? 那在这个函数中关中断的意义何在?
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.
如果中断中使用了timer相关的api,是会修改timer_list,而且可能会插到链表前面去,造成漏掉一个时钟节拍。这个确实需要考虑。
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
优化调度器,优化大量大锁代码, RT_USING_SIGNALS 由于环境原因,目前暂未优化
你的解决方案是什么 (what is your solution)
在什么测试环境下测试通过 (what is the test environment)
arm64
arm
]
当前拉取/合并请求的状态 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