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

CircularBuffer: volatile specifier removal #7727

Merged
merged 1 commit into from
Aug 9, 2018
Merged

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Aug 8, 2018

Volatile specifier in this case it not required as we currently have all accesses
to the buffer protected by critical section. This shall optimize accesses in
some cases to the buffer.

Fixes #7702

Description

Pull request type

[ ] Fix
[X] Refactor
[ ] Target update
[ ] Feature
[ ] Breaking change

Volatile specifier in this case it not required as we currently have all accesses
to the buffer protected by critical section. This shall optimize accesses in
some cases to the buffer.

Fixes ARMmbed#7702
Copy link
Contributor

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing to worry about I can see is construction, but any execution context that invokes the constructor and then hands the buffer to another context /should/ already have its own ordering for that handover, otherwise the handover would be a race.

But this is not a "fix". It's not fixing an actual bug, and it could conceivably trip a problem in something lacking correct init synchronisation.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 8, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Aug 8, 2018

Build : SUCCESS

Build number : 2759
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7727/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Aug 8, 2018

@mbed-ci
Copy link

mbed-ci commented Aug 8, 2018

@cmonr
Copy link
Contributor

cmonr commented Aug 9, 2018

Hmm...
/morph test

But this is not a "fix". It's not fixing an actual bug, and it could conceivably trip a problem in something lacking correct init synchronisation.

@kjbracey-arm Like for example, the lp-timeout callback test?

@mbed-ci
Copy link

mbed-ci commented Aug 9, 2018

@cmonr cmonr merged commit 0346d22 into ARMmbed:master Aug 9, 2018
@bmcdonnell-ionx
Copy link
Contributor

@cmonr / @0xc0170,

Do you think it's likely that someone else will look at the code in the future and ask questions rehashing the conversation in #7702? If so, consider adding comments in the code.

@kjbracey
Copy link
Contributor

Once the volatiles have gone from here, not sure it's worth noting their absence.

I think it is worth noting in the documentation of the enter/exit critical functions themselves. If you're using those functions, using ordinary variables without volatile should be as "routine" as using variables without volatile in multiple threads with Mutex::lock().

@kjbracey
Copy link
Contributor

Relabelled as a refactor and release in 5.10.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Aug 10, 2018

Do you think it's likely that someone else will look at the code in the future and ask questions rehashing the conversation in #7702? If so, consider adding comments in the code.

@bmcdonnell-ionx The details are in the commit message (why they are being removed and what we are fixing). I found it sufficient for this case.

@mbed-ci
Copy link

mbed-ci commented Aug 10, 2018

pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018
CircularBuffer: volatile specifier removal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants