Annotations and tweaks for live update
This change is necessary for instrumentation-aided state transfer. Change-Id: I24be938009f02e302a15083f9a7a11824975e42b
This commit is contained in:
parent
23369f9c9e
commit
129adfeb53
14 changed files with 38 additions and 22 deletions
|
@ -198,8 +198,10 @@ pfs_putnode(ino_t ino_nr, unsigned int count)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
/* For pipes, free the inode data buffer. */
|
/* For pipes, free the inode data buffer. */
|
||||||
if (rip->i_data != NULL)
|
if (rip->i_data != NULL) {
|
||||||
free(rip->i_data);
|
free(rip->i_data);
|
||||||
|
rip->i_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the inode to the free list. */
|
/* Return the inode to the free list. */
|
||||||
rip->i_free = TRUE;
|
rip->i_free = TRUE;
|
||||||
|
|
|
@ -19,10 +19,11 @@ struct policies {
|
||||||
enum policy supported;
|
enum policy supported;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
typedef struct {
|
||||||
struct rproc proc[NR_SYS_PROCS];
|
struct rproc proc[NR_SYS_PROCS];
|
||||||
struct rprocpub pub[NR_SYS_PROCS];
|
struct rprocpub pub[NR_SYS_PROCS];
|
||||||
} rproc;
|
} ixfer_rproc_t;
|
||||||
|
static ixfer_rproc_t rproc;
|
||||||
|
|
||||||
static struct policies policies[NR_SYS_PROCS];
|
static struct policies policies[NR_SYS_PROCS];
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ static fsblkcnt_t fs_btotal = 0, fs_bused = 0;
|
||||||
|
|
||||||
static int quiet = 0;
|
static int quiet = 0;
|
||||||
|
|
||||||
|
typedef struct buf *noxfer_buf_ptr_t; /* annotation for temporary buf ptrs */
|
||||||
|
|
||||||
void lmfs_setquiet(int q) { quiet = q; }
|
void lmfs_setquiet(int q) { quiet = q; }
|
||||||
|
|
||||||
static int fs_bufs_heuristic(int minbufs, fsblkcnt_t btotal,
|
static int fs_bufs_heuristic(int minbufs, fsblkcnt_t btotal,
|
||||||
|
@ -988,7 +990,7 @@ void lmfs_readahead(dev_t dev, block64_t base_block, unsigned int nblocks,
|
||||||
* However, the caller must also not rely on all or even any of the blocks to
|
* However, the caller must also not rely on all or even any of the blocks to
|
||||||
* be present in the cache afterwards--failures are (deliberately!) ignored.
|
* be present in the cache afterwards--failures are (deliberately!) ignored.
|
||||||
*/
|
*/
|
||||||
static struct buf *bufq[LMFS_MAX_PREFETCH]; /* static because of size only */
|
static noxfer_buf_ptr_t bufq[LMFS_MAX_PREFETCH]; /* static for size only */
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
int r;
|
int r;
|
||||||
|
@ -1131,7 +1133,7 @@ void lmfs_flushdev(dev_t dev)
|
||||||
/* Flush all dirty blocks for one device. */
|
/* Flush all dirty blocks for one device. */
|
||||||
|
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
static struct buf **dirty;
|
static noxfer_buf_ptr_t *dirty;
|
||||||
static unsigned int dirtylistsize = 0;
|
static unsigned int dirtylistsize = 0;
|
||||||
unsigned int ndirty;
|
unsigned int ndirty;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#ifndef _VTREEFS_INODE_H
|
#ifndef _VTREEFS_INODE_H
|
||||||
#define _VTREEFS_INODE_H
|
#define _VTREEFS_INODE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback data can be a pointer or a (cast) integer value. For now, we
|
||||||
|
* instruct the state transfer framework that it should translate only
|
||||||
|
* recognized pointers.
|
||||||
|
*/
|
||||||
|
typedef cbdata_t cixfer_cbdata_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The inodes that are active, form a fully connected tree. Each node except
|
* The inodes that are active, form a fully connected tree. Each node except
|
||||||
* the root node has a parent and a tail queue of children, where each child
|
* the root node has a parent and a tail queue of children, where each child
|
||||||
|
@ -27,7 +34,7 @@ struct inode {
|
||||||
unsigned int i_count; /* reference count */
|
unsigned int i_count; /* reference count */
|
||||||
index_t i_index; /* index number in parent / NO_INDEX */
|
index_t i_index; /* index number in parent / NO_INDEX */
|
||||||
int i_indexed; /* number of indexed entries */
|
int i_indexed; /* number of indexed entries */
|
||||||
cbdata_t i_cbdata; /* callback data */
|
cixfer_cbdata_t i_cbdata; /* callback data */
|
||||||
unsigned short i_flags; /* I_DELETED or 0 */
|
unsigned short i_flags; /* I_DELETED or 0 */
|
||||||
|
|
||||||
/* Tree structure */
|
/* Tree structure */
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
/* Needs to be included here, for 'ps' etc */
|
/* Needs to be included here, for 'ps' etc */
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
|
typedef struct sigaction ixfer_sigaction;
|
||||||
|
|
||||||
EXTERN struct mproc {
|
EXTERN struct mproc {
|
||||||
char mp_exitstatus; /* storage for status when process exits */
|
char mp_exitstatus; /* storage for status when process exits */
|
||||||
char mp_sigstatus; /* storage for signal # for killed procs */
|
char mp_sigstatus; /* storage for signal # for killed procs */
|
||||||
|
@ -45,7 +47,7 @@ EXTERN struct mproc {
|
||||||
sigset_t mp_sigpending; /* pending signals to be handled */
|
sigset_t mp_sigpending; /* pending signals to be handled */
|
||||||
sigset_t mp_ksigpending; /* bitmap for pending signals from the kernel */
|
sigset_t mp_ksigpending; /* bitmap for pending signals from the kernel */
|
||||||
sigset_t mp_sigtrace; /* signals to hand to tracer first */
|
sigset_t mp_sigtrace; /* signals to hand to tracer first */
|
||||||
struct sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
|
ixfer_sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
|
||||||
#ifdef __ACK__
|
#ifdef __ACK__
|
||||||
char mp_padding[60]; /* align structure with new libc */
|
char mp_padding[60]; /* align structure with new libc */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,8 @@ static struct exec_loaders {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct minix_kerninfo *_minix_kerninfo;
|
||||||
|
|
||||||
int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv,
|
int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv,
|
||||||
char **envp)
|
char **envp)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +75,7 @@ static int do_exec(int proc_e, char *exec, size_t exec_len, char *progname,
|
||||||
|
|
||||||
memset(&execi, 0, sizeof(execi));
|
memset(&execi, 0, sizeof(execi));
|
||||||
|
|
||||||
execi.stack_high = kinfo.user_sp;
|
execi.stack_high = _minix_kerninfo->kinfo->user_sp;
|
||||||
execi.stack_size = DEFAULT_STACK_LIMIT;
|
execi.stack_size = DEFAULT_STACK_LIMIT;
|
||||||
execi.proc_e = proc_e;
|
execi.proc_e = proc_e;
|
||||||
execi.hdr = exec;
|
execi.hdr = exec;
|
||||||
|
|
|
@ -54,7 +54,5 @@ EXTERN unsigned system_hz;
|
||||||
|
|
||||||
EXTERN struct machine machine; /* machine info */
|
EXTERN struct machine machine; /* machine info */
|
||||||
|
|
||||||
EXTERN struct kinfo kinfo; /* kernel information */
|
|
||||||
|
|
||||||
#endif /* RS_GLO_H */
|
#endif /* RS_GLO_H */
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,6 @@ int main(void)
|
||||||
if (OK != (s=sys_getmachine(&machine)))
|
if (OK != (s=sys_getmachine(&machine)))
|
||||||
panic("couldn't get machine info: %d", s);
|
panic("couldn't get machine info: %d", s);
|
||||||
|
|
||||||
if (OK != (s=sys_getkinfo(&kinfo)))
|
|
||||||
panic("couldn't get kernel kinfo: %d", s);
|
|
||||||
|
|
||||||
/* Main loop - get work and do it, forever. */
|
/* Main loop - get work and do it, forever. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
/* Perform sensitive background operations when RS is idle. */
|
/* Perform sensitive background operations when RS is idle. */
|
||||||
|
|
|
@ -82,6 +82,8 @@ static const struct exec_loaders exec_loaders[] = {
|
||||||
#define lock_exec() lock_proc(fproc_addr(VM_PROC_NR))
|
#define lock_exec() lock_proc(fproc_addr(VM_PROC_NR))
|
||||||
#define unlock_exec() unlock_proc(fproc_addr(VM_PROC_NR))
|
#define unlock_exec() unlock_proc(fproc_addr(VM_PROC_NR))
|
||||||
|
|
||||||
|
extern struct minix_kerninfo *_minix_kerninfo;
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* get_read_vp *
|
* get_read_vp *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -213,7 +215,7 @@ int pm_exec(vir_bytes path, size_t path_len, vir_bytes frame, size_t frame_len,
|
||||||
|
|
||||||
/* passed from exec() libc code */
|
/* passed from exec() libc code */
|
||||||
execi.userflags = 0;
|
execi.userflags = 0;
|
||||||
execi.args.stack_high = kinfo.user_sp;
|
execi.args.stack_high = _minix_kerninfo->kinfo->user_sp;
|
||||||
execi.args.stack_size = DEFAULT_STACK_LIMIT;
|
execi.args.stack_size = DEFAULT_STACK_LIMIT;
|
||||||
|
|
||||||
fp->text_size = 0;
|
fp->text_size = 0;
|
||||||
|
|
|
@ -43,6 +43,4 @@ EXTERN int err_code; /* temporary storage for error number */
|
||||||
/* Data initialized elsewhere. */
|
/* Data initialized elsewhere. */
|
||||||
extern int (* const call_vec[])(void);
|
extern int (* const call_vec[])(void);
|
||||||
|
|
||||||
EXTERN struct kinfo kinfo; /* kernel information */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,9 +65,6 @@ int main(void)
|
||||||
|
|
||||||
printf("Started VFS: %d worker thread(s)\n", NR_WTHREADS);
|
printf("Started VFS: %d worker thread(s)\n", NR_WTHREADS);
|
||||||
|
|
||||||
if (OK != (sys_getkinfo(&kinfo)))
|
|
||||||
panic("couldn't get kernel kinfo");
|
|
||||||
|
|
||||||
/* This is the main loop that gets work, processes it, and sends replies. */
|
/* This is the main loop that gets work, processes it, and sends replies. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
yield_all(); /* let other threads run */
|
yield_all(); /* let other threads run */
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifndef _VM_GLO_H
|
||||||
|
#define _VM_GLO_H
|
||||||
|
|
||||||
#include <minix/sys_config.h>
|
#include <minix/sys_config.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
|
@ -19,7 +21,8 @@ EXTERN struct vmproc vmproc[VMP_NR];
|
||||||
|
|
||||||
long enable_filemap;
|
long enable_filemap;
|
||||||
|
|
||||||
EXTERN kinfo_t kernel_boot_info;
|
typedef kinfo_t ixfer_kinfo_t;
|
||||||
|
EXTERN ixfer_kinfo_t kernel_boot_info;
|
||||||
|
|
||||||
#if SANITYCHECKS
|
#if SANITYCHECKS
|
||||||
EXTERN int nocheck;
|
EXTERN int nocheck;
|
||||||
|
@ -41,3 +44,5 @@ EXTERN mem_type_t mem_type_anon, /* anonymous memory */
|
||||||
/* total number of memory pages */
|
/* total number of memory pages */
|
||||||
EXTERN int total_pages;
|
EXTERN int total_pages;
|
||||||
EXTERN int num_vm_instances;
|
EXTERN int num_vm_instances;
|
||||||
|
|
||||||
|
#endif /* !_VM_GLO_H */
|
||||||
|
|
|
@ -262,7 +262,7 @@ static int sef_cb_init_fresh(int type, sef_init_info_t *info)
|
||||||
|
|
||||||
static struct vmproc *init_proc(endpoint_t ep_nr)
|
static struct vmproc *init_proc(endpoint_t ep_nr)
|
||||||
{
|
{
|
||||||
static struct boot_image *ip;
|
struct boot_image *ip;
|
||||||
|
|
||||||
for (ip = &kernel_boot_info.boot_procs[0];
|
for (ip = &kernel_boot_info.boot_procs[0];
|
||||||
ip < &kernel_boot_info.boot_procs[NR_BOOT_PROCS]; ip++) {
|
ip < &kernel_boot_info.boot_procs[NR_BOOT_PROCS]; ip++) {
|
||||||
|
@ -429,7 +429,7 @@ void init_vm(void)
|
||||||
{
|
{
|
||||||
int s, i;
|
int s, i;
|
||||||
static struct memory mem_chunks[NR_MEMS];
|
static struct memory mem_chunks[NR_MEMS];
|
||||||
static struct boot_image *ip;
|
struct boot_image *ip;
|
||||||
extern void __minix_init(void);
|
extern void __minix_init(void);
|
||||||
multiboot_module_t *mod;
|
multiboot_module_t *mod;
|
||||||
vir_bytes kern_dyn, kern_static;
|
vir_bytes kern_dyn, kern_static;
|
||||||
|
|
|
@ -174,6 +174,9 @@ vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
|
||||||
if (sbuf){ /* handle case where sbuf == NULL */
|
if (sbuf){ /* handle case where sbuf == NULL */
|
||||||
*sbuf = '\0';
|
*sbuf = '\0';
|
||||||
}
|
}
|
||||||
|
#if defined(_MINIX_MAGIC)
|
||||||
|
sbuf = ebuf = NULL; /* leave no dangling pointers */
|
||||||
|
#endif
|
||||||
return scount;
|
return scount;
|
||||||
#else /* __minix is not defined */
|
#else /* __minix is not defined */
|
||||||
*sbuf = '\0';
|
*sbuf = '\0';
|
||||||
|
|
Loading…
Reference in a new issue