-
Notifications
You must be signed in to change notification settings - Fork 26
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
Expose asymmetric_light_barrier
and add a document
#56
Open
powergee
wants to merge
5
commits into
jonhoo:main
Choose a base branch
from
powergee:expose-barrier
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bcd84ec
Format codes and remove warnings on unused vars
powergee a69bc7f
Expose `asymmetric_light_barrier` and write a doc
powergee 7e85d86
Fix typo and format
powergee 5ba2f17
Correct some typos
powergee 230d1fe
Correct minor typo: `which` to `that`
powergee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording here is a little imprecise for my taste. The current phrasing makes it seem like an acknowledgement is somehow "sent" via a call to
asymmetric_light_barrier
, but that's not really what happens. My understanding is that the barrier specifically has two side-effects:load_ptr
onhead
happens strictly after the call toprotect_raw
head
, and that exchange is not observed by this thread, then theprotect_raw
must be visible to that other thread (since the exchange must have happened-after ourload_ptr
, which happened after ourprotect_raw
).I think it would be good to capture some of that nuance here and/or in the docs for
asymmetric_light_barrier
.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing, and I am sorry for the late reply. 😅
I agree with your point. The current explanation might mislead readers that
asymmetric_light_barrier
alone somehow prevents reclaimers from freeing the object, which is not true. I think that I have omitted too many details.The relationship between barriers and validation should be described more clearly.
The main idea that must be expressed would be that
asymmetric_light_barrier
makes essential happens-before relations to hold. For example, if I model the entire system of Hazard pointers like the following...The semantics of the light and heavy barrier are (
->
is happens-before relation):P2 -> R2
,P1 -> R3
(the protection ofP1
is visible toR3
).R2 -> P2
,R1 -> P3
(the retirement ofR1
is visible toP3
).P2
ensuresP1 -> P2 -> P3
andR2
ensuresR1 -> R2 -> R3
.These three lemmas cover the two points you mentioned. With these lemmas, we can show that:
P2
happens beforeR2
, the reclaimer will not freep
.R2
happens beforeP2
, the accessor will not accessp
.In either case, use-after-free errors do not occur.
So far, this is what I'm going to describe in a revised version. Please feel free to give comments if you want.
I think I'd be able to push a revised version this week. After the work, I would be happy if you review my PR again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that looks really good, thanks for diving so deep into it!