diff --git a/base-linux/src/core/include/platform_thread.h b/base-linux/src/core/include/platform_thread.h index 4b2d1cd73..af93f4255 100644 --- a/base-linux/src/core/include/platform_thread.h +++ b/base-linux/src/core/include/platform_thread.h @@ -114,7 +114,19 @@ namespace Genode { } const char *name() { return _name; } - void affinity(Affinity::Location) { } + + /** + * Set the executing CPU for this thread + * + * SMP is currently not directly supported on Genode/Linux + * (but indirectly by the Linux kernel). + */ + void affinity(Affinity::Location) { } + + /** + * Request the affinity of this thread + */ + Affinity::Location affinity() { return Affinity::Location(); } /** * Register process ID and thread ID of thread diff --git a/base/src/core/cpu_session_component.cc b/base/src/core/cpu_session_component.cc index c194dc609..a854e20f9 100644 --- a/base/src/core/cpu_session_component.cc +++ b/base/src/core/cpu_session_component.cc @@ -122,6 +122,13 @@ int Cpu_session_component::start(Thread_capability thread_cap, */ thread->update_exception_sigh(); + /* + * If no affinity location was set for this specific thread before, + * we set the one which was defined for the whole CPU session. + */ + if (!thread->platform_thread()->affinity().valid()) + thread->platform_thread()->affinity(_location); + return thread->platform_thread()->start((void *)ip, (void *)sp); } diff --git a/doc/release_notes-13-08.txt b/doc/release_notes-13-08.txt index 7e323144b..a11c78e0d 100644 --- a/doc/release_notes-13-08.txt +++ b/doc/release_notes-13-08.txt @@ -564,7 +564,7 @@ declaration describes an affinity space of 4x2: ! ! ... -! +! ! ... ! diff --git a/os/doc/init.txt b/os/doc/init.txt index 9c546810b..00f9545bb 100644 --- a/os/doc/init.txt +++ b/os/doc/init.txt @@ -263,7 +263,7 @@ example, the following declaration describes an affinity space of 4x2: ! ! ... -! +! ! ... !