diff --git a/base-pistachio/src/core/include/platform_thread.h b/base-pistachio/src/core/include/platform_thread.h index d4b2daefd..ab67181a1 100644 --- a/base-pistachio/src/core/include/platform_thread.h +++ b/base-pistachio/src/core/include/platform_thread.h @@ -68,12 +68,11 @@ namespace Genode { * * \param ip instruction pointer to start at * \param sp stack pointer to use - * \param cpu_no target cpu * * \retval 0 successful * \retval -1 thread could not be started */ - int start(void *ip, void *sp, unsigned int cpu_no = 0); + int start(void *ip, void *sp); /** * Pause this thread diff --git a/base-pistachio/src/core/platform_thread.cc b/base-pistachio/src/core/platform_thread.cc index 2e489dd0f..ef31133ca 100644 --- a/base-pistachio/src/core/platform_thread.cc +++ b/base-pistachio/src/core/platform_thread.cc @@ -50,8 +50,9 @@ void Platform_thread::affinity(Affinity::Location location) return; } - if (L4_Set_ProcessorNo(_l4_thread_id, cpu_no) == 0) - PERR("Error setting processor number."); + if (_l4_thread_id != L4_nilthread) + if (L4_Set_ProcessorNo(_l4_thread_id, cpu_no) == 0) + PERR("Error setting processor number."); } @@ -61,7 +62,7 @@ Affinity::Location Platform_thread::affinity() } -int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) +int Platform_thread::start(void *ip, void *sp) { L4_ThreadId_t thread = _l4_thread_id; L4_ThreadId_t pager = _pager ? _pager->cap().dst() : L4_nilthread; @@ -108,7 +109,7 @@ int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) } /* get the thread running on the right cpu */ - affinity(Affinity::Location(cpu_no, 0)); + affinity(_location); /* assign priority */ if (!L4_Set_Priority(thread, diff --git a/base/src/core/cpu_session_component.cc b/base/src/core/cpu_session_component.cc index 6592eb167..436c3f139 100644 --- a/base/src/core/cpu_session_component.cc +++ b/base/src/core/cpu_session_component.cc @@ -53,6 +53,9 @@ Thread_capability Cpu_session_component::create_thread(Name const &name, _default_exception_handler, trace_control_index, *trace_control); + + /* set default affinity defined by CPU session */ + thread->platform_thread()->affinity(_location); } catch (Allocator::Out_of_memory) { throw Out_of_metadata(); } @@ -122,13 +125,6 @@ int Cpu_session_component::start(Thread_capability thread_cap, */ thread->update_exception_sigh(); - /* - * If no affinity location was set for this specific thread before, - * we set the one which was defined for the whole CPU session. - */ - if (!thread->platform_thread()->affinity().valid()) - thread->platform_thread()->affinity(_location); - return thread->platform_thread()->start((void *)ip, (void *)sp); }