Message type for SCHEDULING_{START,INHERIT}

Change-Id: Iad2b4079f72488ea3c3abef2b4a4fefe26ae9066
This commit is contained in:
Lionel Sambuc 2014-05-14 17:57:12 +02:00
parent b694a09a53
commit 9f350d76ef
4 changed files with 39 additions and 30 deletions

View file

@ -1002,22 +1002,10 @@
#define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1)
/* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
# define SCHEDULING_ENDPOINT m9_l1
# define SCHEDULING_QUANTUM m9_l2
/*
* SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from
* SCHEDULING_NO_QUANTUM/SYS_SCHEDULE
*/
#define SCHEDULING_START (SCHEDULING_BASE+2)
# define SCHEDULING_SCHEDULER m9_l1 /* Overrides _ENDPOINT on return*/
# define SCHEDULING_PARENT m9_l3
# define SCHEDULING_MAXPRIO m9_l4
#define SCHEDULING_STOP (SCHEDULING_BASE+3)
#define SCHEDULING_SET_NICE (SCHEDULING_BASE+4)
/* SCHEDULING_INHERIT is like SCHEDULING_START, but without _QUANTUM field */
#define SCHEDULING_INHERIT (SCHEDULING_BASE+5)
/*===========================================================================*

View file

@ -635,6 +635,23 @@ typedef struct {
} mess_lsys_pm_srv_fork;
_ASSERT_MSG_SIZE(mess_lsys_pm_srv_fork);
typedef struct {
endpoint_t endpoint;
endpoint_t parent;
int maxprio;
int quantum;
uint8_t padding[40];
} mess_lsys_sched_scheduling_start;
_ASSERT_MSG_SIZE(mess_lsys_sched_scheduling_start);
typedef struct {
endpoint_t scheduler;
uint8_t padding[52];
} mess_sched_lsys_scheduling_start;
_ASSERT_MSG_SIZE(mess_sched_lsys_scheduling_start);
typedef struct {
endpoint_t endpt;
cp_grant_id_t grant;
@ -1205,6 +1222,8 @@ typedef struct {
mess_lsys_pm_getprocnr m_lsys_pm_getprocnr;
mess_lsys_pm_srv_fork m_lsys_pm_srv_fork;
mess_lsys_sched_scheduling_start m_lsys_sched_scheduling_start;
mess_lsys_vfs_checkperms m_lsys_vfs_checkperms;
mess_lsys_vfs_copyfd m_lsys_vfs_copyfd;
mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver;
@ -1225,6 +1244,8 @@ typedef struct {
mess_rs_pm_exec_restart m_rs_pm_exec_restart;
mess_rs_pm_srv_kill m_rs_pm_srv_kill;
mess_sched_lsys_scheduling_start m_sched_lsys_scheduling_start;
mess_vfs_fs_breadwrite m_vfs_fs_breadwrite;
mess_vfs_fs_chmod m_vfs_fs_chmod;
mess_vfs_fs_chown m_vfs_fs_chown;

View file

@ -26,9 +26,9 @@ int sched_inherit(endpoint_t scheduler_e,
assert(newscheduler_e);
memset(&m, 0, sizeof(m));
m.SCHEDULING_ENDPOINT = schedulee_e;
m.SCHEDULING_PARENT = parent_e;
m.SCHEDULING_MAXPRIO = (int) maxprio;
m.m_lsys_sched_scheduling_start.endpoint = schedulee_e;
m.m_lsys_sched_scheduling_start.parent = parent_e;
m.m_lsys_sched_scheduling_start.maxprio = maxprio;
/* Send the request to the scheduler */
if ((rv = _taskcall(scheduler_e, SCHEDULING_INHERIT, &m))) {
@ -40,7 +40,7 @@ int sched_inherit(endpoint_t scheduler_e,
* might have forwarded the scheduling message on to another scheduler
* before returning the message.
*/
*newscheduler_e = m.SCHEDULING_SCHEDULER;
*newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler;
return (OK);
}
@ -82,10 +82,10 @@ int sched_start(endpoint_t scheduler_e,
/* A user-space scheduler must schedule this process. */
memset(&m, 0, sizeof(m));
m.SCHEDULING_ENDPOINT = schedulee_e;
m.SCHEDULING_PARENT = parent_e;
m.SCHEDULING_MAXPRIO = (int) maxprio;
m.SCHEDULING_QUANTUM = (int) quantum;
m.m_lsys_sched_scheduling_start.endpoint = schedulee_e;
m.m_lsys_sched_scheduling_start.parent = parent_e;
m.m_lsys_sched_scheduling_start.maxprio = maxprio;
m.m_lsys_sched_scheduling_start.quantum = quantum;
/* Send the request to the scheduler */
if ((rv = _taskcall(scheduler_e, SCHEDULING_START, &m))) {
@ -97,6 +97,6 @@ int sched_start(endpoint_t scheduler_e,
* might have forwarded the scheduling message on to another scheduler
* before returning the message.
*/
*newscheduler_e = m.SCHEDULING_SCHEDULER;
*newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler;
return (OK);
}

View file

@ -153,16 +153,16 @@ int do_start_scheduling(message *m_ptr)
return EPERM;
/* Resolve endpoint to proc slot. */
if ((rv = sched_isemtyendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr_n))
!= OK) {
if ((rv = sched_isemtyendpt(m_ptr->m_lsys_sched_scheduling_start.endpoint,
&proc_nr_n)) != OK) {
return rv;
}
rmp = &schedproc[proc_nr_n];
/* Populate process slot */
rmp->endpoint = m_ptr->SCHEDULING_ENDPOINT;
rmp->parent = m_ptr->SCHEDULING_PARENT;
rmp->max_priority = (unsigned) m_ptr->SCHEDULING_MAXPRIO;
rmp->endpoint = m_ptr->m_lsys_sched_scheduling_start.endpoint;
rmp->parent = m_ptr->m_lsys_sched_scheduling_start.parent;
rmp->max_priority = m_ptr->m_lsys_sched_scheduling_start.maxprio;
if (rmp->max_priority >= NR_SCHED_QUEUES) {
return EINVAL;
}
@ -195,14 +195,14 @@ int do_start_scheduling(message *m_ptr)
* quanum and priority are set explicitly rather than inherited
* from the parent */
rmp->priority = rmp->max_priority;
rmp->time_slice = (unsigned) m_ptr->SCHEDULING_QUANTUM;
rmp->time_slice = m_ptr->m_lsys_sched_scheduling_start.quantum;
break;
case SCHEDULING_INHERIT:
/* Inherit current priority and time slice from parent. Since there
* is currently only one scheduler scheduling the whole system, this
* value is local and we assert that the parent endpoint is valid */
if ((rv = sched_isokendpt(m_ptr->SCHEDULING_PARENT,
if ((rv = sched_isokendpt(m_ptr->m_lsys_sched_scheduling_start.parent,
&parent_nr_n)) != OK)
return rv;
@ -242,10 +242,10 @@ int do_start_scheduling(message *m_ptr)
* By default, processes are scheduled by the parents scheduler. In case
* this scheduler would want to delegate scheduling to another
* scheduler, it could do so and then write the endpoint of that
* scheduler into SCHEDULING_SCHEDULER
* scheduler into the "scheduler" field.
*/
m_ptr->SCHEDULING_SCHEDULER = SCHED_PROC_NR;
m_ptr->m_sched_lsys_scheduling_start.scheduler = SCHED_PROC_NR;
return OK;
}