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

Remove Guest's idea of active and locking in len() #475

Merged

Conversation

jmpesp
Copy link
Contributor

@jmpesp jmpesp commented Oct 4, 2022

Guest previously had its own idea of active, and this is slightly confusing. This commit removes that, and instead lets the Upstairs tell consumers if it is active or not.

Additionally, getting the length of a Buffer shouldn't take a lock. Make len() and is_empty() synchronous by storing the length (it shouldn't change!).

Closes #461

Guest previously had its own idea of active, and this is slightly
confusing. This commit removes that, and instead lets the Upstairs tell
consumers if it is active or not.

Additionally, getting the length of a Buffer shouldn't take a lock.
Make `len()` and `is_empty()` synchronous by storing the length (it
shouldn't change!).

Closes oxidecomputer#461
@jmpesp jmpesp requested a review from leftwo October 4, 2022 20:17
Copy link
Contributor

@leftwo leftwo left a comment

Choose a reason for hiding this comment

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

Do we have a test that verifies work is refused if the upstairs is not active?
It's very important that a not active upstairs do any work at all, and knowing that we had done some sanity here might prevent us debugging pain in the future.

upstairs/src/lib.rs Outdated Show resolved Hide resolved
upstairs/src/lib.rs Show resolved Hide resolved
@leftwo
Copy link
Contributor

leftwo commented Oct 5, 2022

Looks good, :shipit:

@jmpesp jmpesp merged commit 22ffcda into oxidecomputer:main Oct 5, 2022
@jmpesp jmpesp deleted the remove_guest_active_and_buffer_len_lock branch October 5, 2022 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does Guest need the active field?
2 participants