mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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().
This commit is contained in:
1 parent
79c26560e2
commit
55240dbbbd
9 files changed
+25
-7
No files matched your search
+3
-1
@@ -62,13 +62,15 @@ int xc_domain_getinfo(int xc_handle,
|
||||
xc_dominfo_t *info);
|
||||
int xc_domain_getfullinfo(int xc_handle,
|
||||
u32 domid,
|
||||
u32 vcpu,
|
||||
xc_domaininfo_t *info,
|
||||
full_execution_context_t *ctxt);
|
||||
int xc_domain_setcpuweight(int xc_handle,
|
||||
u32 domid,
|
||||
float weight);
|
||||
long long xc_domain_get_cpu_usage(int xc_handle,
|
||||
domid_t domid);
|
||||
domid_t domid,
|
||||
int vcpu);
|
||||
|
||||
|
||||
typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
|
||||
|
||||
@@ -88,6 +88,7 @@ int xc_domain_getinfo(int xc_handle,
|
||||
{
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)next_domid;
|
||||
op.u.getdomaininfo.exec_domain = 0; // FIX ME?!?
|
||||
op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
|
||||
if ( do_dom0_op(xc_handle, &op) < 0 )
|
||||
break;
|
||||
@@ -121,6 +122,7 @@ int xc_domain_getinfo(int xc_handle,
|
||||
|
||||
int xc_domain_getfullinfo(int xc_handle,
|
||||
u32 domid,
|
||||
u32 vcpu,
|
||||
xc_domaininfo_t *info,
|
||||
full_execution_context_t *ctxt)
|
||||
{
|
||||
@@ -129,6 +131,7 @@ int xc_domain_getfullinfo(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
op.u.getdomaininfo.exec_domain = (u16)vcpu;
|
||||
op.u.getdomaininfo.ctxt = ctxt;
|
||||
|
||||
rc = do_dom0_op(xc_handle, &op);
|
||||
|
||||
@@ -370,6 +370,7 @@ int xc_linux_build(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
op.u.getdomaininfo.exec_domain = 0;
|
||||
op.u.getdomaininfo.ctxt = ctxt;
|
||||
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u16)op.u.getdomaininfo.domain != domid) )
|
||||
|
||||
@@ -177,6 +177,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
|
||||
/* Get the domain's shared-info frame. */
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)dom;
|
||||
op.u.getdomaininfo.exec_domain = 0;
|
||||
op.u.getdomaininfo.ctxt = NULL;
|
||||
if ( do_dom0_op(xc_handle, &op) < 0 )
|
||||
{
|
||||
|
||||
@@ -232,8 +232,8 @@ static int print_stats( int xc_handle, u32 domid,
|
||||
|
||||
gettimeofday(&wall_now, NULL);
|
||||
|
||||
d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0 )/1000;
|
||||
d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid )/1000;
|
||||
d0_cpu_now = xc_domain_get_cpu_usage( xc_handle, 0, /* FIXME */ 0 )/1000;
|
||||
d1_cpu_now = xc_domain_get_cpu_usage( xc_handle, domid, /* FIXME */ 0 )/1000;
|
||||
|
||||
if ( (d0_cpu_now == -1) || (d1_cpu_now == -1) )
|
||||
printf("ARRHHH!!\n");
|
||||
@@ -331,7 +331,7 @@ int suspend_and_state(int xc_handle, XcIOContext *ioctxt,
|
||||
|
||||
retry:
|
||||
|
||||
if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, info, ctxt) )
|
||||
if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, info, ctxt) )
|
||||
{
|
||||
xcio_error(ioctxt, "Could not get full domain info");
|
||||
return -1;
|
||||
@@ -444,7 +444,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( xc_domain_getfullinfo( xc_handle, domid, &info, &ctxt) )
|
||||
if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, &info, &ctxt) )
|
||||
{
|
||||
xcio_error(ioctxt, "Could not get full domain info");
|
||||
goto out;
|
||||
|
||||
@@ -467,6 +467,7 @@ xc_plan9_build(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t) domid;
|
||||
op.u.getdomaininfo.exec_domain = 0;
|
||||
op.u.getdomaininfo.ctxt = ctxt;
|
||||
if ((do_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u32) op.u.getdomaininfo.domain != domid)) {
|
||||
|
||||
@@ -160,12 +160,13 @@ int finish_mmu_updates(int xc_handle, mmu_t *mmu)
|
||||
}
|
||||
|
||||
|
||||
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
|
||||
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
|
||||
{
|
||||
dom0_op_t op;
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
op.u.getdomaininfo.exec_domain = (u16)vcpu;
|
||||
op.u.getdomaininfo.ctxt = NULL;
|
||||
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u16)op.u.getdomaininfo.domain != domid) )
|
||||
@@ -248,6 +249,7 @@ long xc_get_tot_pages(int xc_handle, u32 domid)
|
||||
dom0_op_t op;
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
op.u.getdomaininfo.exec_domain = 0;
|
||||
op.u.getdomaininfo.ctxt = NULL;
|
||||
return (do_dom0_op(xc_handle, &op) < 0) ?
|
||||
-1 : op.u.getdomaininfo.tot_pages;
|
||||
|
||||
@@ -430,6 +430,7 @@ int xc_vmx_build(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
op.u.getdomaininfo.exec_domain = 0;
|
||||
op.u.getdomaininfo.ctxt = ctxt;
|
||||
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u16)op.u.getdomaininfo.domain != domid) )
|
||||
|
||||
@@ -354,7 +354,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
|
||||
|
||||
op->u.getdomaininfo.domain = d->id;
|
||||
|
||||
ed = d->exec_domain[0]; // op->u.getdomaininfo.exec_domain];
|
||||
if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
|
||||
!d->exec_domain[op->u.getdomaininfo.exec_domain] )
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
|
||||
|
||||
op->u.getdomaininfo.flags =
|
||||
(test_bit( DF_DYING, &d->d_flags) ? DOMFLAGS_DYING : 0) |
|
||||
|
||||