Attach affinity information to session requests
This patch extends the 'Parent::session()' and 'Root::session()' functions with an additional 'affinity' parameter, which is inteded to express the preferred affinity of the new session. For CPU sessions provided by core, the values will be used to select the set of CPUs assigned to the CPU session. For other services, the session affinity information can be utilized to optimize the locality of the server thread with the client. For example, to enable the IRQ session to route an IRQ to the CPU core on which the corresponding device driver (the IRQ client) is running.
This commit is contained in:
@@ -51,7 +51,9 @@ class Iso9660_boot_probe
|
||||
Proxy_service(Genode::Session_capability session)
|
||||
: Genode::Service("proxy"), _session(session) { }
|
||||
|
||||
Genode::Session_capability session(const char *) { return _session; }
|
||||
Genode::Session_capability session(char const *,
|
||||
Genode::Affinity const &)
|
||||
{ return _session; }
|
||||
|
||||
void upgrade(Genode::Session_capability session, const char *) { }
|
||||
|
||||
@@ -127,7 +129,8 @@ class Iso9660_boot_probe
|
||||
{
|
||||
char const *args = "ram_quota=140K, tx_buf_size=128K";
|
||||
Genode::Root_client root(_block_root);
|
||||
return Genode::static_cap_cast<Block::Session>(root.session(args));
|
||||
return Genode::static_cap_cast<Block::Session>
|
||||
(root.session(args, Genode::Affinity()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +155,7 @@ class Iso9660_boot_probe
|
||||
char args[Genode::Root::Session_args::MAX_SIZE];
|
||||
Genode::snprintf(args, sizeof(args), "ram_quota=4K, filename=\"%s\"",
|
||||
boot_tag_name);
|
||||
rom_root.session(args);
|
||||
rom_root.session(args, Genode::Affinity());
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -297,11 +300,12 @@ namespace Block {
|
||||
Root(Driver_registry &driver_registry)
|
||||
: _driver_registry(driver_registry) { }
|
||||
|
||||
Genode::Session_capability session(Genode::Root::Session_args const &args)
|
||||
Genode::Session_capability session(Genode::Root::Session_args const &args,
|
||||
Genode::Affinity const &affinity)
|
||||
{
|
||||
PDBG("\nsession requested args=\"%s\"", args.string());
|
||||
Genode::Root_capability root = _driver_registry.root();
|
||||
return Genode::Root_client(root).session(args);
|
||||
return Genode::Root_client(root).session(args, affinity);
|
||||
}
|
||||
|
||||
void upgrade(Genode::Session_capability,
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace Input {
|
||||
|
||||
try {
|
||||
using namespace Genode;
|
||||
return static_cap_cast<Session>(Root_client(root).session(args));
|
||||
return static_cap_cast<Session>
|
||||
(Root_client(root).session(args, Genode::Affinity()));
|
||||
} catch (...) {
|
||||
throw Source_unavailable();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace Nic {
|
||||
|
||||
public:
|
||||
|
||||
Genode::Session_capability session(Session_args const &args)
|
||||
Genode::Session_capability session(Session_args const &args,
|
||||
Genode::Affinity const &affinity)
|
||||
{
|
||||
if (!args.is_valid_string()) throw Invalid_args();
|
||||
|
||||
@@ -48,7 +49,8 @@ namespace Nic {
|
||||
throw Unavailable();
|
||||
|
||||
try {
|
||||
return Genode::Root_client(_nic_provider.root()).session(args.string());
|
||||
return Genode::Root_client(_nic_provider.root())
|
||||
.session(args.string(), affinity);
|
||||
} catch (...) {
|
||||
throw Unavailable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user