Use more optimised XSAVE for x86 kernel
@dreamliner787-9 is already working on this.
Since Jul 23, 2026.
Assessment
This issue has not been assessed yet.
Description
In similar spirit to https://github.com/seL4/microkit/issues/503.
Currently the Microkit build seL4 with just the base XSAVE instruction for context switching in the kernel. We should use the more optimised XSAVEC, XSAVEOPT, or XSAVES variants for better context switching performance.
The wrinkle with this is that it will raise the baseline CPU requirements of the Microkit and thus will be a breaking change. I don't think this will be a big problem for hardware deployments as I tested XSAVEOPT on the older x86 machines we have (Skylake and Haswell) and they supported it. But for VM deployments it might be an issue.
From the kernel's config.cmake on the differences between the variants:
config_choice(
KernelXSave
KERNEL_XSAVE
"The XSAVE area supports multiple instructions to save
and restore to it. These instructions are dependent upon specific CPU support. See Chapter 13 of Volume \
1 of the Intel Architectures SOftware Developers Manual for discussion on the init and modified \
optimizations. \
XSAVE -> Original XSAVE instruction. This is the only XSAVE instruction that is guaranteed to exist if \
XSAVE is present \
XSAVEC -> Save state with compaction. This compaction has to do with minimizing the total size of \
XSAVE buffer, if using non contiguous features, XSAVEC will attempt to use the init optimization \
when saving \
XSAVEOPT -> Save state taking advantage of both the init optimization and modified optimization \
XSAVES -> Save state taking advantage of all optimizations. This instruction is only \
available in OS code, and is the preferred save method if it exists."
"XSAVE;KernelXSaveXSave;XSAVE_XSAVE;KernelFPUXSave"
"XSAVES;KernelXSaveXSaveS;XSAVE_XSAVES;KernelFPUXSave"
"XSAVEOPT;KernelXSaveXSaveOpt;XSAVE_XSAVEOPT;KernelFPUXSave"
"XSAVEC;KernelXSaveXSaveC;XSAVE_XSAVEC;KernelFPUXSave")
- Dominant language
- Rust
- Stars
- 201
- Forks
- 80
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from seL4/microkit
-
Difficulty 2/5 Half a day Newbie friendliness 72/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100