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

Update the enclave dispatcher thread to wait on a condition variable for incoming writes #6863

Open
wants to merge 15 commits into from

Conversation

eddyashton
Copy link
Member

The core loop for the main thread inside the enclave is reading and processing things off of the inbound ringbuffer. On SGX, where we didn't trust shared memory/standard library interaction between host and enclave, we'd implemented a spin-loop with some back-off/sleep heuristics.

This updates that to use std::condition_variable. Whenever the host writes something to the ringbuffer, it notifies. The dispatcher loop waits on this condition variable, so only wakes when (and quickly when) work is available.

As a safety hedge, and to make sure this dispatcher thread processes other work (ThreadMessaging) that could arrive outside of the inbound ringbuffer, add a timeout to the wait.

@eddyashton eddyashton requested a review from a team as a code owner February 27, 2025 16:44
@achamayou achamayou added the run-long-test Run Long Test job label Feb 27, 2025
@eddyashton eddyashton added this pull request to the merge queue Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-long-test Run Long Test job
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants