nova: create pager/server thread on specific cpus

issue #814
This commit is contained in:
Alexander Boettcher 2013-07-08 09:06:26 +02:00 committed by Norman Feske
parent 4ae1faf14d
commit 4e2e79bf4f
4 changed files with 17 additions and 7 deletions

View File

@ -275,6 +275,8 @@ Pager_object::Pager_object(unsigned long badge, unsigned affinity)
_state.singlestep = false;
_state.sel_client_ec = Native_thread::INVALID_INDEX;
/* tell thread starting code on which CPU to let run the pager */
*reinterpret_cast<addr_t *>(stack_top()) = affinity;
/* creates local EC */
Thread_base::start();

View File

@ -252,11 +252,16 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
throw Cpu_session::Thread_creation_failed();
_tid.ec_sel = ec_cap.local_name();
}
else
else {
enum { CPU_NO = 0 }; //XXX find out the boot cpu
/* tell thread starting code on which CPU to let run the server thread */
*reinterpret_cast<addr_t *>(stack_top()) = CPU_NO;
/*
* Required for core threads (creates local EC)
*/
Thread_base::start();
}
/* create cleanup portal */
_cap = _cap_session->alloc(Native_capability(_tid.ec_sel),

View File

@ -121,6 +121,7 @@ void Thread_base::start()
/* create EC at core */
addr_t thread_sp = reinterpret_cast<addr_t>(&_context->stack[-4]);
thread_sp &= ~0xf; /* align initial stack to 16 byte boundary */
Thread_state state;
state.sel_exc_base = _tid.exc_pt_sel;

View File

@ -77,15 +77,17 @@ void Thread_base::start()
*/
using namespace Nova;
addr_t sp = reinterpret_cast<addr_t>(&_context->stack[-4]);
addr_t utcb = reinterpret_cast<addr_t>(&_context->utcb);
addr_t sp = reinterpret_cast<addr_t>(&_context->stack[-4]);
sp &= ~0xf; /* align initial stack to 16 byte boundary */
addr_t utcb = reinterpret_cast<addr_t>(&_context->utcb);
Utcb * utcb_obj = reinterpret_cast<Utcb *>(&_context->utcb);
addr_t pd_sel = Platform_pd::pd_core_sel();
addr_t pd_sel = Platform_pd::pd_core_sel();
addr_t cpu_no = *reinterpret_cast<addr_t *>(stack_top());
/* create local EC */
enum { CPU_NO = 0, GLOBAL = false };
uint8_t res = create_ec(_tid.ec_sel, pd_sel, CPU_NO,
utcb, sp, _tid.exc_pt_sel, GLOBAL);
enum { LOCAL_THREAD = false };
uint8_t res = create_ec(_tid.ec_sel, pd_sel, cpu_no,
utcb, sp, _tid.exc_pt_sel, LOCAL_THREAD);
if (res != NOVA_OK) {
PERR("create_ec returned %d", res);
throw Cpu_session::Thread_creation_failed();