From bbfc9ffcd1270e3ecaa4f7ac5848de0c40e1fa9e Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 17 Apr 2025 15:40:57 +0200 Subject: [PATCH] Fixed bugs in CIP and TIP implementations. --- .../include/tukija/syscall-generic.h | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/repos/base-tukija/include/tukija/syscall-generic.h b/repos/base-tukija/include/tukija/syscall-generic.h index 004dd3d109..e35f67a5c9 100644 --- a/repos/base-tukija/include/tukija/syscall-generic.h +++ b/repos/base-tukija/include/tukija/syscall-generic.h @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -162,7 +163,7 @@ namespace Tukija { inline void clear() { for (unsigned i = 0; i < sizeof(raw) / sizeof(raw[0]); i++) - Atomic::clr_mask(value(i * CPUS_PER_VALUE),0UL); + Atomic::store(raw[i], 0UL); } template @@ -188,6 +189,14 @@ namespace Tukija { } return count; } + + void print(Genode::Output &out) { + Genode::print(out, "<"); + for (unsigned i = 0; i < sizeof(raw) / sizeof(raw[0]); i++) { + Genode::print(out, raw[i]); + } + Genode::print(out, ">"); + } }; /** @@ -208,7 +217,7 @@ namespace Tukija { * that the cell polls this flag regularly in user-space, e.g. after the execution of an MxTask. */ struct Worker { - volatile unsigned long yield_flag{0}; /* This flag will be set if a yield request has been filed */ + unsigned long yield_flag{0}; /* This flag will be set if a yield request has been filed */ unsigned long padding[3]; }; @@ -231,11 +240,13 @@ namespace Tukija { alignas(64) Worker worker_info[256]; Channels channel_info; + Spinlock lock{}; + /** * @brief Contains the set of CPU cores that are currently allocated by this cell. - * + * */ - Cpuset cores_current; + alignas(64) Cpuset cores_current; /** * @brief Contains the set of CPU cores this cell may lay claims to. @@ -253,6 +264,8 @@ namespace Tukija { */ Cpuset cores_new; + Cpuset cores_reclaimed; + unsigned idx_to_phys_cpu_id[256]; /* Mapping from pager index to kernel cpu ID */ Genode::Affinity::Space habitat_affinity; /* the affinity space the corresponding cell lives in */ @@ -730,7 +743,7 @@ namespace Tukija { /** * Pd operations */ - enum Pd_op { TRANSFER_QUOTA = 0U, PD_DEBUG = 2U }; + enum Pd_op { TRANSFER_QUOTA = 0U, PD_DEBUG = 2U, PD_DEL = 4U }; /** * Hpc operations @@ -1325,9 +1338,10 @@ namespace Genode { } static inline void print(Output &out, Tukija::Cpuset &cpus) { - print(out, "[ "); + print(out, "["); cpus.for_each([&](long cpu) - { print(out, cpu, ", "); }); + { print(out, cpu, ","); }); + cpus.print(out); print(out, "]"); }