Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
nova: support usage of priorities in Genode/Nova
Enables finally the usage of priorities on base-nova.

Fixes #986
  • Loading branch information
alex-ab authored and chelmuth committed Apr 16, 2014
1 parent 9ae441e commit a7bc8ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base-nova/include/nova/syscall-generic.h
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions base-nova/src/core/include/platform_thread.h
Expand Up @@ -44,6 +44,7 @@ namespace Genode {
WORKER = 0x4U,
};
uint8_t _features;
uint8_t _priority;

char _name[Thread_base::Context::NAME_LEN];

Expand Down
2 changes: 1 addition & 1 deletion base-nova/src/core/irq_session_component.cc
Expand Up @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions base-nova/src/core/platform_thread.cc
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit a7bc8ba

Please sign in to comment.