vm/ipc: only report signals when it matters to ipc

. ipc wants to know about processes that get
	  signals, so that it can break blocking ipc operations
	. doing it for every single signal is wasteful
	  and causes the annoying 'no slot for signals' message
	. this fix tells vm on a per-process basis it (ipc)
	  wants to be notified, i.e. only when it does any ipc calls
	. move ipc config to separate config file while we're at it
This commit is contained in:
Ben Gras
2011-08-05 20:52:32 +00:00
parent 862fb8354d
commit d477a9ed82
12 changed files with 77 additions and 23 deletions
+1
View File
@@ -365,6 +365,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
CALLMAP(VM_GETREF, do_get_refcount);
CALLMAP(VM_INFO, do_info);
CALLMAP(VM_QUERY_EXIT, do_query_exit);
CALLMAP(VM_WATCH_EXIT, do_watch_exit);
CALLMAP(VM_FORGETBLOCKS, do_forgetblocks);
CALLMAP(VM_FORGETBLOCK, do_forgetblock);
CALLMAP(VM_YIELDBLOCKGETBLOCK, do_yieldblockgetblock);
+1
View File
@@ -207,5 +207,6 @@ _PROTOTYPE(int do_rs_memctl, (message *m));
/* queryexit.c */
_PROTOTYPE(int do_query_exit, (message *m));
_PROTOTYPE(int do_watch_exit, (message *m));
_PROTOTYPE(int do_notify_sig, (message *m));
_PROTOTYPE(void init_query_exit, (void));
+26 -2
View File
@@ -67,10 +67,19 @@ PUBLIC int do_query_exit(message *m)
*===========================================================================*/
PUBLIC int do_notify_sig(message *m)
{
int i, avails = 0;
int i, avails = 0, p;
endpoint_t ep = m->VM_NOTIFY_SIG_ENDPOINT;
endpoint_t ipc_ep = m->VM_NOTIFY_SIG_IPC;
int r;
struct vmproc *vmp;
int pslot;
if(vm_isokendpt(ep, &pslot) != OK) return ESRCH;
vmp = &vmproc[pslot];
/* Only record the event if we've been asked to report it. */
if(!(vmp->vm_flags & VMF_WATCHEXIT))
return OK;
for (i = 0; i < NR_PROCS; i++) {
/* its signal is already here */
@@ -80,7 +89,7 @@ PUBLIC int do_notify_sig(message *m)
avails++;
}
if (!avails) {
/* no slot for signals, impossible */
/* no slot for signals, unlikely */
printf("VM: no slot for signals!\n");
return ENOMEM;
}
@@ -106,6 +115,21 @@ out:
return OK;
}
/*===========================================================================*
* do_watch_exit *
*===========================================================================*/
PUBLIC int do_watch_exit(message *m)
{
endpoint_t e = m->VM_WE_EP;
struct vmproc *vmp;
int p;
if(vm_isokendpt(e, &p) != OK) return ESRCH;
vmp = &vmproc[p];
vmp->vm_flags |= VMF_WATCHEXIT;
return OK;
}
/*===========================================================================*
* init_query_exit *
*===========================================================================*/
+1
View File
@@ -65,5 +65,6 @@ struct vmproc {
#define VMF_HAS_DMA 0x010 /* Process directly or indirectly granted
* DMA buffers.
*/
#define VMF_WATCHEXIT 0x020 /* Store in queryexit table */
#endif