mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
nova: support usage of priorities in Genode/Nova
Enables finally the usage of priorities on base-nova. Fixes #986
This commit is contained in:
parent
9ae441e469
commit
a7bc8bac9a
@ -404,7 +404,7 @@ namespace Nova {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum { DEFAULT_QUANTUM = 10000, DEFAULT_PRIORITY = 1 };
|
enum { DEFAULT_QUANTUM = 10000, DEFAULT_PRIORITY = 64 };
|
||||||
|
|
||||||
Qpd(mword_t quantum = DEFAULT_QUANTUM,
|
Qpd(mword_t quantum = DEFAULT_QUANTUM,
|
||||||
mword_t priority = DEFAULT_PRIORITY)
|
mword_t priority = DEFAULT_PRIORITY)
|
||||||
|
@ -44,6 +44,7 @@ namespace Genode {
|
|||||||
WORKER = 0x4U,
|
WORKER = 0x4U,
|
||||||
};
|
};
|
||||||
uint8_t _features;
|
uint8_t _features;
|
||||||
|
uint8_t _priority;
|
||||||
|
|
||||||
char _name[Thread_base::Context::NAME_LEN];
|
char _name[Thread_base::Context::NAME_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class Irq_thread : public Thread_base
|
|||||||
|
|
||||||
/* create SC */
|
/* create SC */
|
||||||
unsigned sc_sel = cap_map()->insert();
|
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) {
|
if (res != NOVA_OK) {
|
||||||
PERR("%p - create_sc returned returned %d", this, res);
|
PERR("%p - create_sc returned returned %d", this, res);
|
||||||
throw Cpu_session::Thread_creation_failed();
|
throw Cpu_session::Thread_creation_failed();
|
||||||
|
@ -154,7 +154,8 @@ int Platform_thread::start(void *ip, void *sp)
|
|||||||
_pager->initial_esp((addr_t)sp);
|
_pager->initial_esp((addr_t)sp);
|
||||||
|
|
||||||
/* let the thread run */
|
/* 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) {
|
if (res != NOVA_OK) {
|
||||||
/*
|
/*
|
||||||
* Reset pd cap since thread got not running and pd cap will
|
* Reset pd cap since thread got not running and pd cap will
|
||||||
@ -208,7 +209,8 @@ void Platform_thread::resume()
|
|||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
|
|
||||||
if (!is_worker()) {
|
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;
|
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)),
|
_pd(0), _pager(0), _id_base(cap_map()->insert(1)),
|
||||||
_sel_exc_base(Native_thread::INVALID_INDEX), _location(boot_cpu(), 0, 0, 0),
|
_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));
|
strncpy(_name, name, sizeof(_name));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user