Message type for SCHEDULING_NO_QUANTUM, SYS_SCHEDULE

Change-Id: Ia0f2689067159b4d821092d4ac60efa75e396f7c
This commit is contained in:
Lionel Sambuc 2014-05-14 16:59:14 +02:00
parent 8ba159d242
commit b694a09a53
5 changed files with 42 additions and 24 deletions

View file

@ -1000,18 +1000,9 @@
#define SCHEDULING_BASE 0xF00
#define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1)
# define SCHEDULING_ACNT_DEQS m9_l1
# define SCHEDULING_ACNT_IPC_SYNC m9_l2
# define SCHEDULING_ACNT_IPC_ASYNC m9_l3
# define SCHEDULING_ACNT_PREEMPT m9_l4
# define SCHEDULING_ACNT_QUEUE m9_l5
# define SCHEDULING_ACNT_CPU m9_s1
# define SCHEDULING_ACNT_CPU_LOAD m9_s2
/* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */
# define SCHEDULING_ENDPOINT m9_l1
# define SCHEDULING_QUANTUM m9_l2
# define SCHEDULING_PRIORITY m9_s1
# define SCHEDULING_CPU m9_l4
/*
* SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from

View file

@ -145,6 +145,30 @@ typedef struct {
} mess_sigcalls;
_ASSERT_MSG_SIZE(mess_sigcalls);
typedef struct {
time_t acnt_queue;
unsigned long acnt_deqs;
unsigned long acnt_ipc_sync;
unsigned long acnt_ipc_async;
unsigned long acnt_preempt;
uint32_t acnt_cpu;
uint32_t acnt_cpu_load;
uint8_t padding[24];
} mess_krn_lsys_schedule;
_ASSERT_MSG_SIZE(mess_krn_lsys_schedule);
typedef struct {
endpoint_t endpoint;
int quantum;
int priority;
int cpu;
uint8_t padding[40];
} mess_lsys_krn_schedule;
_ASSERT_MSG_SIZE(mess_lsys_krn_schedule);
typedef struct {
vir_bytes name;
size_t namelen;
@ -1117,6 +1141,8 @@ typedef struct {
mess_notify m_notify;
mess_sigcalls m_sigcalls;
mess_krn_lsys_schedule m_krn_lsys_schedule;
mess_fs_vfs_breadwrite m_fs_vfs_breadwrite;
mess_fs_vfs_chmod m_fs_vfs_chmod;
mess_fs_vfs_chown m_fs_vfs_chown;
@ -1173,6 +1199,7 @@ typedef struct {
mess_lexec_pm_exec_new m_lexec_pm_exec_new;
mess_lsys_krn_schedctl m_lsys_krn_schedctl;
mess_lsys_krn_schedule m_lsys_krn_schedule;
mess_lsys_pm_getepinfo m_lsys_pm_getepinfo;
mess_lsys_pm_getprocnr m_lsys_pm_getprocnr;

View file

@ -1806,13 +1806,13 @@ static void notify_scheduler(struct proc *p)
*/
m_no_quantum.m_source = p->p_endpoint;
m_no_quantum.m_type = SCHEDULING_NO_QUANTUM;
m_no_quantum.SCHEDULING_ACNT_QUEUE = cpu_time_2_ms(p->p_accounting.time_in_queue);
m_no_quantum.SCHEDULING_ACNT_DEQS = p->p_accounting.dequeues;
m_no_quantum.SCHEDULING_ACNT_IPC_SYNC = p->p_accounting.ipc_sync;
m_no_quantum.SCHEDULING_ACNT_IPC_ASYNC = p->p_accounting.ipc_async;
m_no_quantum.SCHEDULING_ACNT_PREEMPT = p->p_accounting.preempted;
m_no_quantum.SCHEDULING_ACNT_CPU = cpuid;
m_no_quantum.SCHEDULING_ACNT_CPU_LOAD = cpu_load();
m_no_quantum.m_krn_lsys_schedule.acnt_queue = cpu_time_2_ms(p->p_accounting.time_in_queue);
m_no_quantum.m_krn_lsys_schedule.acnt_deqs = p->p_accounting.dequeues;
m_no_quantum.m_krn_lsys_schedule.acnt_ipc_sync = p->p_accounting.ipc_sync;
m_no_quantum.m_krn_lsys_schedule.acnt_ipc_async = p->p_accounting.ipc_async;
m_no_quantum.m_krn_lsys_schedule.acnt_preempt = p->p_accounting.preempted;
m_no_quantum.m_krn_lsys_schedule.acnt_cpu = cpuid;
m_no_quantum.m_krn_lsys_schedule.acnt_cpu_load = cpu_load();
/* Reset accounting */
reset_proc_accounting(p);

View file

@ -11,7 +11,7 @@ int do_schedule(struct proc * caller, message * m_ptr)
int proc_nr;
int priority, quantum, cpu;
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
if (!isokendpt(m_ptr->m_lsys_krn_schedule.endpoint, &proc_nr))
return EINVAL;
p = proc_addr(proc_nr);
@ -21,9 +21,9 @@ int do_schedule(struct proc * caller, message * m_ptr)
return(EPERM);
/* Try to schedule the process. */
priority = (int) m_ptr->SCHEDULING_PRIORITY;
quantum = (int) m_ptr->SCHEDULING_QUANTUM;
cpu = (int) m_ptr->SCHEDULING_CPU;
priority = m_ptr->m_lsys_krn_schedule.priority;
quantum = m_ptr->m_lsys_krn_schedule.quantum;
cpu = m_ptr->m_lsys_krn_schedule.cpu;
return sched_proc(p, priority, quantum, cpu);
}

View file

@ -7,9 +7,9 @@ int sys_schedule(endpoint_t proc_ep,
{
message m;
m.SCHEDULING_ENDPOINT = proc_ep;
m.SCHEDULING_PRIORITY = priority;
m.SCHEDULING_QUANTUM = quantum;
m.SCHEDULING_CPU = cpu;
m.m_lsys_krn_schedule.endpoint = proc_ep;
m.m_lsys_krn_schedule.priority = priority;
m.m_lsys_krn_schedule.quantum = quantum;
m.m_lsys_krn_schedule.cpu = cpu;
return(_kernel_call(SYS_SCHEDULE, &m));
}