mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-20 16:10:29 +00:00
base: tighten affinity handling
This patch improves the robustness of the CPU-affinity handling. - The types in base/affinity.h received the accessors 'Location::within(space)' and 'Affinity::valid', which alleviates the fiddling with coordinates when sanity checking the values, in init or core. - The 'Affinity::Location::valid' method got removed because its meaning was too vague. For sanity checks of affinity configurations, the new 'within' method is approriate. In cases where only the x,y values are used for selecting a physical CPU (during thread creation), the validity check (width*height > 0) was not meaningful anyway. - The 'Affinity::Location::from_xml' requires a 'Affinity::Space' as argument because a location always relates to the bounds of a specific space. This function now implements the selection of whole rows or columns, which has previously a feature of the sandbox library only. - Whenever the sandbox library (init) encounters an invalid affinity configuration, it prints a warning message as a diagnostic aid. - A new 'Affinity::unrestricted' function constructs an affinity that covers the whole affinity space. The named functions clarifies the meaning over the previous use of the default constructor. - Core's CPU service denies session requests with an invalid affinity parameter. Previously, it would fall back to an unrestricted affinity. Issue #4300
This commit is contained in:
@ -43,6 +43,9 @@ namespace Genode {
|
||||
if (ram_quota < Trace::Control_area::SIZE)
|
||||
throw Insufficient_ram_quota();
|
||||
|
||||
if (!affinity.valid())
|
||||
throw Service_denied();
|
||||
|
||||
return new (md_alloc())
|
||||
Cpu_session_component(*this->ep(),
|
||||
session_resources_from_args(args),
|
||||
|
@ -306,7 +306,7 @@ int main()
|
||||
{Cpu_session::CAP_QUOTA}},
|
||||
"core", Session::Diag{false},
|
||||
core_ram_alloc, local_rm, ep, pager_ep, Trace::sources(), "",
|
||||
Affinity(), Cpu_session::QUOTA_LIMIT);
|
||||
Affinity::unrestricted(), Cpu_session::QUOTA_LIMIT);
|
||||
|
||||
Cpu_session_capability core_cpu_cap = core_cpu.cap();
|
||||
|
||||
|
Reference in New Issue
Block a user