diff --git a/base-nova/src/base/server/server.cc b/base-nova/src/base/server/server.cc index 598e60c78a..26e3cacb52 100644 --- a/base-nova/src/base/server/server.cc +++ b/base-nova/src/base/server/server.cc @@ -198,7 +198,8 @@ void Rpc_entrypoint::activate() Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size, - const char *name, bool start_on_construction) + const char *name, bool start_on_construction, + unsigned affinity) : Thread_base(name, stack_size), _curr_obj(start_on_construction ? 0 : (Rpc_object_base *)~0UL), @@ -221,6 +222,10 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size, if (env()->cpu_session()->set_pager(_thread_cap, _pager_cap)) throw Cpu_session::Thread_creation_failed(); + /* place new thread on the specified CPU - ~0UL means default CPU */ + if (affinity != ~0UL) + env()->cpu_session()->affinity(_thread_cap, affinity); + addr_t thread_sp = (addr_t)&_context->stack[-4]; Thread_state state; @@ -251,10 +256,11 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size, if (!ec_cap.valid()) throw Cpu_session::Thread_creation_failed(); _tid.ec_sel = ec_cap.local_name(); - } - else { - /* tell thread starting code to use boot CPU */ - *reinterpret_cast(stack_top()) = ~0UL; + + } else { + + /* tell thread starting code to use a specific CPU */ + *reinterpret_cast(stack_top()) = affinity; /* * Required for core threads (creates local EC) diff --git a/base/include/base/rpc_server.h b/base/include/base/rpc_server.h index dab24182db..133feb8153 100644 --- a/base/include/base/rpc_server.h +++ b/base/include/base/rpc_server.h @@ -318,7 +318,8 @@ namespace Genode { * \param name name of entrypoint thread */ Rpc_entrypoint(Cap_session *cap_session, size_t stack_size, - char const *name, bool start_on_construction = true); + char const *name, bool start_on_construction = true, + unsigned affinity = ~0U); ~Rpc_entrypoint(); diff --git a/base/src/base/server/common.cc b/base/src/base/server/common.cc index ac92710c49..7cc66a1896 100644 --- a/base/src/base/server/common.cc +++ b/base/src/base/server/common.cc @@ -98,7 +98,8 @@ bool Rpc_entrypoint::is_myself() const Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size, - char const *name, bool start_on_construction) + char const *name, bool start_on_construction, + unsigned affinity) : Thread_base(name, stack_size), _cap(Untyped_capability()),