RT-Thread / RT-Thread/rt-thread

SMP 下 rt_hw_interrupt_disable 的实现问题

Open
#7,173 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

当前 SMP 下面 rt_hw_interrupt_disable 的实现是禁用局部的中断,禁用其他核的调度器。这个有个问题是其他核的中断其实是没有被禁用的,所以其实如果在 ISR 里面用了资源的话其实是保护不到的…………

不过鉴于 rt_hw_interrupt_disable 用的太多了,用一次就禁用其他核的中断也不合适,所以最好的方式或许还是:

SMP 模式下每个 IPC 对象内嵌一个 spin lock,rt_hw_interrupt_disable 从 rt_cpus_lock 切换成 rt_spin_lock_irqsave,等在各个对象的锁里而不是全局锁。

非 SMP 模式下退化成当前的模式

貌似没捷径可以走哇

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing rt_hw_interrupt_disable, rt_cpus_lock, and the IPC object implementations; done would require protecting SMP IPC objects with per-object spin locks while preserving the current non-SMP behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.