Skip to content

[Feature] rt_object_find函数应该允许在中断上下文使用 #10173

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

Open
mouch6131 opened this issue Apr 8, 2025 · 2 comments
Open

[Feature] rt_object_find函数应该允许在中断上下文使用 #10173

mouch6131 opened this issue Apr 8, 2025 · 2 comments

Comments

@mouch6131
Copy link
Contributor

Describe problem solved by the proposed feature

rt_object_find函数会调用RT_DEBUG_NOT_IN_INTERRUPT来检查当前上下文,如果在中断上下文会触发assert,从函数的实现来看,只是做了关中断(如果在smp架构下还会关调度),然后遍历链表,并不会导致睡眠。所以函数本身在中断上下文里调用应该是没有风险的,这个函数作为通用接口,目前就有在中断上下文调用的场景,例如:
如果启用了ulog和时间戳,同时启用了调度器的log,那tick中断就会直接调用到ulog的时间戳,进而通过这个函数去查找rtc的时间,此时assert就会触发,导致系统卡住。

Describe your preferred solution

No response

Describe possible alternatives

No response

@BernardXiong
Copy link
Member

感觉不应该,或者说,rt_object_find这个接口就不应该在中断上下文中使用。

@Guozhanxin
Copy link
Member

确实感觉,这个函数本身不应该在中断中使用,上面ulog的问题,应该具体问题具体分析。记得之前rtc读时间的时候,只会在第一次使用时调用find接口,后面就会把rtc设备的控制块保存在全局变量中了。所以,是不是应该考虑解决ulog使用rtc函数的时机问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants