mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
balance Genode CPU pinning, deadlock at Genode exit (#6317)
* Genode: balance thread CPU affinities Genode threads are pinned by defaut to the same CPU as the initial component entrypoint thread. Thread affinities are also permanent. This patch pins new threads to CPUs in a round-robin manner. Arbitrary CPU pinning is not exposed and the 'nimPinToCpu' has no effect. * Genode: guarantee that 'quit' will not return On Genode exits are handled by whatever component is acting as parent. The caller has no guarentee that the parent implementation will halt the caller's threads, so explicitly deadlock the 'quit' procedure.
This commit is contained in:
committed by
Andreas Rumpf
parent
248caaf27e
commit
9258672cee
@@ -31,8 +31,12 @@ struct Nim::SysThread
|
||||
void entry() override {
|
||||
(_func)(_arg); }
|
||||
|
||||
Thread(Genode::Env &env, Genode::size_t stack_size, Entry func, void *arg)
|
||||
: Genode::Thread(env, "nim-thread", stack_size), _func(func), _arg(arg)
|
||||
Thread(Genode::Env &env, Genode::size_t stack_size, Entry func, void *arg, int affinity)
|
||||
: Genode::Thread(env, "nim-thread", stack_size,
|
||||
env.cpu().affinity_space().location_of_index(affinity),
|
||||
Genode::Cpu_session::Weight(Genode::Cpu_session::Weight::DEFAULT_WEIGHT-1),
|
||||
env.cpu()),
|
||||
_func(func), _arg(arg)
|
||||
{
|
||||
Genode::Thread::start();
|
||||
}
|
||||
@@ -40,8 +44,8 @@ struct Nim::SysThread
|
||||
|
||||
Genode::Constructible<Thread> _thread;
|
||||
|
||||
void initThread(Genode::Env *env, Genode::size_t stack_size, Entry func, void *arg) {
|
||||
_thread.construct(*env, stack_size, func, arg); }
|
||||
void initThread(Genode::Env *env, Genode::size_t stack_size, Entry func, void *arg, int aff) {
|
||||
_thread.construct(*env, stack_size, func, arg, aff); }
|
||||
|
||||
void joinThread() {
|
||||
_thread->join(); }
|
||||
|
||||
Reference in New Issue
Block a user