RT-Thread / RT-Thread/rt-thread

[Bug] 多线程同时访问sdio的host请求时,会出现公共资源打架情况

Open
#11,245 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

RT-Thread Version

master(v5.2.2)

Hardware Type/Architectures

Cortex-M33

Develop Toolchain

RT-Thread Studio

Describe the bug

线程A通过sdio发送CMD53之前,线程B执行wifi模组拉低的data1,向主控mcu发出了SDIO_IRQ。这个时候遇到了我的主控mcu执行CMD53 write,也就是说data1撞上了CMD53 write,导致两个线程都去去request host请求,这个时候会出现打架情况

Other additional context

具体波形如下
Image
我目前本地的做法是mmcsd_send_request函数的这个位置进行加上了互斥锁进行规避,两个线程同时访问公共资源打架的问题

Image

所以想跟你们确认一下这里是不是要加lock?或者说之前的这么设计是想是用在一个线程中呢?

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

Start with mmcsd_send_request and the SDIO IRQ/CMD53 request path described in the report. Review how concurrent host requests are handled and determine the intended locking model; done means simultaneous SDIO accesses no longer contend for the shared host resource, with the behavior verified against the reported scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.