nova: avoid SC kernel warnings in core

Fixes #2073
This commit is contained in:
Alexander Boettcher 2016-08-24 15:18:49 +02:00 committed by Christian Helmuth
parent dea4123053
commit e53ba5ee3e
2 changed files with 23 additions and 21 deletions

View File

@ -44,6 +44,7 @@ namespace Genode {
MAIN_THREAD = 0x1U,
VCPU = 0x2U,
WORKER = 0x4U,
SC_CREATED = 0x8U,
};
uint8_t _features;
uint8_t _priority;
@ -58,6 +59,7 @@ namespace Genode {
inline bool main_thread() const { return _features & MAIN_THREAD; }
inline bool vcpu() const { return _features & VCPU; }
inline bool worker() const { return _features & WORKER; }
inline bool sc_created() const { return _features & SC_CREATED; }
public:

View File

@ -181,7 +181,8 @@ int Platform_thread::start(void *ip, void *sp)
error("create_sc returned ", res);
goto cleanup_ec;
}
} else
_features |= SC_CREATED;
return 0;
@ -210,24 +211,26 @@ void Platform_thread::resume()
{
using namespace Nova;
if (!worker()) {
uint8_t res;
do {
if (!_pd) {
error("protection domain undefined - resuming thread failed");
return;
}
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
} while (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK == _pager->handle_oom());
if (res == NOVA_OK) return;
if (worker() || sc_created()) {
if (_pager)
_pager->wake_up();
return;
}
if (!_pager) return;
uint8_t res;
do {
if (!_pd) {
error("protection domain undefined - resuming thread failed");
return;
}
res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
} while (res == Nova::NOVA_PD_OOM && Nova::NOVA_OK == _pager->handle_oom());
/* Thread was paused beforehand and blocked in pager - wake up pager */
_pager->wake_up();
if (res == NOVA_OK)
_features |= SC_CREATED;
else
error("create_sc failed ", res);
}
@ -315,11 +318,8 @@ unsigned long long Platform_thread::execution_time() const
{
unsigned long long time = 0;
/*
* For local ECs, we simply return 0 as local ECs are executed with the
* time of their callers.
*/
if (worker())
/* for ECs without a SC we simply return 0 */
if (!sc_created())
return time;
uint8_t res = Nova::sc_ctrl(_sel_sc(), time);