Skip to content
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

i2c: Drivers are not thread safe #3694

Closed
zephyrbot opened this issue Jun 8, 2017 · 2 comments
Closed

i2c: Drivers are not thread safe #3694

zephyrbot opened this issue Jun 8, 2017 · 2 comments
Labels
area: API Changes to public APIs area: I2C Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jun 8, 2017

Reported by M R Rosen:

Specifically using the QMSI driver in multiple threads, the driver is not thread safe. Currently, the driver tries to protect the controller via semaphore but does so only around the calls to the QMSI HAL and NOT while a transaction is in progress, meaning that another thread can come in and mess with the controller (and thus a transactions) while the previous transaction is still in progress, leading to incorrect behavior in either the ongoing or next transaction. A quick survey of the other I2C drivers revealed that either they have no multithread protection at all (STM32, NRF5) or have the same issue (QMSI SS). My understanding was that Zephyr is attempting to make all drivers thread safe; so I just wanted to report that not all drivers are.

A simple example can be created where two threads attempt to use the I2C bus (I had them talking to the same device but it shouldnt matter) in quick succession (Such that thread 1 is waiting on the syncing semaphore when thread 2 calls i2c_transfer).

(Imported from Jira ZEP-2259)

@zephyrbot
Copy link
Collaborator Author

by Mark Linkmeyer:

Anas Nashif , why did you move this bug back to the New state?

@zephyrbot zephyrbot added priority: medium Medium impact/importance bug area: I2C bug The issue is a bug, or the PR is fixing a bug labels Sep 23, 2017
@linkmeyer linkmeyer added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Dec 6, 2017
@carlescufi carlescufi added the area: API Changes to public APIs label Apr 17, 2018
@carlescufi carlescufi changed the title I2C Drivers are not thread safe i2c: Drivers are not thread safe May 28, 2019
@carlescufi
Copy link
Member

Closing in favor of #18970

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: I2C Enhancement Changes/Updates/Additions to existing features priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants