mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 18:06:50 +00:00
parent
57f47db823
commit
66b7a01d58
@ -156,6 +156,9 @@ namespace Genode {
|
|||||||
unsigned long badge() const { return _badge; }
|
unsigned long badge() const { return _badge; }
|
||||||
void reset_badge() { _badge = 0; }
|
void reset_badge() { _badge = 0; }
|
||||||
|
|
||||||
|
const char * client_thread() const;
|
||||||
|
const char * client_pd() const;
|
||||||
|
|
||||||
virtual int pager(Ipc_pager &ps) = 0;
|
virtual int pager(Ipc_pager &ps) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +34,7 @@ namespace Genode {
|
|||||||
Native_capability _parent;
|
Native_capability _parent;
|
||||||
int _thread_cnt;
|
int _thread_cnt;
|
||||||
addr_t _pd_sel;
|
addr_t _pd_sel;
|
||||||
|
const char * _label;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -90,6 +91,13 @@ namespace Genode {
|
|||||||
static addr_t pd_core_sel() { return __core_pd_sel; }
|
static addr_t pd_core_sel() { return __core_pd_sel; }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label of this protection domain
|
||||||
|
*
|
||||||
|
* \return name of this protection domain
|
||||||
|
*/
|
||||||
|
const char * name() const { return _label; }
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
** Address-space interface **
|
** Address-space interface **
|
||||||
*****************************/
|
*****************************/
|
||||||
|
@ -146,7 +146,7 @@ namespace Genode {
|
|||||||
/**
|
/**
|
||||||
* Return identification of thread when faulting
|
* Return identification of thread when faulting
|
||||||
*/
|
*/
|
||||||
unsigned long pager_object_badge() const;
|
unsigned long pager_object_badge() { return (unsigned long)this; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the executing CPU for this thread
|
* Set the executing CPU for this thread
|
||||||
@ -161,7 +161,12 @@ namespace Genode {
|
|||||||
/**
|
/**
|
||||||
* Get thread name
|
* Get thread name
|
||||||
*/
|
*/
|
||||||
const char *name() const { return "noname"; }
|
const char *name() const { return _name.string(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pd name
|
||||||
|
*/
|
||||||
|
const char *pd_name() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate thread with protection domain
|
* Associate thread with protection domain
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
/* base-internal includes */
|
/* base-internal includes */
|
||||||
#include <base/internal/page_size.h>
|
#include <base/internal/page_size.h>
|
||||||
|
#include <platform_thread.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
@ -39,11 +40,12 @@ namespace Genode {
|
|||||||
Region_map::State::Fault_type pf_type,
|
Region_map::State::Fault_type pf_type,
|
||||||
unsigned long faulter_badge)
|
unsigned long faulter_badge)
|
||||||
{
|
{
|
||||||
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx %s)\n", msg,
|
Platform_thread * faulter = reinterpret_cast<Platform_thread *>(faulter_badge);
|
||||||
|
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx '%s':'%s')\n", msg,
|
||||||
pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ",
|
pf_type == Region_map::State::WRITE_FAULT ? "WRITE" : "READ",
|
||||||
(void *)pf_addr, (void *)pf_ip,
|
(void *)pf_addr, (void *)pf_ip,
|
||||||
faulter_badge,
|
faulter_badge, faulter ? faulter->pd_name() : "unknown",
|
||||||
faulter_badge ? reinterpret_cast<char *>(faulter_badge) : 0);
|
faulter ? faulter->name() : "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
/* core-local includes */
|
/* core-local includes */
|
||||||
#include <pager.h>
|
#include <pager.h>
|
||||||
|
#include <platform_thread.h>
|
||||||
#include <imprint_badge.h>
|
#include <imprint_badge.h>
|
||||||
|
|
||||||
/* NOVA includes */
|
/* NOVA includes */
|
||||||
@ -100,12 +101,14 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
|
|||||||
|
|
||||||
obj->_state_lock.unlock();
|
obj->_state_lock.unlock();
|
||||||
|
|
||||||
char const * client = reinterpret_cast<char const *>(obj->_badge);
|
const char * client_thread = obj->client_thread();
|
||||||
|
const char * client_pd = obj->client_pd();
|
||||||
|
|
||||||
/* region manager fault - to be handled */
|
/* region manager fault - to be handled */
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
PDBG("page fault, thread '%s', cpu %u, ip=%lx, fault address=0x%lx",
|
PDBG("page fault, pd '%s', thread '%s', cpu %u, ip=%lx, fault "
|
||||||
client, which_cpu(pager_thread), ipc_pager.fault_ip(),
|
"address=0x%lx", client_pd, client_thread, which_cpu(pager_thread),
|
||||||
ipc_pager.fault_addr());
|
ipc_pager.fault_ip(), ipc_pager.fault_addr());
|
||||||
|
|
||||||
utcb->set_msg_word(0);
|
utcb->set_msg_word(0);
|
||||||
utcb->mtd = 0;
|
utcb->mtd = 0;
|
||||||
@ -117,9 +120,10 @@ void Pager_object::_page_fault_handler(addr_t pager_obj)
|
|||||||
/* unhandled case */
|
/* unhandled case */
|
||||||
obj->_state.mark_dead();
|
obj->_state.mark_dead();
|
||||||
|
|
||||||
PWRN("unresolvable page fault, thread '%s', cpu %u, ip=%lx, "
|
PWRN("unresolvable page fault, pd '%s', thread '%s', cpu %u, ip=%lx, "
|
||||||
"fault address=0x%lx ret=%u", client, which_cpu(pager_thread),
|
"fault address=0x%lx ret=%u", client_pd, client_thread,
|
||||||
ipc_pager.fault_ip(), ipc_pager.fault_addr(), ret);
|
which_cpu(pager_thread), ipc_pager.fault_ip(), ipc_pager.fault_addr(),
|
||||||
|
ret);
|
||||||
|
|
||||||
Native_capability pager_cap = obj->Object_pool<Pager_object>::Entry::cap();
|
Native_capability pager_cap = obj->Object_pool<Pager_object>::Entry::cap();
|
||||||
revoke(pager_cap.dst());
|
revoke(pager_cap.dst());
|
||||||
@ -159,9 +163,9 @@ void Pager_object::exception(uint8_t exit_id)
|
|||||||
/* nobody handles this exception - so thread will be stopped finally */
|
/* nobody handles this exception - so thread will be stopped finally */
|
||||||
_state.mark_dead();
|
_state.mark_dead();
|
||||||
|
|
||||||
char const * client = reinterpret_cast<char const *>(_badge);
|
PWRN("unresolvable exception %u, pd '%s', thread '%s', cpu %u, "
|
||||||
PWRN("unresolvable exception %u, thread '%s', cpu %u, ip=0x%lx, %s",
|
"ip=0x%lx, %s", exit_id, client_pd(), client_thread(),
|
||||||
exit_id, client, which_cpu(pager_thread), fault_ip,
|
which_cpu(pager_thread), fault_ip,
|
||||||
res == 0xFF ? "no signal handler" :
|
res == 0xFF ? "no signal handler" :
|
||||||
(res == NOVA_OK ? "" : "recall failed"));
|
(res == NOVA_OK ? "" : "recall failed"));
|
||||||
|
|
||||||
@ -638,8 +642,8 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
|
|||||||
char const * src_pd, char const * src_thread,
|
char const * src_pd, char const * src_thread,
|
||||||
enum Pager_object::Policy policy)
|
enum Pager_object::Policy policy)
|
||||||
{
|
{
|
||||||
const char * dst_pd = "unknown";
|
const char * dst_pd = client_pd();
|
||||||
const char * dst_thread = reinterpret_cast<char *>(badge());
|
const char * dst_thread = client_thread();
|
||||||
|
|
||||||
enum { QUOTA_TRANSFER_PAGES = 2 };
|
enum { QUOTA_TRANSFER_PAGES = 2 };
|
||||||
|
|
||||||
@ -655,8 +659,8 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
|
|||||||
/* request current kernel quota usage of source pd */
|
/* request current kernel quota usage of source pd */
|
||||||
Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source);
|
Nova::pd_ctrl_debug(transfer_from, limit_source, usage_source);
|
||||||
|
|
||||||
PINF("oom - '%s:%s' (%lu/%lu) - transfer %u pages from '%s:%s' (%lu/%lu)",
|
PINF("oom - '%s':'%s' (%lu/%lu) - transfer %u pages from '%s':'%s' "
|
||||||
dst_pd, dst_thread,
|
"(%lu/%lu)", dst_pd, dst_thread,
|
||||||
usage_before, limit_before, QUOTA_TRANSFER_PAGES,
|
usage_before, limit_before, QUOTA_TRANSFER_PAGES,
|
||||||
src_pd, src_thread, usage_source, limit_source);
|
src_pd, src_thread, usage_source, limit_source);
|
||||||
}
|
}
|
||||||
@ -682,7 +686,7 @@ uint8_t Pager_object::handle_oom(addr_t transfer_from,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PWRN("kernel memory quota upgrade failed - trigger memory free up for "
|
PWRN("kernel memory quota upgrade failed - trigger memory free up for "
|
||||||
"causing '%s:%s' - donator is '%s:%s', policy=%u",
|
"causing '%s':'%s' - donator is '%s':'%s', policy=%u",
|
||||||
dst_pd, dst_thread, src_pd, src_thread, policy);
|
dst_pd, dst_thread, src_pd, src_thread, policy);
|
||||||
|
|
||||||
/* if nothing helps try to revoke memory */
|
/* if nothing helps try to revoke memory */
|
||||||
@ -797,8 +801,8 @@ void Pager_object::_oom_handler(addr_t pager_dst, addr_t pager_src,
|
|||||||
transfer_from = __core_pd_sel;
|
transfer_from = __core_pd_sel;
|
||||||
else {
|
else {
|
||||||
/* delegation of items between different PDs */
|
/* delegation of items between different PDs */
|
||||||
src_pd = "unknown";
|
src_pd = obj_src->client_pd();
|
||||||
src_thread = reinterpret_cast<char *>(obj_src->badge());
|
src_thread = obj_src->client_thread();
|
||||||
transfer_from = obj_src->pd_sel();
|
transfer_from = obj_src->pd_sel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -842,6 +846,19 @@ addr_t Pager_object::get_oom_portal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char * Pager_object::client_thread() const
|
||||||
|
{
|
||||||
|
Platform_thread * client = reinterpret_cast<Platform_thread *>(_badge);
|
||||||
|
return client ? client->name() : "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char * Pager_object::client_pd() const
|
||||||
|
{
|
||||||
|
Platform_thread * client = reinterpret_cast<Platform_thread *>(_badge);
|
||||||
|
return client ? client->pd_name() : "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
** Pager activation **
|
** Pager activation **
|
||||||
**********************/
|
**********************/
|
||||||
|
@ -46,9 +46,9 @@ void Platform_pd::assign_parent(Native_capability parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Platform_pd::Platform_pd(Allocator * md_alloc, char const *,
|
Platform_pd::Platform_pd(Allocator * md_alloc, char const *label,
|
||||||
signed pd_id, bool create)
|
signed pd_id, bool create)
|
||||||
: _thread_cnt(0), _pd_sel(Native_thread::INVALID_INDEX) { }
|
: _thread_cnt(0), _pd_sel(Native_thread::INVALID_INDEX), _label(label) { }
|
||||||
|
|
||||||
|
|
||||||
Platform_pd::~Platform_pd()
|
Platform_pd::~Platform_pd()
|
||||||
|
@ -298,12 +298,8 @@ void Platform_thread::single_step(bool on)
|
|||||||
_pager->single_step(on);
|
_pager->single_step(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * Platform_thread::pd_name() const {
|
||||||
unsigned long Platform_thread::pager_object_badge() const
|
return _pd ? _pd->name() : "unknown"; }
|
||||||
{
|
|
||||||
return reinterpret_cast<unsigned long>(_name.string());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Weak_ptr<Address_space> Platform_thread::address_space()
|
Weak_ptr<Address_space> Platform_thread::address_space()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user