nova: support usage of priorities in Genode/Nova

Enables finally the usage of priorities on base-nova.

Fixes #986
This commit is contained in:
Alexander Boettcher 2014-02-10 15:28:12 +01:00 committed by Christian Helmuth
parent 9ae441e469
commit a7bc8bac9a
4 changed files with 10 additions and 6 deletions

View File

@ -404,7 +404,7 @@ namespace Nova {
public:
enum { DEFAULT_QUANTUM = 10000, DEFAULT_PRIORITY = 1 };
enum { DEFAULT_QUANTUM = 10000, DEFAULT_PRIORITY = 64 };
Qpd(mword_t quantum = DEFAULT_QUANTUM,
mword_t priority = DEFAULT_PRIORITY)

View File

@ -44,6 +44,7 @@ namespace Genode {
WORKER = 0x4U,
};
uint8_t _features;
uint8_t _priority;
char _name[Thread_base::Context::NAME_LEN];

View File

@ -98,7 +98,7 @@ class Irq_thread : public Thread_base
/* create SC */
unsigned sc_sel = cap_map()->insert();
res = create_sc(sc_sel, pd_sel, _tid.ec_sel, Qpd());
res = create_sc(sc_sel, pd_sel, _tid.ec_sel, Qpd(Qpd::DEFAULT_QUANTUM, Qpd::DEFAULT_PRIORITY + 1));
if (res != NOVA_OK) {
PERR("%p - create_sc returned returned %d", this, res);
throw Cpu_session::Thread_creation_failed();

View File

@ -154,7 +154,8 @@ int Platform_thread::start(void *ip, void *sp)
_pager->initial_esp((addr_t)sp);
/* let the thread run */
res = create_sc(_sel_sc(), pd_sel, _sel_ec(), Qpd());
res = create_sc(_sel_sc(), pd_sel, _sel_ec(),
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
if (res != NOVA_OK) {
/*
* Reset pd cap since thread got not running and pd cap will
@ -208,7 +209,8 @@ void Platform_thread::resume()
using namespace Nova;
if (!is_worker()) {
uint8_t res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(), Qpd());
uint8_t res = create_sc(_sel_sc(), _pd->pd_sel(), _sel_ec(),
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
if (res == NOVA_OK) return;
}
@ -287,11 +289,12 @@ Weak_ptr<Address_space> Platform_thread::address_space()
}
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id)
Platform_thread::Platform_thread(const char *name, unsigned prio, int thread_id)
:
_pd(0), _pager(0), _id_base(cap_map()->insert(1)),
_sel_exc_base(Native_thread::INVALID_INDEX), _location(boot_cpu(), 0, 0, 0),
_features(0)
_features(0),
_priority(Cpu_session::scale_priority(Nova::Qpd::DEFAULT_PRIORITY, prio))
{
strncpy(_name, name, sizeof(_name));
}