mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-22 01:53:00 +00:00
parent
1c2822fcc4
commit
af3e8725ca
repos
base-foc/src/core
base-hw/src/core
guest_memory.hvm_session_component.ccvm_session_component.h
spec
arm/virtualization
arm_v7/trustzone
x86_64
base-nova/src/core
base-sel4/src/core
base
include/base
src/core/include
gems/src/server/wm
os/src
driver
lib/genode_c_api
server
black_hole
cpu_balancer
event_filter
lx_fs
nic_bridge
nic_dump
nitpicker
vfs
@ -44,7 +44,7 @@ struct Core::Vcpu : Rpc_object<Vm_session::Native_vcpu, Vcpu>
|
||||
private:
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator &_ram_alloc;
|
||||
Accounted_ram_allocator &_ram_alloc;
|
||||
Cap_quota_guard &_cap_alloc;
|
||||
Vcpu_id_allocator &_vcpu_ids;
|
||||
Cap_mapping _recall { true };
|
||||
@ -53,7 +53,7 @@ struct Core::Vcpu : Rpc_object<Vm_session::Native_vcpu, Vcpu>
|
||||
|
||||
public:
|
||||
|
||||
Vcpu(Rpc_entrypoint &, Constrained_ram_allocator &, Cap_quota_guard &,
|
||||
Vcpu(Rpc_entrypoint &, Accounted_ram_allocator &, Cap_quota_guard &,
|
||||
Platform_thread &, Cap_mapping &, Vcpu_id_allocator &);
|
||||
|
||||
~Vcpu();
|
||||
@ -78,11 +78,11 @@ class Core::Vm_session_component
|
||||
{
|
||||
private:
|
||||
|
||||
using Con_ram_allocator = Constrained_ram_allocator;
|
||||
using Con_ram_allocator = Accounted_ram_allocator;
|
||||
using Avl_region = Allocator_avl_tpl<Rm_region>;
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Con_ram_allocator _constrained_md_ram_alloc;
|
||||
Con_ram_allocator _ram;
|
||||
Sliced_heap _heap;
|
||||
Avl_region _map { &_heap };
|
||||
Cap_mapping _task_vcpu { true };
|
||||
|
@ -29,12 +29,12 @@ using namespace Core;
|
||||
struct Vcpu_creation_error : Exception { };
|
||||
|
||||
|
||||
Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
Constrained_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
Platform_thread &thread,
|
||||
Cap_mapping &task_cap,
|
||||
Vcpu_id_allocator &vcpu_alloc)
|
||||
Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
Accounted_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
Platform_thread &thread,
|
||||
Cap_mapping &task_cap,
|
||||
Vcpu_id_allocator &vcpu_alloc)
|
||||
:
|
||||
_ep(ep),
|
||||
_ram_alloc(ram_alloc),
|
||||
@ -99,8 +99,8 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||
Ram_quota_guard(resources.ram_quota),
|
||||
Cap_quota_guard(resources.cap_quota),
|
||||
_ep(ep),
|
||||
_constrained_md_ram_alloc(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_constrained_md_ram_alloc, local_rm)
|
||||
_ram(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_ram, local_rm)
|
||||
{
|
||||
Cap_quota_guard::Reservation caps(_cap_quota_guard(), Cap_quota{1});
|
||||
|
||||
@ -152,7 +152,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
try {
|
||||
vcpu = new (_heap) Registered<Vcpu>(_vcpus,
|
||||
_ep,
|
||||
_constrained_md_ram_alloc,
|
||||
_ram,
|
||||
_cap_quota_guard(),
|
||||
thread->platform_thread(),
|
||||
_task_vcpu,
|
||||
|
@ -218,10 +218,9 @@ class Core::Guest_memory
|
||||
}
|
||||
|
||||
|
||||
Guest_memory(Constrained_ram_allocator &constrained_md_ram_alloc,
|
||||
Region_map ®ion_map)
|
||||
Guest_memory(Accounted_ram_allocator &ram, Region_map ®ion_map)
|
||||
:
|
||||
_sliced_heap(constrained_md_ram_alloc, region_map)
|
||||
_sliced_heap(ram, region_map)
|
||||
{
|
||||
/* configure managed VM area */
|
||||
_map.add_range(0UL, ~0UL);
|
||||
|
@ -102,8 +102,8 @@ Vm_session_component::Vm_session_component(Vmid_allocator & vmid_alloc,
|
||||
Ram_quota_guard(resources.ram_quota),
|
||||
Cap_quota_guard(resources.cap_quota),
|
||||
_ep(ds_ep),
|
||||
_constrained_md_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_sliced_heap(_constrained_md_ram_alloc, region_map),
|
||||
_ram(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_sliced_heap(_ram, region_map),
|
||||
_region_map(region_map),
|
||||
_table(*construct_at<Board::Vm_page_table>(_alloc_table())),
|
||||
_table_array(*(new (cma()) Board::Vm_page_table_array([] (void * virt) {
|
||||
@ -137,7 +137,7 @@ Vm_session_component::~Vm_session_component()
|
||||
Vcpu & vcpu = *_vcpus[i];
|
||||
if (vcpu.ds_cap.valid()) {
|
||||
_region_map.detach(vcpu.ds_addr);
|
||||
_constrained_md_ram_alloc.free(vcpu.ds_cap);
|
||||
_ram.free(vcpu.ds_cap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ Vm_session_component::Vm_session_component(Vmid_allocator &vmids, Rpc_entrypoint
|
||||
Ram_quota_guard(resources.ram_quota),
|
||||
Cap_quota_guard(resources.cap_quota),
|
||||
_ep(ep),
|
||||
_constrained_md_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_sliced_heap(_constrained_md_ram_alloc, region_map),
|
||||
_ram(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_sliced_heap(_ram, region_map),
|
||||
_region_map(region_map),
|
||||
_table(*construct_at<Board::Vm_page_table>(_alloc_table())),
|
||||
_table_array(dummy_array()),
|
||||
@ -104,7 +104,7 @@ Vm_session_component::~Vm_session_component()
|
||||
Vcpu & vcpu = *_vcpus[i];
|
||||
if (vcpu.ds_cap.valid()) {
|
||||
_region_map.detach(vcpu.ds_addr);
|
||||
_constrained_md_ram_alloc.free(vcpu.ds_cap);
|
||||
_ram.free(vcpu.ds_cap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Core::Vcpu : public Rpc_object<Vm_session::Native_vcpu, Vcpu>
|
||||
Rpc_entrypoint &_ep;
|
||||
Vcpu_data _vcpu_data { };
|
||||
Kernel_object<Kernel::Vm> _kobj { };
|
||||
Constrained_ram_allocator &_ram;
|
||||
Accounted_ram_allocator &_ram;
|
||||
Ram_dataspace_capability _ds_cap { };
|
||||
Region_map &_region_map;
|
||||
Affinity::Location _location;
|
||||
@ -55,19 +55,19 @@ class Core::Vcpu : public Rpc_object<Vm_session::Native_vcpu, Vcpu>
|
||||
|
||||
public:
|
||||
|
||||
Vcpu(Kernel::Vm::Identity &id,
|
||||
Rpc_entrypoint &ep,
|
||||
Constrained_ram_allocator &constrained_ram_alloc,
|
||||
Region_map ®ion_map,
|
||||
Affinity::Location location)
|
||||
Vcpu(Kernel::Vm::Identity &id,
|
||||
Rpc_entrypoint &ep,
|
||||
Accounted_ram_allocator &ram,
|
||||
Region_map ®ion_map,
|
||||
Affinity::Location location)
|
||||
:
|
||||
_id(id),
|
||||
_ep(ep),
|
||||
_ram(constrained_ram_alloc),
|
||||
_ram(ram),
|
||||
_ds_cap( {_ram.alloc(vcpu_state_size(), Cache::UNCACHED)} ),
|
||||
_region_map(region_map),
|
||||
_location(location),
|
||||
_vcpu_data_pages(ep, constrained_ram_alloc, region_map)
|
||||
_vcpu_data_pages(ep, ram, region_map)
|
||||
{
|
||||
Region_map::Attr attr { };
|
||||
attr.writeable = true;
|
||||
|
@ -84,7 +84,7 @@ class Core::Svm_session_component
|
||||
Registry<Registered<Vcpu>> _vcpus { };
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator _constrained_ram_alloc;
|
||||
Accounted_ram_allocator _accounted_ram_alloc;
|
||||
Region_map &_region_map;
|
||||
Heap _heap;
|
||||
Phys_allocated<Vm_page_table> _table;
|
||||
@ -120,17 +120,17 @@ class Core::Svm_session_component
|
||||
:
|
||||
Session_object(ds_ep, resources, label, diag),
|
||||
_ep(ds_ep),
|
||||
_constrained_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_accounted_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_region_map(region_map),
|
||||
_heap(_constrained_ram_alloc, region_map),
|
||||
_table(_ep, _constrained_ram_alloc, _region_map),
|
||||
_table_array(_ep, _constrained_ram_alloc, _region_map,
|
||||
_heap(_accounted_ram_alloc, region_map),
|
||||
_table(_ep, _accounted_ram_alloc, _region_map),
|
||||
_table_array(_ep, _accounted_ram_alloc, _region_map,
|
||||
[] (Phys_allocated<Vm_page_table_array> &table_array, auto *obj_ptr) {
|
||||
construct_at<Vm_page_table_array>(obj_ptr, [&] (void *virt) {
|
||||
return table_array.phys_addr() + ((addr_t) obj_ptr - (addr_t)virt);
|
||||
});
|
||||
}),
|
||||
_memory(_constrained_ram_alloc, region_map),
|
||||
_memory(_accounted_ram_alloc, region_map),
|
||||
_vmid_alloc(vmid_alloc),
|
||||
_id({(unsigned)_vmid_alloc.alloc(), (void *)_table.phys_addr()})
|
||||
{ }
|
||||
@ -223,7 +223,7 @@ class Core::Svm_session_component
|
||||
Registered<Vcpu>(_vcpus,
|
||||
_id,
|
||||
_ep,
|
||||
_constrained_ram_alloc,
|
||||
_accounted_ram_alloc,
|
||||
_region_map,
|
||||
vcpu_location);
|
||||
|
||||
|
@ -84,7 +84,7 @@ class Core::Vmx_session_component
|
||||
Registry<Registered<Vcpu>> _vcpus { };
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator _constrained_ram_alloc;
|
||||
Accounted_ram_allocator _accounted_ram_alloc;
|
||||
Region_map &_region_map;
|
||||
Heap _heap;
|
||||
Phys_allocated<Vm_page_table> _table;
|
||||
@ -120,17 +120,17 @@ class Core::Vmx_session_component
|
||||
:
|
||||
Session_object(ds_ep, resources, label, diag),
|
||||
_ep(ds_ep),
|
||||
_constrained_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_accounted_ram_alloc(ram_alloc, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_region_map(region_map),
|
||||
_heap(_constrained_ram_alloc, region_map),
|
||||
_table(_ep, _constrained_ram_alloc, _region_map),
|
||||
_table_array(_ep, _constrained_ram_alloc, _region_map,
|
||||
_heap(_accounted_ram_alloc, region_map),
|
||||
_table(_ep, _accounted_ram_alloc, _region_map),
|
||||
_table_array(_ep, _accounted_ram_alloc, _region_map,
|
||||
[] (Phys_allocated<Vm_page_table_array> &table_array, auto *obj_ptr) {
|
||||
construct_at<Vm_page_table_array>(obj_ptr, [&] (void *virt) {
|
||||
return table_array.phys_addr() + ((addr_t) obj_ptr - (addr_t)virt);
|
||||
});
|
||||
}),
|
||||
_memory(_constrained_ram_alloc, region_map),
|
||||
_memory(_accounted_ram_alloc, region_map),
|
||||
_vmid_alloc(vmid_alloc),
|
||||
_id({(unsigned)_vmid_alloc.alloc(), (void *)_table.phys_addr()})
|
||||
{ }
|
||||
@ -223,7 +223,7 @@ class Core::Vmx_session_component
|
||||
Registered<Vcpu>(_vcpus,
|
||||
_id,
|
||||
_ep,
|
||||
_constrained_ram_alloc,
|
||||
_accounted_ram_alloc,
|
||||
_region_map,
|
||||
vcpu_location);
|
||||
|
||||
|
@ -63,7 +63,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
Vcpu & vcpu = *_vcpus[_vcpu_id_alloc];
|
||||
|
||||
try {
|
||||
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED);
|
||||
vcpu.ds_cap = _ram.alloc(_ds_size(), Cache::UNCACHED);
|
||||
|
||||
Region_map::Attr attr { };
|
||||
attr.writeable = true;
|
||||
@ -72,13 +72,13 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
[&] (Region_map::Attach_error) -> addr_t {
|
||||
error("failed to attach VCPU data within core");
|
||||
if (vcpu.ds_cap.valid())
|
||||
_constrained_md_ram_alloc.free(vcpu.ds_cap);
|
||||
_ram.free(vcpu.ds_cap);
|
||||
_vcpus[_vcpu_id_alloc].destruct();
|
||||
return 0;
|
||||
});
|
||||
} catch (...) {
|
||||
if (vcpu.ds_cap.valid())
|
||||
_constrained_md_ram_alloc.free(vcpu.ds_cap);
|
||||
_ram.free(vcpu.ds_cap);
|
||||
_vcpus[_vcpu_id_alloc].destruct();
|
||||
throw;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class Core::Vm_session_component
|
||||
Constructible<Vcpu> _vcpus[Board::VCPU_MAX];
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator _constrained_md_ram_alloc;
|
||||
Accounted_ram_allocator _ram;
|
||||
Sliced_heap _sliced_heap;
|
||||
Avl_region _map { &_sliced_heap };
|
||||
Region_map &_region_map;
|
||||
|
@ -38,7 +38,7 @@ class Core::Vm_session_component
|
||||
{
|
||||
private:
|
||||
|
||||
using Con_ram_allocator = Constrained_ram_allocator;
|
||||
using Con_ram_allocator = Accounted_ram_allocator;
|
||||
using Avl_region = Allocator_avl_tpl<Rm_region>;
|
||||
|
||||
class Vcpu : public Rpc_object<Vm_session::Native_vcpu, Vcpu>,
|
||||
@ -51,7 +51,7 @@ class Core::Vm_session_component
|
||||
private:
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator &_ram_alloc;
|
||||
Accounted_ram_allocator &_ram_alloc;
|
||||
Cap_quota_guard &_cap_alloc;
|
||||
Trace::Source_registry &_trace_sources;
|
||||
addr_t _sel_sm_ec_sc;
|
||||
@ -92,7 +92,7 @@ class Core::Vm_session_component
|
||||
public:
|
||||
|
||||
Vcpu(Rpc_entrypoint &,
|
||||
Constrained_ram_allocator &ram_alloc,
|
||||
Accounted_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
unsigned id,
|
||||
unsigned kernel_id,
|
||||
@ -129,7 +129,7 @@ class Core::Vm_session_component
|
||||
Rpc_entrypoint &_ep;
|
||||
Trace::Control_area _trace_control_area;
|
||||
Trace::Source_registry &_trace_sources;
|
||||
Con_ram_allocator _constrained_md_ram_alloc;
|
||||
Con_ram_allocator _ram;
|
||||
Sliced_heap _heap;
|
||||
Avl_region _map { &_heap };
|
||||
addr_t _pd_sel { 0 };
|
||||
|
@ -139,7 +139,7 @@ void Vm_session_component::Vcpu::exit_handler(unsigned const exit,
|
||||
|
||||
|
||||
Vm_session_component::Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
Constrained_ram_allocator &ram_alloc,
|
||||
Accounted_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
unsigned const id,
|
||||
unsigned const kernel_id,
|
||||
@ -329,7 +329,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
Vcpu &vcpu =
|
||||
*new (_heap) Registered<Vcpu>(_vcpus,
|
||||
_ep,
|
||||
_constrained_md_ram_alloc,
|
||||
_ram,
|
||||
_cap_quota_guard(),
|
||||
vcpu_id,
|
||||
(unsigned)kernel_cpu_id,
|
||||
@ -363,8 +363,8 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||
Cap_quota_guard(resources.cap_quota),
|
||||
_ep(ep),
|
||||
_trace_control_area(ram, local_rm), _trace_sources(trace_sources),
|
||||
_constrained_md_ram_alloc(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_constrained_md_ram_alloc, local_rm),
|
||||
_ram(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_ram, local_rm),
|
||||
_priority(scale_priority(priority, "VM session")),
|
||||
_session_label(label)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class Core::Vm_session_component
|
||||
private:
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator &_ram_alloc;
|
||||
Accounted_ram_allocator &_ram_alloc;
|
||||
Ram_dataspace_capability const _ds_cap;
|
||||
Cap_sel _notification { 0 };
|
||||
|
||||
@ -49,7 +49,7 @@ class Core::Vm_session_component
|
||||
|
||||
public:
|
||||
|
||||
Vcpu(Rpc_entrypoint &, Constrained_ram_allocator &,
|
||||
Vcpu(Rpc_entrypoint &, Accounted_ram_allocator &,
|
||||
Cap_quota_guard &, seL4_Untyped);
|
||||
|
||||
~Vcpu();
|
||||
@ -65,14 +65,14 @@ class Core::Vm_session_component
|
||||
|
||||
using Avl_region = Allocator_avl_tpl<Rm_region>;
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator _constrained_md_ram_alloc;
|
||||
Heap _heap;
|
||||
Avl_region _map { &_heap };
|
||||
unsigned _pd_id { 0 };
|
||||
Cap_sel _vm_page_table;
|
||||
Page_table_registry _page_table_registry { _heap };
|
||||
Vm_space _vm_space;
|
||||
Rpc_entrypoint &_ep;
|
||||
Accounted_ram_allocator _ram;
|
||||
Heap _heap;
|
||||
Avl_region _map { &_heap };
|
||||
unsigned _pd_id { 0 };
|
||||
Cap_sel _vm_page_table;
|
||||
Page_table_registry _page_table_registry { _heap };
|
||||
Vm_space _vm_space;
|
||||
struct {
|
||||
addr_t _phys;
|
||||
seL4_Untyped _service;
|
||||
|
@ -44,10 +44,10 @@ void Vm_session_component::Vcpu::_free_up()
|
||||
}
|
||||
|
||||
|
||||
Vm_session_component::Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
Constrained_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
seL4_Untyped const service)
|
||||
Vm_session_component::Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
Accounted_ram_allocator &ram_alloc,
|
||||
Cap_quota_guard &cap_alloc,
|
||||
seL4_Untyped const service)
|
||||
:
|
||||
_ep(ep),
|
||||
_ram_alloc(ram_alloc),
|
||||
@ -97,8 +97,8 @@ try
|
||||
Ram_quota_guard(resources.ram_quota),
|
||||
Cap_quota_guard(resources.cap_quota),
|
||||
_ep(ep),
|
||||
_constrained_md_ram_alloc(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_constrained_md_ram_alloc, local_rm),
|
||||
_ram(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_heap(_ram, local_rm),
|
||||
_pd_id((uint32_t)Platform_pd::pd_id_alloc().alloc()),
|
||||
_vm_page_table(platform_specific().core_sel_alloc().alloc()),
|
||||
_vm_space(_vm_page_table,
|
||||
@ -212,7 +212,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
try {
|
||||
vcpu = new (_heap) Registered<Vcpu>(_vcpus,
|
||||
_ep,
|
||||
_constrained_md_ram_alloc,
|
||||
_ram,
|
||||
_cap_quota_guard(),
|
||||
_notifications._service);
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace Genode {
|
||||
|
||||
struct Ram_allocator;
|
||||
|
||||
class Constrained_ram_allocator;
|
||||
class Accounted_ram_allocator;
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ struct Genode::Ram_allocator : Interface, Noncopyable
|
||||
/**
|
||||
* Quota-bounds-checking wrapper of the 'Ram_allocator' interface
|
||||
*/
|
||||
class Genode::Constrained_ram_allocator : public Ram_allocator
|
||||
class Genode::Accounted_ram_allocator : public Ram_allocator
|
||||
{
|
||||
private:
|
||||
|
||||
@ -108,9 +108,9 @@ class Genode::Constrained_ram_allocator : public Ram_allocator
|
||||
|
||||
public:
|
||||
|
||||
Constrained_ram_allocator(Ram_allocator &ram_alloc,
|
||||
Ram_quota_guard &ram_guard,
|
||||
Cap_quota_guard &cap_guard)
|
||||
Accounted_ram_allocator(Ram_allocator &ram_alloc,
|
||||
Ram_quota_guard &ram_guard,
|
||||
Cap_quota_guard &cap_guard)
|
||||
:
|
||||
_ram_alloc(ram_alloc), _ram_guard(ram_guard), _cap_guard(cap_guard)
|
||||
{ }
|
||||
|
@ -12,8 +12,8 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _CORE__INCLUDE__CORE_CONSTRAINED_CORE_RAM_H_
|
||||
#define _CORE__INCLUDE__CORE_CONSTRAINED_CORE_RAM_H_
|
||||
#ifndef _CORE__INCLUDE__ACCOUNTED_CORE_RAM_H_
|
||||
#define _CORE__INCLUDE__ACCOUNTED_CORE_RAM_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
@ -21,10 +21,10 @@
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core { class Constrained_core_ram; }
|
||||
namespace Core { class Accounted_core_ram; }
|
||||
|
||||
|
||||
class Core::Constrained_core_ram : public Allocator
|
||||
class Core::Accounted_core_ram : public Allocator
|
||||
{
|
||||
private:
|
||||
|
||||
@ -36,14 +36,14 @@ class Core::Constrained_core_ram : public Allocator
|
||||
|
||||
public:
|
||||
|
||||
Constrained_core_ram(Ram_quota_guard &ram_guard,
|
||||
Cap_quota_guard &cap_guard,
|
||||
Range_allocator &core_mem)
|
||||
Accounted_core_ram(Ram_quota_guard &ram_guard,
|
||||
Cap_quota_guard &cap_guard,
|
||||
Range_allocator &core_mem)
|
||||
:
|
||||
_ram_guard(ram_guard), _cap_guard(cap_guard), _core_mem(core_mem)
|
||||
{ }
|
||||
|
||||
~Constrained_core_ram()
|
||||
~Accounted_core_ram()
|
||||
{
|
||||
if (!core_mem_allocated)
|
||||
return;
|
||||
@ -90,4 +90,4 @@ class Core::Constrained_core_ram : public Allocator
|
||||
size_t overhead(size_t) const override { return 0; }
|
||||
bool need_size_for_free() const override { return true; }
|
||||
};
|
||||
#endif /* _CORE__INCLUDE__CORE_CONSTRAINED_CORE_RAM_H_ */
|
||||
#endif /* _CORE__INCLUDE__ACCOUNTED_CORE_RAM_H_ */
|
@ -44,7 +44,7 @@ class Core::Cpu_session_component : public Session_object<Cpu_session>,
|
||||
Rpc_entrypoint &_thread_ep;
|
||||
Pager_entrypoint &_pager_ep;
|
||||
Region_map &_local_rm;
|
||||
Constrained_ram_allocator _ram_alloc;
|
||||
Accounted_ram_allocator _ram_alloc;
|
||||
Sliced_heap _md_alloc; /* guarded meta-data allocator */
|
||||
Cpu_thread_allocator _thread_alloc; /* meta-data allocator */
|
||||
Mutex _thread_alloc_lock { }; /* protect allocator access */
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <base/internal/stack_area.h>
|
||||
|
||||
/* core includes */
|
||||
#include <constrained_core_ram.h>
|
||||
#include <accounted_core_ram.h>
|
||||
#include <platform_pd.h>
|
||||
#include <signal_broker.h>
|
||||
#include <system_control.h>
|
||||
@ -57,16 +57,16 @@ class Core::Pd_session_component : public Session_object<Pd_session>
|
||||
Constructible<Account<Cap_quota> > _cap_account { };
|
||||
Constructible<Account<Ram_quota> > _ram_account { };
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Core::System_control &_system_control;
|
||||
Constrained_ram_allocator _constrained_md_ram_alloc;
|
||||
Constrained_core_ram _constrained_core_ram_alloc;
|
||||
Sliced_heap _sliced_heap;
|
||||
Capability<Parent> _parent { };
|
||||
Ram_dataspace_factory _ram_ds_factory;
|
||||
Signal_broker _signal_broker;
|
||||
Rpc_cap_factory _rpc_cap_factory;
|
||||
Native_pd_component _native_pd;
|
||||
Rpc_entrypoint &_ep;
|
||||
Core::System_control &_system_control;
|
||||
Accounted_ram_allocator _accounted_md_ram_alloc;
|
||||
Accounted_core_ram _accounted_core_ram_alloc;
|
||||
Sliced_heap _sliced_heap;
|
||||
Capability<Parent> _parent { };
|
||||
Ram_dataspace_factory _ram_ds_factory;
|
||||
Signal_broker _signal_broker;
|
||||
Rpc_cap_factory _rpc_cap_factory;
|
||||
Native_pd_component _native_pd;
|
||||
|
||||
Constructible<Platform_pd> _pd { };
|
||||
|
||||
@ -148,11 +148,11 @@ class Core::Pd_session_component : public Session_object<Pd_session>
|
||||
Session_object(ep, resources, label, diag),
|
||||
_ep(ep),
|
||||
_system_control(system_control),
|
||||
_constrained_md_ram_alloc(*this, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_constrained_core_ram_alloc(_ram_quota_guard(), _cap_quota_guard(), core_mem),
|
||||
_sliced_heap(_constrained_md_ram_alloc, local_rm),
|
||||
_accounted_md_ram_alloc(*this, _ram_quota_guard(), _cap_quota_guard()),
|
||||
_accounted_core_ram_alloc(_ram_quota_guard(), _cap_quota_guard(), core_mem),
|
||||
_sliced_heap(_accounted_md_ram_alloc, local_rm),
|
||||
_ram_ds_factory(ep, phys_alloc, phys_range,
|
||||
_constrained_core_ram_alloc),
|
||||
_accounted_core_ram_alloc),
|
||||
_signal_broker(_sliced_heap, signal_ep, signal_ep),
|
||||
_rpc_cap_factory(_sliced_heap),
|
||||
_native_pd(*this, args),
|
||||
|
@ -30,10 +30,10 @@ class Core::Rm_session_component : public Session_object<Rm_session>
|
||||
{
|
||||
private:
|
||||
|
||||
Rpc_entrypoint &_ep;
|
||||
Constrained_ram_allocator _ram_alloc;
|
||||
Sliced_heap _md_alloc;
|
||||
Pager_entrypoint &_pager_ep;
|
||||
Rpc_entrypoint &_ep;
|
||||
Accounted_ram_allocator _ram_alloc;
|
||||
Sliced_heap _md_alloc;
|
||||
Pager_entrypoint &_pager_ep;
|
||||
|
||||
Mutex _region_maps_lock { };
|
||||
List<Region_map_component> _region_maps { };
|
||||
|
@ -35,7 +35,7 @@ class Core::Trace::Session_component
|
||||
{
|
||||
private:
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
Region_map &_local_rm;
|
||||
Sliced_heap _md_alloc { _ram, _local_rm };
|
||||
Tslab<Trace::Subject, 4096> _subjects_slab;
|
||||
|
@ -77,7 +77,7 @@ struct Wm::Decorator_gui_session : Session_object<Gui::Session>,
|
||||
|
||||
Env &_env;
|
||||
|
||||
Constrained_ram_allocator _ram { _env.ram(), _ram_quota_guard(), _cap_quota_guard() };
|
||||
Accounted_ram_allocator _ram { _env.ram(), _ram_quota_guard(), _cap_quota_guard() };
|
||||
|
||||
Sliced_heap _session_alloc { _ram, _env.rm() };
|
||||
|
||||
|
@ -544,7 +544,7 @@ class Wm::Gui::Session_component : public Session_object<Gui::Session>,
|
||||
Env &_env;
|
||||
Action &_action;
|
||||
|
||||
Constrained_ram_allocator _ram {
|
||||
Accounted_ram_allocator _ram {
|
||||
_env.ram(), _ram_quota_guard(), _cap_quota_guard() };
|
||||
|
||||
Sliced_heap _session_alloc { _ram, _env.rm() };
|
||||
|
@ -1851,7 +1851,7 @@ class Gpu::Session_component : public Genode::Session_object<Gpu::Session>
|
||||
|
||||
Genode::Env &_env;
|
||||
Genode::Region_map &_rm;
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
Igd::Device &_device;
|
||||
Heap _heap { _device._pci_backend_alloc, _rm };
|
||||
/* used to mark ownership of an allocated VRAM object */
|
||||
|
@ -333,22 +333,24 @@ Session_component::alloc_dma_buffer(size_t const size, Cache cache)
|
||||
{
|
||||
struct Guard {
|
||||
|
||||
Constrained_ram_allocator & _env_ram;
|
||||
Heap & _heap;
|
||||
Io_mmu_domain_registry & _domain_registry;
|
||||
bool _cleanup { true };
|
||||
Accounted_ram_allocator &_env_ram;
|
||||
Heap &_heap;
|
||||
Io_mmu_domain_registry &_domain_registry;
|
||||
bool _cleanup { true };
|
||||
|
||||
Ram_dataspace_capability ram_cap { };
|
||||
|
||||
Ram_dataspace_capability ram_cap { };
|
||||
struct {
|
||||
Dma_buffer * buf { nullptr };
|
||||
Dma_buffer * buf { nullptr };
|
||||
};
|
||||
|
||||
void disarm() { _cleanup = false; }
|
||||
|
||||
Guard(Constrained_ram_allocator & env_ram,
|
||||
Heap & heap,
|
||||
Io_mmu_domain_registry & registry)
|
||||
: _env_ram(env_ram), _heap(heap), _domain_registry(registry)
|
||||
Guard(Accounted_ram_allocator &env_ram,
|
||||
Heap &heap,
|
||||
Io_mmu_domain_registry ®istry)
|
||||
:
|
||||
_env_ram(env_ram), _heap(heap), _domain_registry(registry)
|
||||
{ }
|
||||
|
||||
~Guard()
|
||||
@ -455,7 +457,7 @@ Session_component::Session_component(Env & env,
|
||||
* exceptions resp. does not account costs for the ROM
|
||||
* dataspace to the client for the moment, we cannot do
|
||||
* so in the dynamic rom session, and cannot use the
|
||||
* constrained ram allocator within it. Therefore,
|
||||
* accounted ram allocator within it. Therefore,
|
||||
* we account the costs here until the ROM session interface
|
||||
* changes.
|
||||
*/
|
||||
|
@ -121,7 +121,7 @@ class Driver::Session_component
|
||||
Io_mmu_devices & _io_mmu_devices;
|
||||
Registry<Irq_controller> & _irq_controller_registry;
|
||||
Device::Owner _owner_id { *this };
|
||||
Constrained_ram_allocator _env_ram { _env.pd(),
|
||||
Accounted_ram_allocator _env_ram { _env.pd(),
|
||||
_ram_quota_guard(),
|
||||
_cap_quota_guard() };
|
||||
Heap _md_alloc { _env_ram, _env.rm() };
|
||||
|
@ -530,7 +530,7 @@ class Session_component
|
||||
genode_shared_dataspace_free_t _free_fn;
|
||||
genode_usb_dev_release_t _release_fn;
|
||||
|
||||
Constrained_ram_allocator _env_ram { _env.pd(),
|
||||
Accounted_ram_allocator _env_ram { _env.pd(),
|
||||
_ram_quota_guard(),
|
||||
_cap_quota_guard() };
|
||||
Heap _heap { _env_ram, _env.rm() };
|
||||
|
@ -37,7 +37,7 @@ class Capture::Session_component : public Session_object<Capture::Session>
|
||||
|
||||
Env &_env;
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Constructible<Attached_ram_dataspace> _buffer { };
|
||||
|
||||
|
@ -33,7 +33,7 @@ public Session_object<Event::Session, Event_session>
|
||||
{
|
||||
private:
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Attached_ram_dataspace _ds;
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace Cpu {
|
||||
using Client_id = Id_space<Parent::Client>::Element;
|
||||
using Child_list = Registry<Registered<Session> >;
|
||||
using Thread_list = Registry<Registered<Thread_client> >;
|
||||
using Ram_allocator = Constrained_ram_allocator;
|
||||
using Ram_allocator = Accounted_ram_allocator;
|
||||
}
|
||||
|
||||
struct Cpu::Thread_client : Interface
|
||||
|
@ -42,7 +42,7 @@ class Event_filter::Event_session : public Session_object<Event::Session, Event_
|
||||
|
||||
Source::Trigger &_trigger;
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Attached_ram_dataspace _ds;
|
||||
|
||||
|
@ -64,11 +64,11 @@ class Lx_fs::Session_resources
|
||||
{
|
||||
protected:
|
||||
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Constrained_ram_allocator _ram_alloc;
|
||||
Genode::Attached_ram_dataspace _packet_ds;
|
||||
Genode::Heap _alloc;
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Accounted_ram_allocator _ram_alloc;
|
||||
Genode::Attached_ram_dataspace _packet_ds;
|
||||
Genode::Heap _alloc;
|
||||
|
||||
Session_resources(Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
|
@ -51,11 +51,11 @@ class Net::Stream_allocator
|
||||
{
|
||||
protected:
|
||||
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Constrained_ram_allocator _ram;
|
||||
Genode::Heap _heap;
|
||||
::Nic::Packet_allocator _range_alloc;
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Accounted_ram_allocator _ram;
|
||||
Genode::Heap _heap;
|
||||
::Nic::Packet_allocator _range_alloc;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -53,13 +53,13 @@ class Net::Session_component_base
|
||||
{
|
||||
protected:
|
||||
|
||||
Genode::Ram_quota_guard _ram_quota_guard;
|
||||
Genode::Cap_quota_guard _cap_quota_guard;
|
||||
Genode::Constrained_ram_allocator _ram;
|
||||
Genode::Sliced_heap _alloc;
|
||||
Nic::Packet_allocator _range_alloc;
|
||||
Communication_buffer _tx_buf;
|
||||
Communication_buffer _rx_buf;
|
||||
Genode::Ram_quota_guard _ram_quota_guard;
|
||||
Genode::Cap_quota_guard _cap_quota_guard;
|
||||
Genode::Accounted_ram_allocator _ram;
|
||||
Genode::Sliced_heap _alloc;
|
||||
Nic::Packet_allocator _range_alloc;
|
||||
Communication_buffer _tx_buf;
|
||||
Communication_buffer _rx_buf;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -90,7 +90,7 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
|
||||
|
||||
Env &_env;
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Handler &_handler;
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Nitpicker::Event_session : public Session_object<Event::Session, Event_ses
|
||||
|
||||
Handler &_handler;
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Attached_ram_dataspace _ds;
|
||||
|
||||
|
@ -103,7 +103,7 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
|
||||
Env &_env;
|
||||
Action &_action;
|
||||
|
||||
Constrained_ram_allocator _ram;
|
||||
Accounted_ram_allocator _ram;
|
||||
|
||||
Resizeable_texture<Pixel> _texture { };
|
||||
|
||||
|
@ -59,11 +59,11 @@ class Vfs_server::Session_resources
|
||||
{
|
||||
protected:
|
||||
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Constrained_ram_allocator _ram_alloc;
|
||||
Genode::Attached_ram_dataspace _packet_ds;
|
||||
Genode::Heap _alloc;
|
||||
Genode::Ram_quota_guard _ram_guard;
|
||||
Genode::Cap_quota_guard _cap_guard;
|
||||
Genode::Accounted_ram_allocator _ram_alloc;
|
||||
Genode::Attached_ram_dataspace _packet_ds;
|
||||
Genode::Heap _alloc;
|
||||
|
||||
Session_resources(Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
|
Loading…
x
Reference in New Issue
Block a user