From 458206b11aad449e91a258f2363a0a5a2752bc7c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 12 Sep 2023 15:27:17 +0200 Subject: [PATCH] monitor: apply affinity to monitored children Fixes #4996 --- repos/os/include/sandbox/sandbox.h | 4 +++- repos/os/run/monitor.run | 4 +++- repos/os/src/monitor/main.cc | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/repos/os/include/sandbox/sandbox.h b/repos/os/include/sandbox/sandbox.h index fe88df6c42..eb25be9814 100644 --- a/repos/os/include/sandbox/sandbox.h +++ b/repos/os/include/sandbox/sandbox.h @@ -140,7 +140,8 @@ class Genode::Sandbox::Local_service_base : public Service resources(session_resources_from_args(session.args().string())), label(session.label()), diag(session_diag_from_args(session.args().string())), - args(session.args()) + args(session.args()), + affinity(session.affinity()) { } /* @@ -157,6 +158,7 @@ class Genode::Sandbox::Local_service_base : public Service Session::Label const label; Session::Diag const diag; Args const args; + Affinity const affinity; template void deliver_session(ST &session) diff --git a/repos/os/run/monitor.run b/repos/os/run/monitor.run index 2d810a160c..55bf8fffc3 100644 --- a/repos/os/run/monitor.run +++ b/repos/os/run/monitor.run @@ -55,12 +55,14 @@ install_config { + + @@ -75,6 +77,6 @@ install_config { build_boot_image [build_artifacts] -append qemu_args "-nographic " +append qemu_args "-nographic -smp 4,cores=4 " run_genode_until {\[init -> monitor\] child "test-monitor" exited with exit value 0.*\n} 30 diff --git a/repos/os/src/monitor/main.cc b/repos/os/src/monitor/main.cc index 2eb74c46e4..173ce3cc97 100644 --- a/repos/os/src/monitor/main.cc +++ b/repos/os/src/monitor/main.cc @@ -60,10 +60,10 @@ struct Monitor::Main : Sandbox::State_handler, struct Local_cpu_session : Connection, Inferior_cpu { Local_cpu_session(Env &env, Session::Label const &label, - Priority priority, Allocator &alloc, + Affinity affinity, Priority priority, Allocator &alloc, Thread_monitor &thread_monitor) : - Connection(env, label, priority.value), + Connection(env, label, priority.value, affinity), Inferior_cpu(env.ep(), _connection.cap(), label, alloc, thread_monitor) { } @@ -278,7 +278,7 @@ struct Monitor::Main : Sandbox::State_handler, Local_cpu_session &_create_session(Cpu_service &, Session_request const &request) { Local_cpu_session &session = *new (_heap) - Local_cpu_session(_env, request.label, + Local_cpu_session(_env, request.label, request.affinity, _priority_from_args(request.args), _heap, *this); session.init_native_cpu(_kernel);