Rewrite of boot process
KERNEL CHANGES: - The kernel only knows about privileges of kernel tasks and the root system process (now RS). - Kernel tasks and the root system process are the only processes that are made schedulable by the kernel at startup. All the other processes in the boot image don't get their privileges set at startup and are inhibited from running by the RTS_NO_PRIV flag. - Removed the assumption on the ordering of processes in the boot image table. System processes can now appear in any order in the boot image table. - Privilege ids can now be assigned both statically or dynamically. The kernel assigns static privilege ids to kernel tasks and the root system process. Each id is directly derived from the process number. - User processes now all share the static privilege id of the root user process (now INIT). - sys_privctl split: we have more calls now to let RS set privileges for system processes. SYS_PRIV_ALLOW / SYS_PRIV_DISALLOW are only used to flip the RTS_NO_PRIV flag and allow / disallow a process from running. SYS_PRIV_SET_SYS / SYS_PRIV_SET_USER are used to set privileges for a system / user process. - boot image table flags split: PROC_FULLVM is the only flag that has been moved out of the privilege flags and is still maintained in the boot image table. All the other privilege flags are out of the kernel now. RS CHANGES: - RS is the only user-space process who gets to run right after in-kernel startup. - RS uses the boot image table from the kernel and three additional boot image info table (priv table, sys table, dev table) to complete the initialization of the system. - RS checks that the entries in the priv table match the entries in the boot image table to make sure that every process in the boot image gets schedulable. - RS only uses static privilege ids to set privileges for system services in the boot image. - RS includes basic memory management support to allocate the boot image buffer dynamically during initialization. The buffer shall contain the executable image of all the system services we would like to restart after a crash. - First step towards decoupling between resource provisioning and resource requirements in RS: RS must know what resources it needs to restart a process and what resources it has currently available. This is useful to tradeoff reliability and resource consumption. When required resources are missing, the process cannot be restarted. In that case, in the future, a system flag will tell RS what to do. For example, if CORE_PROC is set, RS should trigger a system-wide panic because the system can no longer function correctly without a core system process. PM CHANGES: - The process tree built at initialization time is changed to have INIT as root with pid 0, RS child of INIT and all the system services children of RS. This is required to make RS in control of all the system services. - PM no longer registers labels for system services in the boot image. This is now part of RS's initialization process.
This commit is contained in:
+14
-9
@@ -73,6 +73,10 @@
|
||||
#define VM_PROC_NR 8 /* memory server */
|
||||
#define INIT_PROC_NR 9 /* init -- goes multiuser */
|
||||
|
||||
/* Root system process and root user process. */
|
||||
#define ROOT_SYS_PROC_NR RS_PROC_NR
|
||||
#define ROOT_USR_PROC_NR INIT_PROC_NR
|
||||
|
||||
/* Number of processes contained in the system image. */
|
||||
#define NR_BOOT_PROCS (NR_TASKS + INIT_PROC_NR + 1)
|
||||
|
||||
@@ -354,15 +358,15 @@
|
||||
#define SYS_ALL_CALLS (NR_SYS_CALLS)
|
||||
|
||||
/* Subfunctions for SYS_PRIVCTL */
|
||||
#define SYS_PRIV_INIT 1 /* Initialize a privilege structure */
|
||||
#define SYS_PRIV_ADD_IO 2 /* Add I/O range (struct io_range) */
|
||||
#define SYS_PRIV_ADD_MEM 3 /* Add memory range (struct mem_range)
|
||||
#define SYS_PRIV_ALLOW 1 /* Allow process to run */
|
||||
#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
|
||||
#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
|
||||
#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
|
||||
#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
|
||||
#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
|
||||
*/
|
||||
#define SYS_PRIV_ADD_IRQ 4 /* Add IRQ */
|
||||
#define SYS_PRIV_USER 5 /* Make a process an oridinary user
|
||||
* process.
|
||||
*/
|
||||
#define SYS_PRIV_QUERY_MEM 6 /* Verify memory privilege. */
|
||||
#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
|
||||
#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
|
||||
|
||||
/* Subfunctions for SYS_SETGRANT */
|
||||
#define SYS_PARAM_SET_GRANT 1 /* Set address and size of grant table */
|
||||
@@ -478,11 +482,12 @@
|
||||
# define GET_BIOSBUFFER 14 /* get a buffer for BIOS calls */
|
||||
# define GET_LOADINFO 15 /* get load average information */
|
||||
# define GET_IRQACTIDS 16 /* get the IRQ masks */
|
||||
# define GET_PRIVID 17 /* get ID of privilege structure */
|
||||
# define GET_PRIV 17 /* get privilege structure */
|
||||
# define GET_HZ 18 /* get HZ value */
|
||||
# define GET_WHOAMI 19 /* get own name and endpoint */
|
||||
# define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
|
||||
# define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
|
||||
# define GET_AOUTHEADER 22 /* get a.out headers from the boot image */
|
||||
#define I_ENDPT m7_i4 /* calling process */
|
||||
#define I_VAL_PTR m7_p1 /* virtual address at caller */
|
||||
#define I_VAL_LEN m7_i1 /* max length of value */
|
||||
|
||||
@@ -132,12 +132,14 @@
|
||||
#define SERVARNAME "cttyline"
|
||||
|
||||
/* Bits for the system property flags in boot image processes. */
|
||||
#define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */
|
||||
|
||||
/* Bits for s_flags in the privilege structure. */
|
||||
#define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */
|
||||
#define BILLABLE 0x04 /* some processes are not billable */
|
||||
#define DYN_PRIV_ID 0x08 /* privilege id assigned dynamically */
|
||||
|
||||
#define SYS_PROC 0x10 /* system processes have own priv structure */
|
||||
#define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
|
||||
#define CHECK_IRQ 0x40 /* check if IRQ can be used */
|
||||
#define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
|
||||
#define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ _PROTOTYPE(void *alloc_contig, (size_t len, int flags, phys_bytes *phys));
|
||||
* retrieve/set a process-virtual timer.
|
||||
*/
|
||||
_PROTOTYPE( int sys_times, (endpoint_t proc_ep, clock_t *user_time,
|
||||
clock_t *sys_time, clock_t *uptime));
|
||||
clock_t *sys_time, clock_t *uptime, time_t *boottime));
|
||||
_PROTOTYPE(int sys_setalarm, (clock_t exp_time, int abs_time));
|
||||
_PROTOTYPE( int sys_vtimer, (endpoint_t proc_nr, int which, clock_t *newval,
|
||||
clock_t *oldval));
|
||||
@@ -178,8 +178,9 @@ _PROTOTYPE(int sys_segctl, (int *index, u16_t *seg, vir_bytes *off,
|
||||
#define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
|
||||
#define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
|
||||
#define sys_getlocktimings(dst) sys_getinfo(GET_LOCKTIMING, dst, 0,0,0)
|
||||
#define sys_getprivid(nr) sys_getinfo(GET_PRIVID, 0, 0,0, nr)
|
||||
#define sys_getpriv(dst, nr) sys_getinfo(GET_PRIV, dst, 0,0, nr)
|
||||
#define sys_getidletsc(dst) sys_getinfo(GET_IDLETSC, dst, 0,0,0)
|
||||
#define sys_getaoutheader(dst,nr) sys_getinfo(GET_AOUTHEADER, dst, 0,0,nr)
|
||||
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
|
||||
void *val_ptr2, int val_len2) );
|
||||
_PROTOTYPE(int sys_whoami, (endpoint_t *ep, char *name, int namelen));
|
||||
|
||||
Reference in New Issue
Block a user