mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-14 06:24:14 +00:00
scheduling: Create a secondary sandbox scheduling domain
This updates the kernel configs to setup two domains instead of one, and also defines a bare-bones domain scheduler that simply round- robins through the domains. Bug: 238811077 Change-Id: Ibb49f10265c38dc26235fc246f6147b306055bcb GitOrigin-RevId: 6b17211d8866bec9207f78dc61c4840c6da9537d
This commit is contained in:
parent
ce1543c466
commit
be8c32c874
@ -18,6 +18,7 @@ use kata_memory_interface::ObjDesc;
|
||||
use kata_memory_interface::ObjDescBundle;
|
||||
use kata_os_common::copyregion::CopyRegion;
|
||||
use kata_os_common::cspace_slot::CSpaceSlot;
|
||||
use kata_os_common::scheduling::Domain;
|
||||
use kata_os_common::sel4_sys;
|
||||
use kata_proc_interface::Bundle;
|
||||
use kata_proc_interface::BundleImage;
|
||||
@ -174,7 +175,7 @@ pub struct seL4BundleImpl {
|
||||
cap_tcb: CSpaceSlot,
|
||||
|
||||
affinity: seL4_Word, // CPU affinity
|
||||
domain: seL4_Word, // Scheduling domain
|
||||
domain: Domain, // Scheduling domain
|
||||
|
||||
tcb_name: String,
|
||||
tcb_max_priority: seL4_Word,
|
||||
@ -292,7 +293,7 @@ impl seL4BundleImpl {
|
||||
first_page: first_vaddr / PAGE_SIZE,
|
||||
|
||||
affinity: 0, // CPU 0
|
||||
domain: 0, // XXX share scheduling domain with system services for now
|
||||
domain: Domain::AppSandbox,
|
||||
|
||||
tcb_name: bundle.app_id.clone(),
|
||||
tcb_max_priority: 254, // TODO(sleffler): guess
|
||||
|
@ -16,5 +16,6 @@ cspace-slot = { path = "src/cspace-slot" }
|
||||
logger = { path = "src/logger" }
|
||||
model = { path = "src/model" }
|
||||
panic = { path = "src/panic" }
|
||||
scheduling = { path = "src/scheduling" }
|
||||
sel4-sys = { path = "src/sel4-sys" }
|
||||
slot-allocator = { path = "src/slot-allocator" }
|
||||
|
@ -11,5 +11,6 @@ pub extern crate cspace_slot;
|
||||
pub extern crate logger;
|
||||
pub extern crate model;
|
||||
pub extern crate panic;
|
||||
pub extern crate scheduling;
|
||||
pub extern crate sel4_sys;
|
||||
pub extern crate slot_allocator;
|
||||
|
@ -0,0 +1,3 @@
|
||||
[package]
|
||||
name = "scheduling"
|
||||
version = "0.1.0"
|
@ -0,0 +1,14 @@
|
||||
//! Kata OS seL4 scheduling primitives
|
||||
|
||||
#![no_std]
|
||||
|
||||
/// Scheduling domains configured for seL4 TCBs.
|
||||
///
|
||||
/// Currently we have this setup as a pair of domains, one for the system
|
||||
/// components and another for the third party application sandbox.
|
||||
///
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
||||
pub enum Domain {
|
||||
System = 0,
|
||||
AppSandbox,
|
||||
}
|
@ -13,3 +13,6 @@ set(LibUtilsDefaultZfLogLevel 5 CACHE STRING "seL4 internal logging level (0-5).
|
||||
set(SIMULATION ON CACHE BOOL "Whether to build simulate script")
|
||||
set(RELEASE OFF CACHE BOOL "Performance optimized build")
|
||||
set(UseRiscVBBL OFF CACHE BOOL "Whether to use bbl")
|
||||
|
||||
set(KernelNumDomains 2 CACHE STRING "How many scheduling domains to build for")
|
||||
set(KernelDomainSchedule "${CMAKE_CURRENT_LIST_DIR}/kernel/round_robin_domain.c" CACHE INTERNAL "Domain scheduler algorithm")
|
||||
|
22
kernel/round_robin_domain.c
Normal file
22
kernel/round_robin_domain.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <model/statedata.h>
|
||||
#include <object/structures.h>
|
||||
|
||||
/* Dual-domain schedule for Kata to isolate third party applications from system
|
||||
* applications.
|
||||
*
|
||||
* Note that this doesn't actually implement the schedule -- that's hardwired in
|
||||
* seL4's kernel source. See also kata/kernel/src/kernel/thread.c, in the
|
||||
* nextDomain function around line 302 and the timerTick function around 630.
|
||||
*
|
||||
* Effectively this is a round-robin scheduler, so half of the CPU time is given
|
||||
* to system applications, while third party applications are allocated the
|
||||
* other half. Note that even if there's nothing to run in the third-party
|
||||
* application domain, the scheduler will schedule an idle thread to ensure that
|
||||
* domain gets it's allocated share of time.
|
||||
*/
|
||||
const dschedule_t ksDomSchedule[] = {
|
||||
{.domain = 0, .length = 1}, // System domain
|
||||
{.domain = 1, .length = 1}, // Third party application domain
|
||||
};
|
||||
|
||||
const word_t ksDomScheduleLength = sizeof(ksDomSchedule) / sizeof(dschedule_t);
|
Loading…
Reference in New Issue
Block a user