Repository navigation
Add fixed time partitions to the scheduler - #11
Merged
Merged
Conversation
- Domains run in windows of whole ticks from a table that the `PartCtl` capability sets - The new crate `k0-part` holds the pure core and the clock arithmetic - A tick that changes the domain is taken early and the kernel holds until the tick instant - Bootinfo is version 5 and the root CNode has 1024 slots in every image - The root task tests refusals and one round of windows at boot and then seals the table Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
- Five files under `proofs/lean` prove properties of an abstract model and not of the Rust code - `ModelVectors.lean` writes the recorded scripts that the host test of `k0-part` compares with Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or 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
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.
What and why
Adds fixed time partitions. Until now one task could change when another task ran through the scheduler, which is a channel between tasks that should not be able to signal each other. With a partition table, a domain runs only in its own windows, and what the other domains do does not change which of its tasks run or in which order.
k0-part: the pure core (Core) and the clock arithmetic.k0-schedis the glue around it. Each domain has its own ready queue and its own list of timed waiters. A timeout is served only when its domain runs, so it can fire late and never early.k0_leave).PartCtl(kind 9, boot slot 5) cannot be copied.PART_SET_TABLE(17) andPART_SET_DOMAIN(18) need it. Deleting it seals the table and the domains until the next boot.root-cnode-1024is gone). Images built for the previousmainare not compatible.PartCtl. So every image built today runs sealed with one domain. No image uses more than one domain yet.proofs/leanholds Lean 4 proofs about an abstract model of the scheduler. They are not proofs about the Rust code and are not run in CI. A host test ties the two together: it runs 1600 recorded scripts through the RustCoreand compares each with the model's result.The claim is narrow: fixed time partitions close the channel between domains that goes through the scheduler.
design/en/scheduling.mdandSECURITY.mdstate it with its limits.How it was tested
tools/host-test.shtools/qemu-boot-test.shDetails:
k0-mm), also from agit archiveexport of the branch.k0-parthas 36: property tests of the realCore(two runs with different workloads in the other domains give a domain the same trace, window bounds, no donated slack, the default table against a frozen copy of the old scheduler), clock arithmetic, and the recorded scripts of the Lean model.tools/boot-matrix.shpass locally (Apple M5 Pro, QEMU 11.1.3,K0_MATRIX_HVF=1), with no retry of the window test.tools/qemu-boot-test.shruns as the judge of its pass rows.lake buildhas no error and no warning,leancheckeraccepts the five modules,lake exe vectors --checkfinds no difference in the 1600 scripts, and an external type checker (nanoda) accepts all 60911 exported declarations.Not covered:
tools/boot-matrix.shruns a row again when its window test retried. The matrix had no retry, so that second run was never taken, and the WFI and WFE trap path was not exercised.k0-sched,k0-ipcand the kernel glue still have no host tests.Security notes
// SAFETY:comment. The largest part is the rewritten scheduler glue.PartCtl) and the timer interrupt path.PartCtl. A task without it can change neither.k0-partdepends onk0-slice.CAP_REVOKE, large deletes).ci/threat_model.mdand one sentence on which reports are welcome toSECURITY.md.AI assistance
The design, the code, the tests, the proofs, the tools and the documents in this pull request were made with Claude (Anthropic). Claude agents reviewed the design, the code and the proofs, and wrote the documents, and their confirmed findings were fixed. The scope and the design decisions were chosen by the maintainer. The results under "How it was tested" are from real runs on the machine named there.
Contributor License Agreement
CLA signaturescheck shows who still needs to sign.