direct-io.hg

changeset 3435:0fd048d86eed

bitkeeper revision 1.1159.220.3 (41e670c37jmaTxUns3KlvsbVRCg-UA)

The getdomaininfo hypercall now listens to the exec_domain parameter
that was already passed to it, and performs some basic sanity checking.

Added exec_domain (aka vcpu) parameters to xc_domain_getfullinfo()
and xc_domain_get_cpu_usage().
author mafetter@fleming.research
date Thu Jan 13 12:59:47 2005 +0000 (2005-01-13)
parents 2419f5c72fe5
children 6096356005ba
files tools/libxc/xc.h tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_plan9_build.c tools/libxc/xc_private.c tools/libxc/xc_vmx_build.c xen/common/dom0_ops.c
line diff
     1.1 --- a/tools/libxc/xc.h	Thu Jan 13 12:56:43 2005 +0000
     1.2 +++ b/tools/libxc/xc.h	Thu Jan 13 12:59:47 2005 +0000
     1.3 @@ -62,13 +62,15 @@ int xc_domain_getinfo(int xc_handle,
     1.4                        xc_dominfo_t *info);
     1.5  int xc_domain_getfullinfo(int xc_handle,
     1.6                            u32 domid,
     1.7 +                          u32 vcpu,
     1.8                            xc_domaininfo_t *info,
     1.9                            full_execution_context_t *ctxt);
    1.10  int xc_domain_setcpuweight(int xc_handle,
    1.11                             u32 domid,
    1.12                             float weight);
    1.13  long long xc_domain_get_cpu_usage(int xc_handle,
    1.14 -                                  domid_t domid);
    1.15 +                                  domid_t domid,
    1.16 +                                  int vcpu);
    1.17  
    1.18  
    1.19  typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
     2.1 --- a/tools/libxc/xc_domain.c	Thu Jan 13 12:56:43 2005 +0000
     2.2 +++ b/tools/libxc/xc_domain.c	Thu Jan 13 12:59:47 2005 +0000
     2.3 @@ -88,6 +88,7 @@ int xc_domain_getinfo(int xc_handle,
     2.4      {
     2.5          op.cmd = DOM0_GETDOMAININFO;
     2.6          op.u.getdomaininfo.domain = (domid_t)next_domid;
     2.7 +        op.u.getdomaininfo.exec_domain = 0; // FIX ME?!?
     2.8          op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
     2.9          if ( do_dom0_op(xc_handle, &op) < 0 )
    2.10              break;
    2.11 @@ -121,6 +122,7 @@ int xc_domain_getinfo(int xc_handle,
    2.12  
    2.13  int xc_domain_getfullinfo(int xc_handle,
    2.14                            u32 domid,
    2.15 +                          u32 vcpu,
    2.16                            xc_domaininfo_t *info,
    2.17                            full_execution_context_t *ctxt)
    2.18  {
    2.19 @@ -129,6 +131,7 @@ int xc_domain_getfullinfo(int xc_handle,
    2.20  
    2.21      op.cmd = DOM0_GETDOMAININFO;
    2.22      op.u.getdomaininfo.domain = (domid_t)domid;
    2.23 +    op.u.getdomaininfo.exec_domain = (u16)vcpu;
    2.24      op.u.getdomaininfo.ctxt = ctxt;
    2.25  
    2.26      rc = do_dom0_op(xc_handle, &op);
     3.1 --- a/tools/libxc/xc_linux_build.c	Thu Jan 13 12:56:43 2005 +0000
     3.2 +++ b/tools/libxc/xc_linux_build.c	Thu Jan 13 12:59:47 2005 +0000
     3.3 @@ -370,6 +370,7 @@ int xc_linux_build(int xc_handle,
     3.4  
     3.5      op.cmd = DOM0_GETDOMAININFO;
     3.6      op.u.getdomaininfo.domain = (domid_t)domid;
     3.7 +    op.u.getdomaininfo.exec_domain = 0;
     3.8      op.u.getdomaininfo.ctxt = ctxt;
     3.9      if ( (do_dom0_op(xc_handle, &op) < 0) || 
    3.10           ((u16)op.u.getdomaininfo.domain != domid) )
     4.1 --- a/tools/libxc/xc_linux_restore.c	Thu Jan 13 12:56:43 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Jan 13 12:59:47 2005 +0000
     4.3 @@ -177,6 +177,7 @@ int xc_linux_restore(int xc_handle, XcIO
     4.4      /* Get the domain's shared-info frame. */
     4.5      op.cmd = DOM0_GETDOMAININFO;
     4.6      op.u.getdomaininfo.domain = (domid_t)dom;
     4.7 +    op.u.getdomaininfo.exec_domain = 0;
     4.8      op.u.getdomaininfo.ctxt = NULL;
     4.9      if ( do_dom0_op(xc_handle, &op) < 0 )
    4.10      {
     5.1 --- a/tools/libxc/xc_linux_save.c	Thu Jan 13 12:56:43 2005 +0000
     5.2 +++ b/tools/libxc/xc_linux_save.c	Thu Jan 13 12:59:47 2005 +0000
     5.3 @@ -232,8 +232,8 @@ static int print_stats( int xc_handle, u
     5.4  
     5.5      gettimeofday(&wall_now, NULL);
     5.6  
     5.7 -    d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0 )/1000;
     5.8 -    d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid )/1000;
     5.9 +    d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0, /* FIXME */ 0 )/1000;
    5.10 +    d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid, /* FIXME */ 0 )/1000;
    5.11  
    5.12      if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) ) 
    5.13          printf("ARRHHH!!\n");
    5.14 @@ -331,7 +331,7 @@ int suspend_and_state(int xc_handle, XcI
    5.15  
    5.16  retry:
    5.17  
    5.18 -    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, info, ctxt) )
    5.19 +    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, info, ctxt) )
    5.20      {
    5.21  	xcio_error(ioctxt, "Could not get full domain info");
    5.22  	return -1;
    5.23 @@ -444,7 +444,7 @@ int xc_linux_save(int xc_handle, XcIOCon
    5.24          return 1;
    5.25      }
    5.26  
    5.27 -    if ( xc_domain_getfullinfo( xc_handle, domid, &info, &ctxt) )
    5.28 +    if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, &info, &ctxt) )
    5.29      {
    5.30          xcio_error(ioctxt, "Could not get full domain info");
    5.31          goto out;
     6.1 --- a/tools/libxc/xc_plan9_build.c	Thu Jan 13 12:56:43 2005 +0000
     6.2 +++ b/tools/libxc/xc_plan9_build.c	Thu Jan 13 12:59:47 2005 +0000
     6.3 @@ -467,6 +467,7 @@ xc_plan9_build(int xc_handle,
     6.4  
     6.5  	op.cmd = DOM0_GETDOMAININFO;
     6.6  	op.u.getdomaininfo.domain = (domid_t) domid;
     6.7 +        op.u.getdomaininfo.exec_domain = 0;
     6.8  	op.u.getdomaininfo.ctxt = ctxt;
     6.9  	if ((do_dom0_op(xc_handle, &op) < 0) ||
    6.10  	    ((u32) op.u.getdomaininfo.domain != domid)) {
     7.1 --- a/tools/libxc/xc_private.c	Thu Jan 13 12:56:43 2005 +0000
     7.2 +++ b/tools/libxc/xc_private.c	Thu Jan 13 12:59:47 2005 +0000
     7.3 @@ -160,12 +160,13 @@ int finish_mmu_updates(int xc_handle, mm
     7.4  }
     7.5  
     7.6  
     7.7 -long long  xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
     7.8 +long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
     7.9  {
    7.10      dom0_op_t op;
    7.11  
    7.12      op.cmd = DOM0_GETDOMAININFO;
    7.13      op.u.getdomaininfo.domain = (domid_t)domid;
    7.14 +    op.u.getdomaininfo.exec_domain = (u16)vcpu;
    7.15      op.u.getdomaininfo.ctxt = NULL;
    7.16      if ( (do_dom0_op(xc_handle, &op) < 0) || 
    7.17           ((u16)op.u.getdomaininfo.domain != domid) )
    7.18 @@ -248,6 +249,7 @@ long xc_get_tot_pages(int xc_handle, u32
    7.19      dom0_op_t op;
    7.20      op.cmd = DOM0_GETDOMAININFO;
    7.21      op.u.getdomaininfo.domain = (domid_t)domid;
    7.22 +    op.u.getdomaininfo.exec_domain = 0;
    7.23      op.u.getdomaininfo.ctxt = NULL;
    7.24      return (do_dom0_op(xc_handle, &op) < 0) ? 
    7.25          -1 : op.u.getdomaininfo.tot_pages;
     8.1 --- a/tools/libxc/xc_vmx_build.c	Thu Jan 13 12:56:43 2005 +0000
     8.2 +++ b/tools/libxc/xc_vmx_build.c	Thu Jan 13 12:59:47 2005 +0000
     8.3 @@ -430,6 +430,7 @@ int xc_vmx_build(int xc_handle,
     8.4  
     8.5      op.cmd = DOM0_GETDOMAININFO;
     8.6      op.u.getdomaininfo.domain = (domid_t)domid;
     8.7 +    op.u.getdomaininfo.exec_domain = 0;
     8.8      op.u.getdomaininfo.ctxt = ctxt;
     8.9      if ( (do_dom0_op(xc_handle, &op) < 0) || 
    8.10           ((u16)op.u.getdomaininfo.domain != domid) )
     9.1 --- a/xen/common/dom0_ops.c	Thu Jan 13 12:56:43 2005 +0000
     9.2 +++ b/xen/common/dom0_ops.c	Thu Jan 13 12:59:47 2005 +0000
     9.3 @@ -354,7 +354,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     9.4  
     9.5          op->u.getdomaininfo.domain = d->id;
     9.6  
     9.7 -        ed = d->exec_domain[0]; // op->u.getdomaininfo.exec_domain];
     9.8 +        if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
     9.9 +             !d->exec_domain[op->u.getdomaininfo.exec_domain] )
    9.10 +        {
    9.11 +            ret = -EINVAL;
    9.12 +            break;
    9.13 +        }
    9.14 +        
    9.15 +        ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
    9.16  
    9.17          op->u.getdomaininfo.flags =
    9.18              (test_bit( DF_DYING,      &d->d_flags)  ? DOMFLAGS_DYING    : 0) |