-
-
Notifications
You must be signed in to change notification settings - Fork 771
capsules: Convert analog comparator to use grant #2521
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
4900288
to
0daebbd
Compare
Good point. I think that is worth an extra check. |
bors r+ |
Merge conflict. |
if match_or_empty_or_nonexistant { | ||
self.current_process.set(appid); | ||
} else { | ||
return CommandReturn::failure(ErrorCode::NOMEM); |
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.
Intuitively I would've expected another ErrorCode, something like BUSY
? NOMEM
kind of fits here I guess?
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.
Historically that is the error that has been returned because there was no memory available to store the new process's request when grants were not being used.
Maybe we should use ErrorCode::RESERVE
? I'm not that worried either way as I don't think userspace will actually use these and they should be virtualized anyway.
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 explanation behind NOMEM
makes sense, I'm happy to use that. I went through the other error codes and I agree, no other code seems to fit well.
I'll update #2518 for consistency's sake.
I've just run a minimal example of how this PR checks whether a nonvirtualized driver can be reserved by a process, compared to the implementation in #2518. This was only for curiosity's sake, and to see whether entering the Grant would have significant impact. These numbers are obtained on a
This is probably fine for non-virtualized drivers (given they aren't Tock's idiomatic way to write drivers). It does however seem to tell us that entering a Grant has a cost which one might want to look into optimizing, along with system call routing and switching to a process. Here is a more thorough investigation of the instructions spent on syscall routing. |
Used in more places than I thought!
c353010
3d02227
to
c353010
Compare
bors r+ |
As part of tock#2462, this migrates the spi_peripheral non-virtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in tock#2521. Signed-off-by: Leon Schuermann <[email protected]>
As part of tock#2462, this migrates the sdcard non-virtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in tock#2521. Signed-off-by: Leon Schuermann <[email protected]>
As part of tock#2462, this migrates the spi_controller nonvirtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in tock#2521. Signed-off-by: Leon Schuermann <[email protected]>
2559: capsules/spi_peripheral: migrate non-virtualized driver to Grants r=bradjc a=lschuermann ### Pull Request Overview As part of #2462, this migrates the spi_peripheral non-virtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. Signed-off-by: Leon Schuermann <[email protected]> ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] ~Updated the relevant files in `/docs`,~ or no updates are required. ### Formatting - [x] Ran `make prepush`. 2560: capsules/sdcard: migrate non-virtualized userspace driver to Grants r=bradjc a=lschuermann ### Pull Request Overview As part of #2462, this migrates the sdcard non-virtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. Signed-off-by: Leon Schuermann <[email protected]> ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] ~Updated the relevant files in `/docs`,~ or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Leon Schuermann <[email protected]>
2547: capsules/i2c_master_slave_driver: use grant, enforce single process r=bradjc a=hudson-ayers ### 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 - [x] No updates are required. ### Formatting - [x] Ran `make prepush`. 2558: capsules/spi_controller: migrate non-virtualized driver to Grants r=bradjc a=lschuermann ### Pull Request Overview As part of #2462, this migrates the spi_controller nonvirtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. Signed-off-by: Leon Schuermann <[email protected]> ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] ~Updated the relevant files in `/docs`, or~ no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Hudson Ayers <[email protected]> Co-authored-by: Leon Schuermann <[email protected]>
2572: capsules/l3gd20: migrating non-virtualized driver to Grants r=hudson-ayers a=phil-levis ### Pull Request Overview As part of #2462, this migrates the l3gd20 nonvirtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Philip Levis <[email protected]>
2575: capsules/ltc294x-grant: migrating non-virtualized driver to Grants r=hudson-ayers a=phil-levis ### Pull Request Overview As part of #2462, this migrates the ltc294x nonvirtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Philip Levis <[email protected]>
2574: capsules/lsm303agr: migrating non-virtualized driver to Grants r=hudson-ayers a=phil-levis ### Pull Request Overview As part of #2462, this migrates the lsm303agr nonvirtualized userspace driver to keep process state in a Grant region. It adopts the mechanism to reserve a driver as introduced in #2521. ### Testing Strategy This pull request was tested by compiling. ### TODO or Help Wanted N/A ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make prepush`. Co-authored-by: Philip Levis <[email protected]>
Pull Request Overview
As part of #2462 this switches the analog comparator capsule to use a grant.
Testing Strategy
travis
TODO or Help Wanted
n/a
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.