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

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

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

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.

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?或者说之前的这么设计是想是用在一个线程中呢?

Dominant language
C
Stars
12.4k
Forks
5.5k
Avg merge
3d 7h
Merged PRs (30d)
79

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from RT-Thread/rt-thread

All issues in RT-Thread/rt-thread

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.