diff --git a/repos/base/include/topo_session/client.h b/repos/base/include/topo_session/client.h index e4244a4820..fa6e011e47 100644 --- a/repos/base/include/topo_session/client.h +++ b/repos/base/include/topo_session/client.h @@ -30,7 +30,7 @@ struct Genode::Topo_session_client : Rpc_client explicit Topo_session_client(Topo_session_capability session) : Rpc_client(session) { } - Node *node_affinity_of(Affinity::Location &loc) override { + Topology::Numa_region node_affinity_of(Affinity::Location const &loc) override { return call(loc); } diff --git a/repos/base/include/topo_session/connection.h b/repos/base/include/topo_session/connection.h index 556a96577c..ce1bd38624 100644 --- a/repos/base/include/topo_session/connection.h +++ b/repos/base/include/topo_session/connection.h @@ -27,7 +27,7 @@ struct Genode::Topo_connection : Connection, Topo_session_client { enum { - RAM_QUOTA = 8192 + RAM_QUOTA = 262144 }; Topo_connection(Env &env, const char *label = "", Affinity const &affinity = Affinity()) @@ -36,7 +36,7 @@ struct Genode::Topo_connection : Connection, Topo_session_client session(env.parent(), affinity, "ram_quota=%u, cap_quota=%u, label=\"%s\"", RAM_QUOTA, CAP_QUOTA, label)), Topo_session_client(cap()) {} - Node *node_affinity_of(Affinity::Location &loc) override { + Topology::Numa_region node_affinity_of(Affinity::Location const &loc) override { return Topo_session_client::node_affinity_of(loc); } diff --git a/repos/base/include/topo_session/node.h b/repos/base/include/topo_session/node.h index 0d03bf865d..ffc7d631e2 100644 --- a/repos/base/include/topo_session/node.h +++ b/repos/base/include/topo_session/node.h @@ -17,26 +17,42 @@ #include -namespace Genode { - struct Node; +namespace Topology { + struct Numa_region; } -struct Genode::Node : List::Element +struct Topology::Numa_region : Genode::List::Element { /* ID presented to component */ unsigned _id; unsigned _core_count; - List neighbours; + Genode::List neighbours; /* Physical NUMA node ID */ unsigned _native_id; - Node(unsigned id, unsigned native_id) : _id(id), _core_count(0), neighbours(), _native_id(native_id) {} + Numa_region() : _id(0), _core_count(0), neighbours(), _native_id(0) { } + Numa_region(unsigned id, unsigned native_id) : _id(id), _core_count(0), neighbours(), _native_id(native_id) {} + Numa_region(Numa_region ©) : _id(copy.id()), _core_count(copy.core_count()), neighbours(), _native_id(copy.native_id()) { + } unsigned native_id() { return _native_id; } unsigned id() { return _id; } unsigned core_count() { return _core_count; } void core_count(unsigned count) { _core_count = count; } void increment_core_count() { _core_count++; } + Numa_region &operator=(const Numa_region ©) { + if (this == ©) + return *this; + + this->_id = copy._id; + this->_core_count = copy._core_count; + this->_native_id = copy._native_id; + + /* At the moment, we do not copy the list of neighbours, as it is not used by any our applications. */ + /* TODO: Copy list onf neighbours, as soons as any application is going to use that information. */ + + return *this; + } }; \ No newline at end of file diff --git a/repos/base/include/topo_session/topo_session.h b/repos/base/include/topo_session/topo_session.h index 2bfda57d0b..8d0eeffff7 100644 --- a/repos/base/include/topo_session/topo_session.h +++ b/repos/base/include/topo_session/topo_session.h @@ -22,9 +22,13 @@ namespace Genode { struct Topo_session; struct Topo_session_client; - struct Node; } +namespace Topology +{ + struct Numa_region; +} // namespace EalanOS + struct Genode::Topo_session : Session { /** @@ -42,10 +46,10 @@ struct Genode::Topo_session : Session virtual ~Topo_session() { } - virtual Node *node_affinity_of(Affinity::Location &) = 0; + virtual Topology::Numa_region node_affinity_of(Affinity::Location const &) = 0; virtual unsigned node_count() = 0; - GENODE_RPC(Rpc_node_affinity, Node*, node_affinity_of, Affinity::Location &); + GENODE_RPC(Rpc_node_affinity, Topology::Numa_region, node_affinity_of, Affinity::Location const &); GENODE_RPC(Rpc_node_count, unsigned, node_count); GENODE_RPC_INTERFACE(Rpc_node_affinity, Rpc_node_count); diff --git a/repos/base/src/core/include/topo_session_component.h b/repos/base/src/core/include/topo_session_component.h index 65b31bb243..1eb36b00de 100644 --- a/repos/base/src/core/include/topo_session_component.h +++ b/repos/base/src/core/include/topo_session_component.h @@ -32,7 +32,7 @@ class Genode::Topo_session_component : public Session_object Genode::Affinity &_affinity; Sliced_heap _md_alloc; - Node ***_node_affinities; + Topology::Numa_region _node_affinities[64][64]; unsigned _node_count; public: @@ -45,17 +45,19 @@ class Genode::Topo_session_component : public Session_object Affinity &affinity ); - /** - * @brief Topology session interface - */ - Node *node_affinity_of(Affinity::Location &loc) override - { - return _node_affinities[loc.xpos()][loc.ypos()]; + /** + * @brief Topology session interface + */ + + Topology::Numa_region node_affinity_of(Affinity::Location const &loc) override + { + return _node_affinities[loc.xpos()][loc.ypos()]; } unsigned node_count() override { return _node_count; } -}; \ No newline at end of file + +}; diff --git a/repos/base/src/include/base/internal/expanding_topo_session_client.h b/repos/base/src/include/base/internal/expanding_topo_session_client.h index 6dce83d90d..654577e6a2 100644 --- a/repos/base/src/include/base/internal/expanding_topo_session_client.h +++ b/repos/base/src/include/base/internal/expanding_topo_session_client.h @@ -32,7 +32,7 @@ struct Genode::Expanding_topo_session_client : Upgradeable_client(cap), id) { } - Node *node_affinity_of(Affinity::Location &loc) override + Topology::Numa_region node_affinity_of(Affinity::Location const &loc) override { return retry( [&]()