Skip to content

Consolidate worker threads #317

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

Merged
merged 4 commits into from
May 6, 2025
Merged

Conversation

jakecorrenti
Copy link
Member

Whenever the vCPU needs to access resources the Vm or Vmm has control over, we end up spawning a worker thread to complete the task. Rather than spawning a new worker thread for each task, use a single thread, but make the message that's passed generic to allow for multiple use cases.

@tylerfanelli
Copy link
Member

The SEV-SNP update also has a worker thread. Can we merge that first and rebase on top?

@jakecorrenti
Copy link
Member Author

The SEV-SNP update also has a worker thread. Can we merge that first and rebase on top?

Sure. I figured I'd at least post the changes and let people review if they want

@tylerfanelli
Copy link
Member

Sure, that works. Can you mark as draft to note that its waiting on another PR?

@jakecorrenti jakecorrenti marked this pull request as draft April 17, 2025 14:40
@MatiasVara
Copy link
Collaborator

I think this mechanism can also be used for arm-cca. There is also a worker although the mechanism has not been generalized as here.

@jakecorrenti jakecorrenti force-pushed the worker-thread branch 6 times, most recently from ab523d2 to edcf800 Compare May 1, 2025 16:18
@jakecorrenti jakecorrenti marked this pull request as ready for review May 1, 2025 16:18
@jakecorrenti
Copy link
Member Author

Disclaimer: I can't test these changes on a SEV machine to verify the TEE code works

@tylerfanelli
Copy link
Member

tylerfanelli commented May 2, 2025

Tested on SEV-SNP. LGTM! Can you rebase on main? I can then approve.

Rather than spawning a new worker thread every time some functionality
needs it, which results in it's own Message type, create something
generic that can be used in one thread.

Signed-off-by: Jake Correnti <[email protected]>
Rather than creating the worker thread on macOS differently than we do
for the other x86 tasks, use the same associative function by taking
    advnatage of the generic `WorkerMessage` enum.

Signed-off-by: Jake Correnti <[email protected]>
On x86, use the same sender as we would for macOS. Additionally, rather
than using an EventFd to determine when the thread work is done, use a
response sender/receiver like macOS.

Signed-off-by: Jake Correnti <[email protected]>
For TEE VMs, use the same sender as we would for macOS or an x86 VM with
a split IRQCHIP. ADditionally, use a channel for inter-process
communication instead of an EventFd.

Signed-off-by: Jake Correnti <[email protected]>
@jakecorrenti
Copy link
Member Author

Tested on SEV-SNP. LGTM! Can you rebase on main? I can then approve.

Done!

@jakecorrenti
Copy link
Member Author

@MatiasVara PTAL. I made some modifications to the worker thread for TEEs

@jakecorrenti jakecorrenti merged commit 9041aaa into containers:main May 6, 2025
6 checks passed
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.

3 participants