-
-
Notifications
You must be signed in to change notification settings - Fork 771
capsules/i2c_master_slave_driver: use grant, enforce single process #2547
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
Conversation
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.
Overall this looks good, just two minor issues/questions.
} else { | ||
return Err((slice, ErrorCode::NOMEM)); | ||
} | ||
let app = self.app.expect("cant fail"); |
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.
Isn't app
always equivalent to process_id
here, given the logic above? Then I suppose we could just use that and get rid of the expect
.
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.
good call, done
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.
Did you push this already?
Enforce that only a single process may (implicitly) reserve the nonvirtualized userspace driver. Also, store callbacks and appslices in grant regions.
_ => Err((slice, ErrorCode::NOSUPPORT)), | ||
let res = self | ||
.apps | ||
.enter(app, |app| { |
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.
Nit: this technically works, though the ProcessId
and Grant
region are related but different things and I fear that shadowing the app
variable might be confusing. Feel free to not change this if not considered an issue.
bors r+ |
Pull Request Overview
This pull request enforces that only a single process may (implicitly) reserve the nonvirtualized userspace driver. Also, the driver now store callbacks and appslices in grant regions.
This is one of the remaining capsules blocking #2462 .
One observation: repeatedly handling the possibility of a grant entrance (within a single function) failing is a pain. But I do not think it is possible for a grant entrance to fail after the first entrance -- the grant is already allocated at that point, and the process is present. So I omitted the error handling in
command()
after the first grant entrance.Testing Strategy
This pull request was tested by compiling.
TODO or Help Wanted
N/A
Documentation Updated
Formatting
make prepush
.