Skip to content
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

Scheduling enclaves #242

Merged
merged 63 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
288dacd
Some major RTI refactoring
erlingrj Jun 10, 2023
7472112
Also port the authenticated rti
erlingrj Jun 10, 2023
86e73f7
Reorder some code sections to make the diff smaller
erlingrj Jun 10, 2023
dbf04f8
Move NET function to rti_local and the cond_var from reactor_node to …
erlingrj Jun 10, 2023
db43420
Put rti_mutex on the rti_common struct
erlingrj Jun 10, 2023
b474dcf
More cleanup
erlingrj Jun 10, 2023
600f634
Merge in rti-refactor2
erlingrj Jun 10, 2023
52dedec
Also compile rti_local
erlingrj Jun 10, 2023
fd7f4be
Fix typos from the merge
erlingrj Jun 10, 2023
ccaf55c
MVP of simple coordination
erlingrj Jun 11, 2023
a5da195
Move to new version of code-generated enclave topology
erlingrj Jun 13, 2023
5e8e6ae
Merge branch 'main' into enclaves2
erlingrj Jun 15, 2023
f0ba7ef
Renaming and removing some typos
erlingrj Jun 16, 2023
3bcce55
Add update_other_net to the RTI API
erlingrj Jun 24, 2023
98f3086
Protect enclaved API behind IFDEFS
erlingrj Jun 26, 2023
e299a39
Update lf pointer
erlingrj Jun 26, 2023
407dc1d
Merge remote-tracking branch 'origin/main' into enclaves2
erlingrj Jun 26, 2023
4787cfb
Update env struct
erlingrj Jun 26, 2023
f8544aa
Fix merge with main
erlingrj Jun 26, 2023
6e921a5
Remove dependency on network stuff in rti_common
erlingrj Jun 26, 2023
cdfb3c7
Add net_util.h inclusion to rti_remote
erlingrj Jun 26, 2023
d5de67a
Various fixes
erlingrj Jun 27, 2023
ea1573b
Update RTI for enclaved tracing
erlingrj Jun 27, 2023
5c08aeb
Support tracing of enclaves
erlingrj Jun 28, 2023
62f12ac
Use flags to conditionally include/exlcude RTI files. This is done to…
erlingrj Jun 29, 2023
4bc56c7
Remove hard-coded keepalive of enclaves which enable shutdown through…
erlingrj Jun 29, 2023
0a8b953
Fix typos in RTI
erlingrj Jun 29, 2023
0c4b55c
Fix include error in scheduler_adaptive.c
erlingrj Jun 29, 2023
00e4bf0
Fix thread sync at startup
erlingrj Jun 29, 2023
9c28c34
Improve initialization of thread sync primitives in RTI
erlingrj Jun 29, 2023
668c853
Merge remote-tracking branch 'origin/main' into enclaves2
erlingrj Jun 29, 2023
7916c9e
Fix start tag
erlingrj Jun 30, 2023
c106a46
Adding some #ifdefs
erlingrj Jun 30, 2023
9c4150e
Merge in changes from recent lf_request_stop branch
erlingrj Jun 30, 2023
0f2a936
Minor fixes
erlingrj Jun 30, 2023
a6c06d5
Fix bug in starvation termination
erlingrj Jul 7, 2023
ce17cf6
Fix bug in starvation termination
erlingrj Jul 7, 2023
3a6f518
Make FOREVER+x=FOREVER for all x
erlingrj Jul 11, 2023
7237f92
Merge branch 'enclaves2' of https://github.com/lf-lang/reactor-c into…
erlingrj Jul 11, 2023
1388217
Rename reactor_node -> scheduling_node in RTI
erlingrj Jul 12, 2023
9ed4d8c
reactor_nodes -> scheduling_nodes
erlingrj Jul 12, 2023
0a8bd93
More reactor_node -> scheduling_node
erlingrj Jul 12, 2023
4d9266b
federate -> scheduling_node in comments
erlingrj Jul 12, 2023
bac46e4
Better docs of the local RTI
erlingrj Jul 12, 2023
3cb0c24
Fix comments and docs
erlingrj Jul 12, 2023
804f25a
Merge branch 'main' of https://github.com/lf-lang/reactor-c into encl…
erlingrj Jul 13, 2023
b322e0b
Fix mistake in TAGs when no upstream
erlingrj Jul 13, 2023
12e4e5a
Docs
erlingrj Jul 13, 2023
0398501
Revisit start tag synchronization for enclaves.
erlingrj Jul 13, 2023
75ce55a
Merge branch 'main' into e-merge
erlingrj Sep 22, 2023
7767b6c
Merge in main and resolve conflict
edwardalee Oct 28, 2023
4f8c80c
Apply suggestions from code review
erlingrj Oct 29, 2023
91b3f49
Merge with main
edwardalee Nov 5, 2023
bb2784d
Merge main into enclave2
edwardalee Nov 8, 2023
a966e2d
Fixed intialize_RTI declaration
edwardalee Nov 8, 2023
25a10ad
Comments only (terminology: scheduling nodes)
edwardalee Nov 10, 2023
257a009
Update lf-ref to point to lingua-franca/enclaves4
erlingrj Nov 10, 2023
198d3c1
Apply suggestions from code review
erlingrj Nov 10, 2023
f1c43da
RTI: Remove the PROLOGUE/EPILOGUE macros for locking
erlingrj Nov 11, 2023
16b67a9
Create an optional macro LF_ASSERT
erlingrj Nov 11, 2023
3c895ae
RTI: Update docs of locking in the local RTI
erlingrj Nov 11, 2023
e4e0f07
RTI: Update docs to distinguish RTI mutex and environment mutex
erlingrj Nov 11, 2023
390667b
Update docs
erlingrj Nov 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ tracing=${LF_TRACE}.")
include(threaded/CMakeLists.txt)
endif()

# Add sources for the local RTI if we are using scheduling enclaves
if(DEFINED LF_ENCLAVES)
include(federated/RTI/local_rti.cmake)
endif()

# Include sources from subdirectories
include(utils/CMakeLists.txt)
Expand All @@ -50,6 +54,7 @@ target_include_directories(core PUBLIC ../include/core/platform)
target_include_directories(core PUBLIC ../include/core/modal_models)
target_include_directories(core PUBLIC ../include/core/threaded)
target_include_directories(core PUBLIC ../include/core/utils)
target_include_directories(core PUBLIC federated/RTI/)

if (APPLE)
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
Expand Down Expand Up @@ -123,3 +128,6 @@ define(SCHEDULER)
define(LF_SOURCE_DIRECTORY)
define(LF_PACKAGE_DIRECTORY)
define(LF_FILE_SEPARATOR)
define(WORKERS_NEEDED_FOR_FEDERATE)
define(LF_ENCLAVES)
define(LF_NOASSERT)
28 changes: 17 additions & 11 deletions core/environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void environment_init_threaded(environment_t* env, int num_workers) {
#if !defined(LF_SINGLE_THREADED)
env->num_workers = num_workers;
env->thread_ids = (lf_thread_t*)calloc(num_workers, sizeof(lf_thread_t));
lf_assert(env->thread_ids != NULL, "Out of memory");
LF_ASSERT(env->thread_ids, "Out of memory");
env->barrier.requestors = 0;
env->barrier.horizon = FOREVER_TAG;

Expand Down Expand Up @@ -84,14 +84,14 @@ static void environment_init_modes(environment_t* env, int num_modes, int num_st
#ifdef MODAL_REACTORS
if (num_modes > 0) {
mode_environment_t* modes = (mode_environment_t *) calloc(1, sizeof(mode_environment_t));
lf_assert(modes != NULL, "Out of memory");
LF_ASSERT(modes, "Out of memory");
modes->modal_reactor_states = (reactor_mode_state_t**) calloc(num_modes, sizeof(reactor_mode_state_t*));
lf_assert(modes->modal_reactor_states != NULL, "Out of memory");
LF_ASSERT(modes->modal_reactor_states, "Out of memory");
modes->modal_reactor_states_size = num_modes;
modes->triggered_reactions_request = 0;

modes->state_resets = (mode_state_variable_reset_data_t *) calloc(num_state_resets, sizeof(mode_state_variable_reset_data_t));
lf_assert(modes->state_resets != NULL, "Out of memory");
LF_ASSERT(modes->state_resets, "Out of memory");
modes->state_resets_size = num_state_resets;

env->modes = modes;
Expand All @@ -108,7 +108,7 @@ static void environment_init_modes(environment_t* env, int num_modes, int num_st
static void environment_init_federated(environment_t* env, int num_is_present_fields) {
#ifdef FEDERATED_DECENTRALIZED
env->_lf_intended_tag_fields = (tag_t**) calloc(num_is_present_fields, sizeof(tag_t*));
lf_assert(env->_lf_intended_tag_fields != NULL, "Out of memory");
LF_ASSERT(env->_lf_intended_tag_fields, "Out of memory");
env->_lf_intended_tag_fields_size = num_is_present_fields;
#endif
}
Expand Down Expand Up @@ -155,6 +155,7 @@ static void environment_free_federated(environment_t* env) {
}

void environment_free(environment_t* env) {
free(env->name);
free(env->timer_triggers);
free(env->startup_reactions);
free(env->shutdown_reactions);
Expand All @@ -175,6 +176,7 @@ void environment_free(environment_t* env) {

int environment_init(
environment_t* env,
const char *name,
int id,
int num_workers,
int num_timers,
Expand All @@ -187,33 +189,37 @@ int environment_init(
const char * trace_file_name
) {

env->name = malloc(strlen(name) + 1); // +1 for the null terminator
LF_ASSERT(env->name, "Out of memory");
strcpy(env->name, name);

env->id = id;
env->stop_tag = FOREVER_TAG;

env->timer_triggers_size=num_timers;
env->timer_triggers = (trigger_t **) calloc(num_timers, sizeof(trigger_t));
lf_assert(env->timer_triggers != NULL, "Out of memory");
LF_ASSERT(env->timer_triggers, "Out of memory");

env->startup_reactions_size=num_startup_reactions;
env->startup_reactions = (reaction_t **) calloc(num_startup_reactions, sizeof(reaction_t));
lf_assert(env->startup_reactions != NULL, "Out of memory");
LF_ASSERT(env->startup_reactions, "Out of memory");

env->shutdown_reactions_size=num_shutdown_reactions;
env->shutdown_reactions = (reaction_t **) calloc(num_shutdown_reactions, sizeof(reaction_t));
lf_assert(env->shutdown_reactions != NULL, "Out of memory");
LF_ASSERT(env->shutdown_reactions, "Out of memory");

env->reset_reactions_size=num_reset_reactions;
env->reset_reactions = (reaction_t **) calloc(num_reset_reactions, sizeof(reaction_t));
lf_assert(env->reset_reactions != NULL, "Out of memory");
LF_ASSERT(env->reset_reactions, "Out of memory");

env->is_present_fields_size = num_is_present_fields;
env->is_present_fields_abbreviated_size = 0;

env->is_present_fields = (bool**)calloc(num_is_present_fields, sizeof(bool*));
lf_assert(env->is_present_fields != NULL, "Out of memory");
LF_ASSERT(env->is_present_fields, "Out of memory");

env->is_present_fields_abbreviated = (bool**)calloc(num_is_present_fields, sizeof(bool*));
lf_assert(env->is_present_fields_abbreviated != NULL, "Out of memory");
LF_ASSERT(env->is_present_fields_abbreviated, "Out of memory");

env->_lf_handle=1;

Expand Down
10 changes: 7 additions & 3 deletions core/federated/RTI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ include_directories(${IncludeDir}/utils)
# Declare a new executable target and list all its sources
add_executable(
RTI
enclave.c
rti.c
rti_lib.c
main.c
rti_common.c
rti_remote.c
${CoreLib}/trace.c
${LF_PLATFORM_FILE}
${CoreLib}/platform/lf_unix_clock_support.c
Expand All @@ -79,8 +79,12 @@ IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
target_compile_definitions(RTI PUBLIC LOG_LEVEL=4)
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)

# Set the STANDALONE_RTI flag to include the rti_remote and rti_common.
target_compile_definitions(RTI PUBLIC STANDALONE_RTI=1)

# Set FEDERATED to get federated compilation support
target_compile_definitions(RTI PUBLIC FEDERATED=1)

target_compile_definitions(RTI PUBLIC PLATFORM_${CMAKE_SYSTEM_NAME})

# Set RTI Tracing
Expand Down
Loading
Loading