From fc64e837c3544c3462539237fec4e90726aa8727 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 29 Oct 2021 09:30:13 +0200 Subject: score: Rework ask for help requests Process ask for help requests on the current processor. This avoids using inter-processor interrupts to make the system behaviour a bit more predictable. Update #4531. --- cpukit/score/src/schedulersmp.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'cpukit/score/src/schedulersmp.c') diff --git a/cpukit/score/src/schedulersmp.c b/cpukit/score/src/schedulersmp.c index cc566180b7..3bb2638139 100644 --- a/cpukit/score/src/schedulersmp.c +++ b/cpukit/score/src/schedulersmp.c @@ -21,28 +21,21 @@ #include -void _Scheduler_Request_ask_for_help( Thread_Control *the_thread ) +void _Scheduler_SMP_Remove_ask_for_help_from_processor( + Thread_Control *thread, + Per_CPU_Control *cpu +) { - ISR_lock_Context scheduler_lock_context; + ISR_lock_Context lock_context; - _Thread_Scheduler_acquire_critical( the_thread, &scheduler_lock_context ); + _Assert( _ISR_lock_Is_owner( &thread->Scheduler.Lock ) ); - if ( _Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) { - Per_CPU_Control *cpu; - ISR_lock_Context per_cpu_lock_context; + _Per_CPU_Acquire( cpu, &lock_context ); - cpu = _Thread_Get_CPU( the_thread ); - _Per_CPU_Acquire( cpu, &per_cpu_lock_context ); - - _Chain_Append_unprotected( - &cpu->Threads_in_need_for_help, - &the_thread->Scheduler.Help_node - ); - - _Per_CPU_Release( cpu, &per_cpu_lock_context ); - - _Thread_Dispatch_request( _Per_CPU_Get(), cpu ); + if ( thread->Scheduler.ask_for_help_cpu == cpu ) { + _Chain_Extract_unprotected( &thread->Scheduler.Help_node ); + thread->Scheduler.ask_for_help_cpu = NULL; } - _Thread_Scheduler_release_critical( the_thread, &scheduler_lock_context ); + _Per_CPU_Release( cpu, &lock_context ); } -- cgit v1.2.3