mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
core: Export interface for explicit thread migration and pinning.
This commit is contained in:
@@ -429,6 +429,8 @@ class Genode::Thread
|
||||
* Thread affinity
|
||||
*/
|
||||
Affinity::Location affinity() const { return _affinity; }
|
||||
|
||||
void pin(Affinity::Location &loc);
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__BASE__THREAD_H_ */
|
||||
|
||||
@@ -33,6 +33,9 @@ struct Genode::Cpu_session_client : Rpc_client<Cpu_session>
|
||||
void kill_thread(Thread_capability thread) override {
|
||||
call<Rpc_kill_thread>(thread); }
|
||||
|
||||
void migrate_thread(Thread_capability thread, Affinity::Location loc) override {
|
||||
call<Rpc_migrate_thread>(thread, loc); }
|
||||
|
||||
void exception_sigh(Signal_context_capability sigh) override {
|
||||
call<Rpc_exception_sigh>(sigh); }
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <session/session.h>
|
||||
#include <dataspace/capability.h>
|
||||
#include <pd_session/pd_session.h>
|
||||
#include <base/affinity.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
@@ -109,6 +110,14 @@ struct Genode::Cpu_session : Session
|
||||
*/
|
||||
virtual void kill_thread(Thread_capability thread) = 0;
|
||||
|
||||
/**
|
||||
* Migrate a thread to a new location
|
||||
*
|
||||
* \param thread capability of the thread to migrate
|
||||
* \param loc component-local location to migrate the thread to
|
||||
*/
|
||||
virtual void migrate_thread(Thread_capability thread, Genode::Affinity::Location loc) = 0;
|
||||
|
||||
/**
|
||||
* Register default signal handler for exceptions
|
||||
*
|
||||
@@ -237,6 +246,7 @@ struct Genode::Cpu_session : Session
|
||||
Capability<Pd_session>, Name const &, Affinity::Location,
|
||||
Weight, addr_t);
|
||||
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
|
||||
GENODE_RPC(Rpc_migrate_thread, void, migrate_thread, Thread_capability, Affinity::Location);
|
||||
GENODE_RPC(Rpc_exception_sigh, void, exception_sigh, Signal_context_capability);
|
||||
GENODE_RPC(Rpc_affinity_space, Affinity::Space, affinity_space);
|
||||
GENODE_RPC(Rpc_trace_control, Dataspace_capability, trace_control);
|
||||
@@ -247,7 +257,7 @@ struct Genode::Cpu_session : Session
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_create_thread, Rpc_kill_thread, Rpc_exception_sigh,
|
||||
Rpc_affinity_space, Rpc_trace_control, Rpc_ref_account,
|
||||
Rpc_transfer_quota, Rpc_quota, Rpc_native_cpu);
|
||||
Rpc_transfer_quota, Rpc_quota, Rpc_native_cpu, Rpc_migrate_thread);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <util/arg_string.h>
|
||||
#include <cpu_thread/client.h>
|
||||
|
||||
/* core includes */
|
||||
#include <cpu_session_component.h>
|
||||
@@ -23,6 +24,7 @@
|
||||
#include <pd_session_component.h>
|
||||
#include <platform_generic.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
@@ -144,6 +146,10 @@ void Cpu_session_component::kill_thread(Thread_capability thread_cap)
|
||||
}
|
||||
}
|
||||
|
||||
void Cpu_session_component::migrate_thread(Thread_capability thread_cap, Affinity::Location loc)
|
||||
{
|
||||
_thread_ep.apply(thread_cap, [&] (Cpu_thread_component *t) { t->affinity(_thread_affinity(loc)); });
|
||||
}
|
||||
|
||||
void Cpu_session_component::exception_sigh(Signal_context_capability sigh)
|
||||
{
|
||||
|
||||
@@ -169,6 +169,7 @@ class Genode::Cpu_session_component : public Session_object<Cpu_session>,
|
||||
Thread_capability create_thread(Capability<Pd_session>, Name const &,
|
||||
Affinity::Location, Weight, addr_t) override;
|
||||
void kill_thread(Thread_capability) override;
|
||||
void migrate_thread(Thread_capability, Affinity::Location) override;
|
||||
void exception_sigh(Signal_context_capability) override;
|
||||
Affinity::Space affinity_space() const override;
|
||||
Dataspace_capability trace_control() override;
|
||||
|
||||
Reference in New Issue
Block a user