-
Notifications
You must be signed in to change notification settings - Fork 77
Domain schedules #445
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
Open
Kswin01
wants to merge
8
commits into
seL4:main
Choose a base branch
from
au-ts:run_time_domains
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Domain schedules #445
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3631766
tool: rename domain_ids -> iommu_domain_ids
midnightveil 72e1ab1
domains: enable on non-smp configs by default
midnightveil d27e038
domains: gather relevant kernel constants
midnightveil 129d60c
domains: support defining a domain schedule
midnightveil 069b6e4
domains: support specifying domains for each PD
midnightveil e8c65e3
domains: add basic example
midnightveil d452725
domains: add tests for errors cases
midnightveil 54c9476
domains: document the feature in the manual
midnightveil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # | ||
| # Copyright 2026, UNSW | ||
| # | ||
| # SPDX-License-Identifier: BSD-2-Clause | ||
| # | ||
|
|
||
| BUILD_DIR ?= build | ||
|
|
||
| ifeq ($(strip $(MICROKIT_SDK)),) | ||
| $(error MICROKIT_SDK must be specified) | ||
| endif | ||
|
|
||
| ifeq ($(strip $(MICROKIT_BOARD)),) | ||
| $(error MICROKIT_BOARD must be specified) | ||
| endif | ||
|
|
||
| ifeq ($(strip $(MICROKIT_CONFIG)),) | ||
| $(error MICROKIT_CONFIG must be specified) | ||
| endif | ||
|
|
||
| BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG) | ||
|
|
||
| ARCH := ${shell grep 'CONFIG_SEL4_ARCH ' $(BOARD_DIR)/include/kernel/gen_config.h | cut -d' ' -f4} | ||
|
|
||
| ifeq ($(ARCH),aarch64) | ||
| TARGET_TRIPLE := aarch64-none-elf | ||
| CFLAGS_ARCH := -mstrict-align | ||
| else ifeq ($(ARCH),riscv64) | ||
| TARGET_TRIPLE := riscv64-unknown-elf | ||
| CFLAGS_ARCH := -march=rv64imafdc_zicsr_zifencei -mabi=lp64d | ||
| else ifeq ($(ARCH),x86_64) | ||
| TARGET_TRIPLE := x86_64-linux-gnu | ||
| CFLAGS_ARCH := -march=x86-64 -mtune=generic | ||
| else | ||
| $(error Unsupported ARCH) | ||
| endif | ||
|
|
||
| ifeq ($(strip $(LLVM)),True) | ||
| CC := clang -target $(TARGET_TRIPLE) | ||
| AS := clang -target $(TARGET_TRIPLE) | ||
| LD := ld.lld | ||
| else | ||
| CC := $(TARGET_TRIPLE)-gcc | ||
| LD := $(TARGET_TRIPLE)-ld | ||
| AS := $(TARGET_TRIPLE)-as | ||
| endif | ||
|
|
||
| MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit | ||
|
|
||
| IMAGES := emitter.elf collector.elf | ||
| CFLAGS := -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include $(CFLAGS_ARCH) | ||
| LDFLAGS := -L$(BOARD_DIR)/lib | ||
| LIBS := -lmicrokit -Tmicrokit.ld | ||
|
|
||
| IMAGE_FILE = $(BUILD_DIR)/loader.img | ||
| REPORT_FILE = $(BUILD_DIR)/report.txt | ||
| SPEC_FILE = $(BUILD_DIR)/capdl_spec.json | ||
|
|
||
| all: $(IMAGE_FILE) | ||
|
|
||
| $(BUILD_DIR): | ||
| mkdir -p $@ | ||
|
|
||
| $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) | ||
| $(CC) -c $(CFLAGS) $< -o $@ | ||
|
|
||
| $(BUILD_DIR)/%.elf: $(BUILD_DIR)/%.o | ||
| $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ | ||
|
|
||
| $(IMAGE_FILE) $(REPORT_FILE): $(addprefix $(BUILD_DIR)/, $(IMAGES)) domains.system | ||
| $(MICROKIT_TOOL) domains.system --search-path $(BUILD_DIR) --board $(MICROKIT_BOARD) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) \ | ||
| --viper-output ${BUILD_DIR}/viper -r $(REPORT_FILE) --capdl-json $(SPEC_FILE) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <!-- | ||
| Copyright 2026, UNSW | ||
| SPDX-License-Identifier: CC-BY-SA-4.0 | ||
| --> | ||
|
|
||
| # Example - Domains | ||
|
|
||
| This is a basic example that uses the seL4 domain scheduler. | ||
|
|
||
| It is similar to the [CAmkES](https://github.com/seL4/camkes/tree/camkes-3.12.x-compatible/apps/domains) | ||
| example application 'Domains'. | ||
|
|
||
| It uses three domains: monitor (0), emitter (1), and collector (2). | ||
| Domain 0 runs the Microkit monitor. Domain 1 contains the emitter PD, and | ||
| Domain 2 the collector PD. | ||
|
|
||
| The emitter will be able to do a large number of notifies before the collector | ||
| has time to run. Because notifications are coalesced by seL4, one should not see the | ||
| 100,000 notifies that the emitter produces, but only a smaller number, once | ||
| per time the collector runs. A shorter duration for the domain 1 (emitter) | ||
| will cause domain 2 (collector) to see more events. | ||
|
|
||
| Look at the `domains.system` file for a commented example of the syntax. | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| INFO [sel4_capdl_initializer::initialize] Starting threads | ||
| MON|INFO: Microkit Monitor started! | ||
| emitter: starting to emit events... | ||
| collector: Waiting for an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| emitter: still emitting collector: Got an event | ||
| collector: Got an event | ||
| events... | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| emitter: still emitting events... | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| emitter: still emitting events... | ||
| ... | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| collector: Got an event | ||
| emitter: still emitting events... | ||
| emitter: done emitting events | ||
| collector: Got an event | ||
| collector: Got an event | ||
| ``` | ||
|
|
||
| ## Building | ||
|
|
||
| ```sh | ||
| make MICROKIT_BOARD=<board> MICROKIT_CONFIG=debug MICROKIT_SDK=/path/to/sdk | ||
| ``` | ||
|
|
||
| ## Running | ||
|
|
||
| See instructions for your board in the manual. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright 2026, UNSW | ||
| * | ||
| * SPDX-License-Identifier: BSD-2-Clause | ||
| */ | ||
| #include <stdint.h> | ||
| #include <microkit.h> | ||
|
|
||
| void init(void) | ||
| { | ||
| microkit_dbg_puts("collector: Waiting for an event\n"); | ||
| } | ||
|
|
||
| void notified(microkit_channel ch) | ||
| { | ||
| microkit_dbg_puts("collector: Got an event\n"); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Copyright 2026, UNSW | ||
|
|
||
| SPDX-License-Identifier: BSD-2-Clause | ||
| --> | ||
| <system> | ||
| <!-- This element is used to declare the list of domains, to give | ||
| each domain a human-readable name. --> | ||
| <domains> | ||
| <!-- The first domain contains the Microkit Monitor PD, but can contain others. --> | ||
| <domain name="monitor" id="0" /> | ||
| <!-- You give each domain a name and its domain id. --> | ||
| <domain name="emitter" id="1" /> | ||
| <!-- The domain ID is optional and can be auto-assigned if desired. | ||
| It will be assigned to the smallest unused ID, and must be less | ||
| than KernelNumDomains. --> | ||
| <domain name="collector" /> | ||
|
|
||
| <!-- This is a domain schedule. Note that the same domain can appear twice | ||
| in the schedule. | ||
| Also supports optional attributes "start_index" and "index_shift". | ||
| --> | ||
| <domain_schedule> | ||
| <schedule_entry domain="monitor" duration="6000 us" /> | ||
| <schedule_entry domain="emitter" duration="8000 us" /> | ||
| <schedule_entry domain="collector" duration="2000 us" /> | ||
| <!-- This element is optional, and is implicitly there anyway. --> | ||
| <schedule_end_marker /> | ||
| </domain_schedule> | ||
| </domains> | ||
|
|
||
| <protection_domain name="emitter" domain="emitter"> | ||
| <program_image path="emitter.elf" /> | ||
| </protection_domain> | ||
|
|
||
| <protection_domain name="collector" domain="collector"> | ||
| <program_image path="collector.elf" /> | ||
| </protection_domain> | ||
|
|
||
| <channel> | ||
| <end pd="emitter" id="0" /> | ||
| <end pd="collector" id="0" notify="false" /> | ||
| </channel> | ||
| </system> |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.