From c8e27dab0acdab2ab34cf7e17d21ae7a0d324174 Mon Sep 17 00:00:00 2001 From: June Tate-Gans Date: Mon, 1 Aug 2022 13:35:13 -0500 Subject: [PATCH] domains: Remove TPA sandbox domain for now At the moment, the scheduler is wasting 50% of its time in an idle thread for the application sandbox domain. Until we can figure out how to use these domains more effectively, we'll reduce to a single domain. Bug: 238811077 Change-Id: If40d01d5c94e31cc8d522dd5f906f857e363cc42 GitOrigin-RevId: 911f6fe046c61b8ce7e9ba00f8de0ec872997ec3 --- .../kata-proc-manager/src/sel4bundle/mod.rs | 4 ++-- .../kata-os-common/src/scheduling/src/lib.rs | 9 ++++++--- easy-settings.cmake | 2 +- kernel/round_robin_domain.c | 11 ++++++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs b/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs index e3f3085..d5248da 100644 --- a/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs +++ b/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs @@ -292,8 +292,8 @@ impl seL4BundleImpl { cap_tcb: CSpaceSlot::new(), // Top-level dup for suspend/resume first_page: first_vaddr / PAGE_SIZE, - affinity: 0, // CPU 0 - domain: Domain::AppSandbox, + affinity: 0, // CPU 0 + domain: Domain::System, // TODO(jtgans,sleffler): Figure out how to use this correctly. b/238811077 tcb_name: bundle.app_id.clone(), tcb_max_priority: 254, // TODO(sleffler): guess diff --git a/apps/system/components/kata-os-common/src/scheduling/src/lib.rs b/apps/system/components/kata-os-common/src/scheduling/src/lib.rs index ece2599..d8a04f2 100644 --- a/apps/system/components/kata-os-common/src/scheduling/src/lib.rs +++ b/apps/system/components/kata-os-common/src/scheduling/src/lib.rs @@ -4,11 +4,14 @@ /// 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. +/// Currently we have this setup as a single domain for all components, since we +/// don't want to waste 50% of our time waiting for a mostly idle partition. +/// +/// TODO: Figure out how to more effectively use these domains of execution, and +/// how to prevent wasting time in an idle thread for a whole domain when no +/// TCBs are scheduled there. See also b/238811077. /// #[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum Domain { System = 0, - AppSandbox, } diff --git a/easy-settings.cmake b/easy-settings.cmake index 0e160d8..780ac86 100644 --- a/easy-settings.cmake +++ b/easy-settings.cmake @@ -14,5 +14,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(KernelNumDomains 1 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") diff --git a/kernel/round_robin_domain.c b/kernel/round_robin_domain.c index a0d10a2..fdea130 100644 --- a/kernel/round_robin_domain.c +++ b/kernel/round_robin_domain.c @@ -13,10 +13,19 @@ * 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. + * + * TODO(jtgans,sleffler): Figure out how to better use these domains for + * scheduling applications. We don't really want to use a full 50% duty cycle + * for third party applications -- this wastes too much time. See also + * b/238811077. + * + * NOTE: Only a single domain is currently enabled, as per the commented section + * below. Any time the below schedule is changed, the number of domains + * configured in easy-settings.cmake must also be changed. */ const dschedule_t ksDomSchedule[] = { {.domain = 0, .length = 1}, // System domain - {.domain = 1, .length = 1}, // Third party application domain + /* {.domain = 1, .length = 1}, // Third party application domain */ }; const word_t ksDomScheduleLength = sizeof(ksDomSchedule) / sizeof(dschedule_t);