-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add support for defining tasks and switching between task contexts #61
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The current X86Regs structure is only used by exception handlers and interrupt routines and as such contains the interrupt routine stack frame within the structure. This change separates that out to break registers and other context into their respective categories to allow the structures to be reused in other situations. Signed-off-by: Roy Hopkins <rhopkins@suse.de>
The svsm_paging module is currently used only in svsm.rs. This change allows the code to be used in other areas of svsm. Signed-off-by: Roy Hopkins <rhopkins@suse.de>
00xc
reviewed
Jul 10, 2023
Here's an example of how the code in this PR can be used to launch and switch between tasks.
|
Signed-off-by: Roy Hopkins <rhopkins@suse.de>
Extends the pagetable code to add support for creating tasks that can be context-switched on a vCPU. This change adds the ability to copy an existing pagetable and also adds helper functions that define the flags to use for task specific pagetable entries. Signed-off-by: Roy Hopkins <rhopkins@suse.de>
joergroedel
reviewed
Jul 12, 2023
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.
I think this looks good and is a step in the right direction. Added one minor comment to the task switching assembly.
This adds basic support for creating tasks which equate to processes or threads that can be executed on a vCPU. Each task is represented by a structure that contains the relevant context, which at the moment includes a task stack, pagetable, stack pointer. Tasks can be created with Task::create() providing an entry point address. The task context is activated with Task::set_current(). The task context remains in scope until it calls Task::set_current() itself with a new context. This patch adds all the infrastructure to support task switching but does not yet integrate task creation or switching into the SVSM kernel. This is in anticipation of a scheduler being introduced. Signed-off-by: Roy Hopkins <rhopkins@suse.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR represents a step in implementing support for CPL3 and isolating tasks that run within the context of the coconut SVSM kernel. It adds a new structure:
Task
which allows a task context to be initialised and maintained that can be swapped in and out of execution on a vCPU.This PR does not introduce any form of scheduling of the tasks. In fact, the task code is not currently used at all within the SVSM kernel. However, the code as it stands can be used to launch an entry point that maintains its own page table (with shared access to kernel memory) in CPL0 using a per-task stack.