monitor: apply affinity to monitored children

Fixes #4996
This commit is contained in:
Norman Feske 2023-09-12 15:27:17 +02:00 committed by Christian Helmuth
parent d7bbb27671
commit 458206b11a
3 changed files with 9 additions and 5 deletions

View File

@ -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 <typename ST>
void deliver_session(ST &session)

View File

@ -55,12 +55,14 @@ install_config {
<service name="Terminal"/>
</parent-provides>
<default caps="100"/>
<affinity-space width="2" height="1"/>
<monitor>
<policy label="test-monitor" stop="no" wx="yes" />
</monitor>
<start name="test-monitor">
<affinity xpos="1" width="1"/>
<resource name="RAM" quantum="32M"/>
<route>
<service name="PD"> <local/> </service>
@ -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

View File

@ -60,10 +60,10 @@ struct Monitor::Main : Sandbox::State_handler,
struct Local_cpu_session : Connection<Cpu_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<Cpu_connection>(env, label, priority.value),
Connection<Cpu_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);