mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-11 13:22:33 +00:00
parent
85d98195d5
commit
c0a00019c0
@ -1174,10 +1174,10 @@ struct Vcpu : Genode::Thread
|
||||
Vcpu(Env &env, Signal_context_capability &cap,
|
||||
Semaphore &handler_ready,
|
||||
Vm_session_client::Vcpu_id &id, enum Virt type,
|
||||
Allocator &alloc)
|
||||
Allocator &alloc, Affinity::Location location)
|
||||
:
|
||||
Thread(env, "vcpu_thread", STACK_SIZE), _signal(cap),
|
||||
_handler_ready(handler_ready), _alloc(alloc),
|
||||
Thread(env, "vcpu_thread", STACK_SIZE, location, Weight(), env.cpu()),
|
||||
_signal(cap), _handler_ready(handler_ready), _alloc(alloc),
|
||||
_id(id), _vm_type(type)
|
||||
{ }
|
||||
|
||||
@ -1256,10 +1256,13 @@ Vm_session_client::create_vcpu(Allocator &alloc, Env &env,
|
||||
return id;
|
||||
}
|
||||
|
||||
Thread * ep = reinterpret_cast<Thread *>(&handler._rpc_ep);
|
||||
Affinity::Location location = ep->affinity();
|
||||
|
||||
/* create thread that switches modes between thread/cpu */
|
||||
Vcpu * vcpu = new (alloc) Registered<Vcpu>(vcpus, env, handler._cap,
|
||||
handler._done, id, vm_type,
|
||||
alloc);
|
||||
alloc, location);
|
||||
|
||||
try {
|
||||
/* now it gets actually valid - vcpu->cap() becomes valid */
|
||||
|
@ -742,9 +742,11 @@ struct Vcpu : Genode::Thread
|
||||
public:
|
||||
|
||||
Vcpu(Genode::Env &env, Genode::Signal_context_capability &cap,
|
||||
Semaphore &handler_ready, unsigned id, Allocator &alloc)
|
||||
Semaphore &handler_ready, unsigned id, Allocator &alloc,
|
||||
Affinity::Location &location)
|
||||
:
|
||||
Thread(env, "vcpu_thread", STACK_SIZE), _signal(cap),
|
||||
Thread(env, "vcpu_thread", STACK_SIZE, location, Weight(), env.cpu()),
|
||||
_signal(cap),
|
||||
_handler_ready(handler_ready), _alloc(alloc), _id({id})
|
||||
{ }
|
||||
|
||||
@ -795,11 +797,15 @@ Genode::Vm_session_client::Vcpu_id
|
||||
Genode::Vm_session_client::create_vcpu(Allocator &alloc, Env &env,
|
||||
Vm_handler_base &handler)
|
||||
{
|
||||
Thread * ep = reinterpret_cast<Thread *>(&handler._rpc_ep);
|
||||
Affinity::Location location = ep->affinity();
|
||||
|
||||
/* create thread that switches modes between thread/cpu */
|
||||
Vcpu * vcpu = new (alloc) Genode::Registered<Vcpu> (vcpus, env,
|
||||
handler._cap,
|
||||
handler._done,
|
||||
vcpu_id, alloc);
|
||||
vcpu_id, alloc,
|
||||
location);
|
||||
|
||||
try {
|
||||
/* now it gets actually valid - vcpu->cap() becomes valid */
|
||||
|
@ -430,6 +430,11 @@ class Genode::Thread
|
||||
*/
|
||||
template <typename EVENT>
|
||||
static void trace(EVENT const *event) { _logger()->log(event); }
|
||||
|
||||
/**
|
||||
* Thread affinity
|
||||
*/
|
||||
Affinity::Location affinity() const { return _affinity; }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user