chore: remove extra consistency check

main
Sean McBride 4 years ago
parent 61fd015254
commit 8b199f702e

@ -68,5 +68,3 @@ extern __thread struct arch_context worker_thread_base_context;
/* Cannot be inlined because called in assembly */ /* Cannot be inlined because called in assembly */
void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void); void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void);
extern __thread volatile bool worker_thread_is_switching_context;

@ -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", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14",
"xmm15"); "xmm15");
worker_thread_is_switching_context = false;
return 0; return 0;
} }

@ -80,9 +80,6 @@ struct sandbox {
* Externs * * Externs *
**************************/ **************************/
extern __thread volatile bool worker_thread_is_switching_context;
extern void worker_thread_block_current_sandbox(void); extern void worker_thread_block_current_sandbox(void);
extern void worker_thread_on_sandbox_exit(struct sandbox *sandbox); extern void worker_thread_on_sandbox_exit(struct sandbox *sandbox);
extern void worker_thread_process_io(void); extern void worker_thread_process_io(void);

@ -160,8 +160,6 @@ local_runqueue_minheap_preempt(ucontext_t *user_context)
next_sandbox->state = SANDBOX_RUNNABLE; next_sandbox->state = SANDBOX_RUNNABLE;
local_runqueue_add(next_sandbox); local_runqueue_add(next_sandbox);
worker_thread_is_switching_context = true;
/* Save the context of the currently executing sandbox before switching from it */ /* Save the context of the currently executing sandbox before switching from it */
arch_mcontext_save(&current_sandbox->ctxt, &user_context->uc_mcontext); arch_mcontext_save(&current_sandbox->ctxt, &user_context->uc_mcontext);

@ -251,7 +251,6 @@ current_sandbox_main(void)
assert(!software_interrupt_is_enabled()); assert(!software_interrupt_is_enabled());
arch_context_init(&sandbox->ctxt, 0, 0); arch_context_init(&sandbox->ctxt, 0, 0);
worker_thread_is_switching_context = false;
software_interrupt_enable(); software_interrupt_enable();
sandbox_initialize_io_handles_and_file_descriptors(sandbox); sandbox_initialize_io_handles_and_file_descriptors(sandbox);

@ -86,9 +86,6 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
/* NOOP if software interrupts not enabled */ /* NOOP if software interrupts not enabled */
if (!software_interrupt_is_enabled()) return; 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 * 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 * 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, &current_sandbox->ctxt); arch_mcontext_restore(&user_context->uc_mcontext, &current_sandbox->ctxt);
worker_thread_is_switching_context = false;
software_interrupt_enable(); software_interrupt_enable();
return; return;

@ -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 */ /* 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; 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 * * Worker Thread Logic *
**********************/ **********************/
@ -51,8 +48,6 @@ worker_thread_switch_to_sandbox(struct sandbox *next_sandbox)
assert(next_sandbox != NULL); assert(next_sandbox != NULL);
struct arch_context *next_context = &next_sandbox->ctxt; struct arch_context *next_context = &next_sandbox->ctxt;
worker_thread_is_switching_context = true;
/* Get the old sandbox we're switching from */ /* Get the old sandbox we're switching from */
struct sandbox *current_sandbox = current_sandbox_get(); struct sandbox *current_sandbox = current_sandbox_get();
@ -92,8 +87,6 @@ static inline void
worker_thread_switch_to_base_context() worker_thread_switch_to_base_context()
{ {
assert(!software_interrupt_is_enabled()); 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(); struct sandbox *current_sandbox = current_sandbox_get();
@ -110,7 +103,6 @@ worker_thread_switch_to_base_context()
arch_context_switch(&current_sandbox->ctxt, &worker_thread_base_context); arch_context_switch(&current_sandbox->ctxt, &worker_thread_base_context);
software_interrupt_enable(); software_interrupt_enable();
worker_thread_is_switching_context = false;
} }
/** /**
@ -222,7 +214,6 @@ worker_thread_main(void *return_code)
/* Initialize Flags */ /* Initialize Flags */
software_interrupt_is_disabled = false; software_interrupt_is_disabled = false;
worker_thread_is_in_libuv_event_loop = false; worker_thread_is_in_libuv_event_loop = false;
worker_thread_is_switching_context = false;
/* Unmask signals */ /* Unmask signals */
#ifndef PREEMPT_DISABLE #ifndef PREEMPT_DISABLE

Loading…
Cancel
Save