core: make region-map verbosity configurable

With this patch, diagnostic messages generated by core's region-map
handling are printed only if the PD session is created with 'diag'
mode enabled.
This commit is contained in:
Norman Feske 2017-12-14 09:27:50 +01:00 committed by Christian Helmuth
parent f148388227
commit 7e3334ca02
5 changed files with 24 additions and 15 deletions

View File

@ -44,7 +44,7 @@ class Genode::Region_map_component : public Rpc_object<Region_map>,
public:
Region_map_component(Rpc_entrypoint &, Allocator &, Pager_entrypoint &,
addr_t, size_t) { }
addr_t, size_t, Session::Diag) { }
void upgrade_ram_quota(size_t ram_quota) { }

View File

@ -139,9 +139,9 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
_rpc_cap_factory(_sliced_heap),
_native_pd(*this, args),
_address_space(ep, _sliced_heap, pager_ep,
virt_range.start, virt_range.size),
_stack_area (ep, _sliced_heap, pager_ep, 0, stack_area_virtual_size()),
_linker_area(ep, _sliced_heap, pager_ep, 0, LINKER_AREA_SIZE)
virt_range.start, virt_range.size, diag),
_stack_area (ep, _sliced_heap, pager_ep, 0, stack_area_virtual_size(), diag),
_linker_area(ep, _sliced_heap, pager_ep, 0, LINKER_AREA_SIZE, diag)
{
if (platform()->core_needs_platform_pd() || label != "core") {
_pd.construct(&_sliced_heap, _label.string());

View File

@ -214,6 +214,8 @@ class Genode::Region_map_component : public Genode::Weak_object<Genode::Region_m
{
private:
Session::Diag const _diag;
Rpc_entrypoint *_ds_ep;
Rpc_entrypoint *_thread_ep;
Rpc_entrypoint *_session_ep;
@ -337,7 +339,8 @@ class Genode::Region_map_component : public Genode::Weak_object<Genode::Region_m
Allocator &md_alloc,
Pager_entrypoint &pager_ep,
addr_t vm_start,
size_t vm_size);
size_t vm_size,
Session::Diag diag);
~Region_map_component();

View File

@ -76,7 +76,8 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
try {
Region_map_component *rm =
new (_md_alloc)
Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
Region_map_component(_ep, _md_alloc, _pager_ep, 0, size,
Diag{false});
_region_maps.insert(rm);

View File

@ -429,9 +429,8 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
try {
_map.metadata(attach_at, Rm_region((addr_t)attach_at, size, true,
dsc, offset, this, executable));
} catch (Allocator_avl_tpl<Rm_region>::Assign_metadata_failed) {
}
catch (Allocator_avl_tpl<Rm_region>::Assign_metadata_failed) {
error("failed to store attachment info");
throw Invalid_dataspace();
}
@ -495,16 +494,17 @@ void Region_map_component::detach(Local_addr local_addr)
Rm_region *region_ptr = _map.metadata(local_addr);
if (!region_ptr) {
warning("detach: no attachment at ", (void *)local_addr);
if (_diag.enabled)
warning("detach: no attachment at ", (void *)local_addr);
return;
}
if (region_ptr->base() != static_cast<addr_t>(local_addr))
if ((region_ptr->base() != static_cast<addr_t>(local_addr)) && _diag.enabled)
warning("detach: ", static_cast<void *>(local_addr), " is not "
"the beginning of the region ", Hex(region_ptr->base()));
Dataspace_component *dsc = region_ptr->dataspace();
if (!dsc)
if (!dsc && _diag.enabled)
warning("detach: region of ", this, " may be inconsistent!");
/* inform dataspace about detachment */
@ -546,9 +546,13 @@ void Region_map_component::detach(Local_addr local_addr)
*/
if (_address_space) {
if (!platform()->supports_direct_unmap() && dsc->managed() &&
dsc->core_local_addr() == 0) {
warning("unmapping of managed dataspaces not yet supported");
if (_diag.enabled)
warning("unmapping of managed dataspaces not yet supported");
} else {
Address_space::Core_local_addr core_local
= { dsc->core_local_addr() + region.offset() };
@ -636,9 +640,10 @@ Region_map_component::Region_map_component(Rpc_entrypoint &ep,
Allocator &md_alloc,
Pager_entrypoint &pager_ep,
addr_t vm_start,
size_t vm_size)
size_t vm_size,
Session::Diag diag)
:
_ds_ep(&ep), _thread_ep(&ep), _session_ep(&ep),
_diag(diag), _ds_ep(&ep), _thread_ep(&ep), _session_ep(&ep),
_md_alloc(md_alloc),
_map(&_md_alloc), _pager_ep(&pager_ep),
_ds(align_addr(vm_size, get_page_size_log2())),