Skip to contentSkip to conversation

Displaying scheduler related information using xm

PATCH In review Subhabrata Bhattacharya 3 participants 4 messages Mar 13, 2006 – Apr 4, 2006 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Displaying scheduler related information using xm

Hi All,

The attached patch adds two simple scheduler related capabilities to the xm tool.

$ xm sched-info
## Displays the name of the current scheduler (sedf/bvt)
$ xm sched-param [domid]
## If domid is supplied, then the scheduler parameters for the
corresponding domain is displayed, else scheduler parameters for all
the domains are displayed.

Example:

[root@tux06 ~]# xm sched-info
Domain Scheduler : bvt

[root@tux06 ~]# xm sched-param

Scheduler : bvt
---------------
Domain MCuAdv WarpBack WarpValue WarpL WarpU
0 20 80 99
2000000 9000000
88 20 80 91
2000000 9000000
90 10 0 0
2000000000000000 1000000000000000

The above commands will aid an administrator in monitoring and modifying scheduler related parameters for a pool of Xen virtual machines.

Please review and let me know your comments on this patch.

Regards, Subh

tools/python/xen/lowlevel/xc/xc.c +77 -0
diff -Naurp xen-3.0.0/tools/python/xen/lowlevel/xc/xc.c xen-3.0.0-sched-param/tools/python/xen/lowlevel/xc/xc.c
@@ -622,7 +622,69 @@ static PyObject *pyxc_physinfo(XcObject 
                          "cpu_khz",          info.cpu_khz,
                          "hw_caps",          cpu_cap);
 }
+/*Code for getting Scheduler ID */
+static PyObject *pyxc_sched_id(XcObject *self)
+{
+	int sched_id;
+
+	if ( xc_sched_id(self->xc_handle, &sched_id) !=0 )
+		return PyErr_SetFromErrno(xc_error);
+	
+	return Py_BuildValue("i", sched_id);
+}
+/*Code for getting Scheduler params */
+static PyObject *pyxc_sched_param(XcObject *self, PyObject *args)
+{
+	int sched_id;
+	uint32_t dom;
+	/*BVT Scheduler Parameters*/
+	uint32_t mcuadv;
+	int warpback;
+	int32_t warpvalue;
+	long long warpl;
+	long long warpu;
+	/*SEDF Scheduler Parameters*/
+	uint64_t period, slice, latency;
+	uint16_t weight, extratime;
 
+	if (!PyArg_ParseTuple(args, "l", &dom))
+       		return NULL;
+ 
+	if (xc_sched_id(self->xc_handle,(int *) &sched_id) !=0)
+		return PyErr_SetFromErrno(xc_error);
+
+	if (sched_id == 0) { 
+	/*Scheduler is bvt; get the Domain parameters*/
+    		if (xc_bvtsched_domain_get(self->xc_handle, dom, &mcuadv, &warpback,
+                               &warpvalue, &warpl, &warpu) != 0)
+			
+	        	return PyErr_SetFromErrno(xc_error);
+		
+		return Py_BuildValue("lliiLL",
+			dom,
+			mcuadv,
+			warpback,
+			warpvalue,
+			warpl,
+			warpu);
+	}
+	else if (sched_id == 4) {
+	/*Scheduler is sedf; get the Domain parameters*/
+		if (xc_sedf_domain_get(self->xc_handle, dom, &period,
+                           &slice,&latency,&extratime,&weight)) 
+			return PyErr_SetFromErrno(xc_error);
+			
+		return Py_BuildValue("lLLLhh",
+			dom,
+			slice,
+			period,
+			latency,
+			extratime,
+			weight);
+	}
+	else 
+		return Py_BuildValue("si","Unknown Scheduler Parameters for ",sched_id);
+}
 static PyObject *pyxc_xeninfo(XcObject *self)
 {
     xen_extraversion_t xen_extra;
@@ -1037,6 +1099,21 @@ static PyMethodDef pyxc_methods[] = {
       "Returns [dict]: information about the hardware"
       "        [None]: on failure.\n" },
 
+    { "sched_id",
+      (PyCFunction)pyxc_sched_id,
+      METH_NOARGS, "\n"
+      "Get information about the Scheduler being used\n"
+      "Returns [int]  Scheduler ID 0-bvt,4-sedf"
+      "        [none] on failure.\n" },
+
+    { "sched_param",
+      (PyCFunction)pyxc_sched_param,
+      METH_VARARGS, "\n"
+      "Get scheduling parameters for the scheduler being used\n"
+      "dom [int] Identifier of a domain"
+      "Returns [dict]: Scheduler parameters"
+      "        [None]: on failure.\n" },
+
     { "xeninfo",
       (PyCFunction)pyxc_xeninfo,
       METH_NOARGS, "\n"
tools/python/xen/xend/XendClient.py +25 -0
diff -Naurp xen-3.0.0/tools/python/xen/xend/XendClient.py xen-3.0.0-sched-param/tools/python/xen/xend/XendClient.py
@@ -291,6 +291,31 @@ class Xend:
 			      'extratime' : extratime,
 			      'weight'    : weight })
 
+    ##Scheduler information interface 
+    def xend_sched_id(self):
+	import xen.lowlevel.xc
+	xc = xen.lowlevel.xc.xc()
+	sched_id = xc.sched_id()
+	return sched_id 
+
+    def xend_sched_param(self, id):
+
+	sched_param = {} 
+	import xen.lowlevel.xc
+	xc = xen.lowlevel.xc.xc()
+	if id != -1:
+		sched_param[0] = xc.sched_param(id)
+	else:
+		domid = 0
+		icnt = 0
+		domlist = xc.domain_getinfo()
+		for d in domlist:
+			domid = d['dom']
+			sched_param[icnt] = xc.sched_param(domid)
+			icnt += 1
+
+	return sched_param
+
     def xend_domain_maxmem_set(self, id, memory):
         return self.xendPost(self.domainurl(id),
                              { 'op'      : 'maxmem_set',
tools/python/xen/xm/main.py +73 -3

106 lines not on this page · raw message

_______________________________________________
Xen-users mailing list
[email protected]
http://lists.xensource.com/xen-users

#1 lore raw
Quoted 31 lines · Subhabrata Bhattacharya

Hi All,

The attached patch adds two simple scheduler related capabilities to the xm tool.

$ xm sched-info
## Displays the name of the current scheduler (sedf/bvt)
$ xm sched-param [domid]
## If domid is supplied, then the scheduler parameters for the
corresponding domain is displayed, else scheduler parameters for all
the domains are displayed.

Example:

[root@tux06 ~]# xm sched-info
Domain Scheduler : bvt

[root@tux06 ~]# xm sched-param

Scheduler : bvt
---------------
Domain MCuAdv WarpBack WarpValue WarpL WarpU
0 20 80 99
2000000 9000000
88 20 80 91
2000000 9000000
90 10 0 0
2000000000000000 1000000000000000

Quoted 5 lines

The above commands will aid an administrator in monitoring and modifying scheduler related parameters for a pool of Xen virtual machines.

Please review and let me know your comments on this patch.

If you're going to patch xm, could you please also update the man page and the documentation?

Thanks,
Dan

#2 lore raw
Quoted 2 lines

If you're going to patch xm, could you please also update the man page and the documentation?

Yeah Sure.

Regards,
Subh

Quoted 46 lines · Daniel Stekloff
Quoted 31 lines · Subhabrata Bhattacharya

Hi All,

The attached patch adds two simple scheduler related capabilities to the xm tool.

$ xm sched-info
## Displays the name of the current scheduler (sedf/bvt)
$ xm sched-param [domid]
## If domid is supplied, then the scheduler parameters for the
corresponding domain is displayed, else scheduler parameters for all
the domains are displayed.

Example:

[root@tux06 ~]# xm sched-info
Domain Scheduler : bvt

[root@tux06 ~]# xm sched-param

Scheduler : bvt
---------------
Domain MCuAdv WarpBack WarpValue WarpL WarpU
0 20 80 99
2000000 9000000
88 20 80 91
2000000 9000000
90 10 0 0
2000000000000000 1000000000000000

Quoted 5 lines

The above commands will aid an administrator in monitoring and modifying scheduler related parameters for a pool of Xen virtual machines.

Please review and let me know your comments on this patch.

If you're going to patch xm, could you please also update the man page and the documentation?

Thanks,
Dan

#3 lore raw
In reply to Subhabrata Bhattacharya
Quoted 32 lines · Subhabrata Bhattacharya

Hi All,

The attached patch adds two simple scheduler related capabilities to the xm tool.

[Snip]

diff -Naurp xen-3.0.0/tools/python/xen/xend/XendClient.py xen-3.0.0-sched-param/tools/python/xen/xend/XendClient.py

tools/python/xen/xend/XendClient.py +18 -0
@@ -291,6 +291,31 @@ class Xend:
 			      'extratime' : extratime,
 			      'weight'    : weight })
 
+    ##Scheduler information interface 
+    def xend_sched_id(self):
+	import xen.lowlevel.xc
+	xc = xen.lowlevel.xc.xc()
+	sched_id = xc.sched_id()
+	return sched_id 
+
+    def xend_sched_param(self, id):
+
+	sched_param = {} 
+	import xen.lowlevel.xc
+	xc = xen.lowlevel.xc.xc()
+	if id != -1:
+		sched_param[0] = xc.sched_param(id)
+	else:
+		domid = 0
+		icnt = 0
+		domlist = xc.domain_getinfo()

tools/python/xen/xend/XendClient.py class Xend: · line 321

Quoted 10 lines
tools/python/xen/xend/XendClient.py +7 -0
+		for d in domlist:
+			domid = d['dom']
+			sched_param[icnt] = xc.sched_param(domid)
+			icnt += 1
+
+	return sched_param
+
     def xend_domain_maxmem_set(self, id, memory):
         return self.xendPost(self.domainurl(id),
                              { 'op'      : 'maxmem_set',

Hi Subhabrata,

What you've done here is put the actual interfacing with Xen (i.e. the xc calls) into XendClient, the code running as the client (xm). This will mean that this code will work fine when you are running xm on the machine that you are monitoring, but it won't work at all in other situations. In the long run, people will be using libvirt, for example, to talk XML-RPC to Xend to manage a machine remotely, and your code won't work in that situation, because you have no server-side aspect to your code.

Follow the path for something like getVCPUInfo from main.py into XMLRPCServer.py and XendDomainInfo.py -- you ought to be doing something like that, I think.

Note also that XMLRPCServer is new since your patch and more or less removes the need for XendClient.py. It's hopefully simpler, so shouldn't give you any difficulty.

The rest of your patch looked good to me. I'm not an expert on the scheduler side of things, so someone else might comment, but it looked OK to me.

Thanks,

Ewan.