From 8b199f702eb2d4ab49c6313549893e53f32738a8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 22 Jul 2020 16:19:08 -0400 Subject: [PATCH] chore: remove extra consistency check --- runtime/include/arch/common.h | 2 -- runtime/include/arch/x86_64/context.h | 1 - runtime/include/sandbox.h | 3 --- runtime/src/local_runqueue_minheap.c | 2 -- runtime/src/sandbox.c | 1 - runtime/src/software_interrupt.c | 4 ---- runtime/src/worker_thread.c | 9 --------- 7 files changed, 22 deletions(-) diff --git a/runtime/include/arch/common.h b/runtime/include/arch/common.h index b3f0d6c..124efa5 100644 --- a/runtime/include/arch/common.h +++ b/runtime/include/arch/common.h @@ -68,5 +68,3 @@ extern __thread struct arch_context worker_thread_base_context; /* Cannot be inlined because called in assembly */ void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void); - -extern __thread volatile bool worker_thread_is_switching_context; diff --git a/runtime/include/arch/x86_64/context.h b/runtime/include/arch/x86_64/context.h index e3c127b..2c52b51 100644 --- a/runtime/include/arch/x86_64/context.h +++ b/runtime/include/arch/x86_64/context.h @@ -175,6 +175,5 @@ arch_context_switch(struct arch_context *a, struct arch_context *b) "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"); - worker_thread_is_switching_context = false; return 0; } diff --git a/runtime/include/sandbox.h b/runtime/include/sandbox.h index dacb002..e102174 100644 --- a/runtime/include/sandbox.h +++ b/runtime/include/sandbox.h @@ -80,9 +80,6 @@ struct sandbox { * Externs * **************************/ - -extern __thread volatile bool worker_thread_is_switching_context; - extern void worker_thread_block_current_sandbox(void); extern void worker_thread_on_sandbox_exit(struct sandbox *sandbox); extern void worker_thread_process_io(void); diff --git a/runtime/src/local_runqueue_minheap.c b/runtime/src/local_runqueue_minheap.c index d2850af..ec11f64 100644 --- a/runtime/src/local_runqueue_minheap.c +++ b/runtime/src/local_runqueue_minheap.c @@ -160,8 +160,6 @@ local_runqueue_minheap_preempt(ucontext_t *user_context) next_sandbox->state = SANDBOX_RUNNABLE; local_runqueue_add(next_sandbox); - worker_thread_is_switching_context = true; - /* Save the context of the currently executing sandbox before switching from it */ arch_mcontext_save(¤t_sandbox->ctxt, &user_context->uc_mcontext); diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index dd5d41d..b166448 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -251,7 +251,6 @@ current_sandbox_main(void) assert(!software_interrupt_is_enabled()); arch_context_init(&sandbox->ctxt, 0, 0); - worker_thread_is_switching_context = false; software_interrupt_enable(); sandbox_initialize_io_handles_and_file_descriptors(sandbox); diff --git a/runtime/src/software_interrupt.c b/runtime/src/software_interrupt.c index 955ce6b..a8abf80 100644 --- a/runtime/src/software_interrupt.c +++ b/runtime/src/software_interrupt.c @@ -86,9 +86,6 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void /* NOOP if software interrupts not enabled */ if (!software_interrupt_is_enabled()) return; - /* Do not allow more than one layer of preemption */ - if (worker_thread_is_switching_context) return; - /* * if a SIGALRM fires while the worker thread is between sandboxes, executing libuv, completion queue * cleanup, etc. current_sandbox might be NULL. In this case, we should just allow return to allow the @@ -131,7 +128,6 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void arch_mcontext_restore(&user_context->uc_mcontext, ¤t_sandbox->ctxt); - worker_thread_is_switching_context = false; software_interrupt_enable(); return; diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index 0381fea..e61ee5b 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -29,9 +29,6 @@ __thread uv_loop_t worker_thread_uvio_handle; /* Flag to signify if the thread is currently running callbacks in the libuv event loop */ static __thread bool worker_thread_is_in_libuv_event_loop = false; -/* Flag to signify if the thread is currently undergoing a context switch */ -__thread volatile bool worker_thread_is_switching_context = false; - /*********************** * Worker Thread Logic * **********************/ @@ -51,8 +48,6 @@ worker_thread_switch_to_sandbox(struct sandbox *next_sandbox) assert(next_sandbox != NULL); struct arch_context *next_context = &next_sandbox->ctxt; - worker_thread_is_switching_context = true; - /* Get the old sandbox we're switching from */ struct sandbox *current_sandbox = current_sandbox_get(); @@ -92,8 +87,6 @@ static inline void worker_thread_switch_to_base_context() { assert(!software_interrupt_is_enabled()); - assert(worker_thread_is_switching_context == false); - worker_thread_is_switching_context = true; struct sandbox *current_sandbox = current_sandbox_get(); @@ -110,7 +103,6 @@ worker_thread_switch_to_base_context() arch_context_switch(¤t_sandbox->ctxt, &worker_thread_base_context); software_interrupt_enable(); - worker_thread_is_switching_context = false; } /** @@ -222,7 +214,6 @@ worker_thread_main(void *return_code) /* Initialize Flags */ software_interrupt_is_disabled = false; worker_thread_is_in_libuv_event_loop = false; - worker_thread_is_switching_context = false; /* Unmask signals */ #ifndef PREEMPT_DISABLE