All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][xend] Fix handling of scheduler params
@ 2007-06-06  1:21 Jim Fehlig
  2007-06-06 11:20 ` Masaki Kanno
  2007-06-06 15:12 ` Jim Fehlig
  0 siblings, 2 replies; 4+ messages in thread
From: Jim Fehlig @ 2007-06-06  1:21 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

When creating domains that specify scheduler parameters with XenAPI, the
specified parameters are not used when starting the domain.  As an
example, here is a snippet of internal config for a domain created via
XenAPI that contains scheduling params:

(domain
    (domid 6)
    (vcpus_params ((cap 100) (weight 512)))
    ...
    (cpu_weight 256)
    (cpu_cap 0)
    ...
)

Starting the domain results in following scheduler settings:

jfehlig4:/home/jfehlig/cim/cimxml # xm sched-credit -d sles10_nographic
Name                              ID Weight Cap
sles10_nographic                   6    256    0

The attached patch collapses cpu_weight and cpu_cap in XendConfig into
the vcpus_params dictionary.  The patch has been tested using xm and
XenAPI on config with and without scheduler parameters.

Regards,
Jim

Signed-off-by: Jim Fehlig <jfehlig@novell.com>



[-- Attachment #2: xend_sched_params.patch --]
[-- Type: text/x-patch, Size: 4148 bytes --]

diff -r bd3d6b4c52ec tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py	Fri Jun 01 14:50:52 2007 +0100
+++ b/tools/python/xen/xend/XendConfig.py	Tue Jun 05 18:47:55 2007 -0600
@@ -167,8 +167,6 @@ LEGACY_UNSUPPORTED_BY_XENAPI_CFG = [
     'shadow_memory',
     'security',
     'vcpu_avail',
-    'cpu_weight',
-    'cpu_cap',
     'features',
     # read/write
     'on_xend_start',
@@ -192,8 +190,6 @@ LEGACY_CFG_TYPES = {
     'shadow_memory': int,
     'maxmem':        int,
     'start_time':    float,
-    'cpu_cap':       int,
-    'cpu_weight':    int,
     'cpu_time':      float,
     'features':      str,
     'localtime':     int,
@@ -320,8 +316,6 @@ class XendConfig(dict):
             'on_xend_start': 'ignore',
             'on_xend_stop': 'ignore',
             'cpus': [],
-            'cpu_weight': 256,
-            'cpu_cap': 0,
             'VCPUs_max': 1,
             'VCPUs_live': 1,
             'VCPUs_at_startup': 1,
@@ -481,6 +475,14 @@ class XendConfig(dict):
         if sxp.child_value(sxp_cfg, "maxmem") != None:
             cfg["maxmem"] = int(sxp.child_value(sxp_cfg, "maxmem"))
             
+        # Convert scheduling parameters to vcpus_params
+        if 'vcpus_params' not in cfg:
+            cfg['vcpus_params'] = {}
+        cfg["vcpus_params"]["weight"] = \
+            int(sxp.child_value(sxp_cfg, "cpu_weight", 256))
+        cfg["vcpus_params"]["cap"] = \
+            int(sxp.child_value(sxp_cfg, "cpu_cap", 0))
+
         # Only extract options we know about.
         extract_keys = LEGACY_UNSUPPORTED_BY_XENAPI_CFG
         extract_keys += XENAPI_CFG_TO_LEGACY_CFG.values()
@@ -777,8 +779,6 @@ class XendConfig(dict):
         _set_cfg_if_exists('on_xend_stop')
         _set_cfg_if_exists('on_xend_start')
         _set_cfg_if_exists('vcpu_avail')
-        _set_cfg_if_exists('cpu_weight')
-        _set_cfg_if_exists('cpu_cap')
         
         # Parse and store runtime configuration 
         _set_cfg_if_exists('start_time')
@@ -830,6 +830,10 @@ class XendConfig(dict):
                 self[key] = type_conv(val)
             else:
                 self[key] = val
+                
+        self['vcpus_params']['weight'] = \
+            int(self['vcpus_params'].get('weight', 256))
+        self['vcpus_params']['cap'] = int(self['vcpus_params'].get('cap', 0))
 
     def to_sxp(self, domain = None, ignore_devices = False, ignore = [],
                legacy_only = True):
diff -r bd3d6b4c52ec tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Fri Jun 01 14:50:52 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Jun 05 18:52:12 2007 -0600
@@ -1017,16 +1017,16 @@ class XendDomainInfo:
         return str(self._resume)
 
     def getCap(self):
-        return self.info.get('cpu_cap', 0)
+        return self.info['vcpus_params']['cap']
 
     def setCap(self, cpu_cap):
-        self.info['cpu_cap'] = cpu_cap
+        self.info['vcpus_params']['cap'] = cpu_cap
 
     def getWeight(self):
-        return self.info.get('cpu_weight', 256)
+        return self.info['vcpus_params']['weight']
 
     def setWeight(self, cpu_weight):
-        self.info['cpu_weight'] = cpu_weight
+        self.info['vcpus_params']['weight'] = cpu_weight
 
     def setResume(self, state):
         self._resume = state
@@ -1482,7 +1482,7 @@ class XendDomainInfo:
     def _initDomain(self):
         log.debug('XendDomainInfo.initDomain: %s %s',
                   self.domid,
-                  self.info['cpu_weight'])
+                  self.info['vcpus_params']['weight'])
 
         self._configureBootloader()
 
@@ -1492,7 +1492,8 @@ class XendDomainInfo:
             if self.info['platform'].get('localtime', 0):
                 xc.domain_set_time_offset(self.domid)
 
-            xc.domain_setcpuweight(self.domid, self.info['cpu_weight'])
+            xc.domain_setcpuweight(self.domid, \
+                                   self.info['vcpus_params']['weight'])
 
             # repin domain vcpus if a restricted cpus list is provided
             # this is done prior to memory allocation to aide in memory

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][xend] Fix handling of scheduler params
  2007-06-06  1:21 [PATCH][xend] Fix handling of scheduler params Jim Fehlig
@ 2007-06-06 11:20 ` Masaki Kanno
  2007-06-06 15:12 ` Jim Fehlig
  1 sibling, 0 replies; 4+ messages in thread
From: Masaki Kanno @ 2007-06-06 11:20 UTC (permalink / raw)
  To: Jim Fehlig, xen-devel

Hi Jim,

If the patch is applied, I think that "cpu_weight" and "cpu_cap" 
disappear from information of xm list.  Is my thought right? 

Best regards,
 Kan

>When creating domains that specify scheduler parameters with XenAPI, the
>specified parameters are not used when starting the domain.  As an
>example, here is a snippet of internal config for a domain created via
>XenAPI that contains scheduling params:
>
>(domain
>    (domid 6)
>    (vcpus_params ((cap 100) (weight 512)))
>    ...
>    (cpu_weight 256)
>    (cpu_cap 0)
>    ...
>)
>
>Starting the domain results in following scheduler settings:
>
>jfehlig4:/home/jfehlig/cim/cimxml # xm sched-credit -d sles10_nographic
>Name                              ID Weight Cap
>sles10_nographic                   6    256    0
>
>The attached patch collapses cpu_weight and cpu_cap in XendConfig into
>the vcpus_params dictionary.  The patch has been tested using xm and
>XenAPI on config with and without scheduler parameters.
>
>Regards,
>Jim
>
>Signed-off-by: Jim Fehlig <jfehlig@novell.com>
>
>
>
>-------------------------------text/plain-------------------------------
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][xend] Fix handling of scheduler params
  2007-06-06  1:21 [PATCH][xend] Fix handling of scheduler params Jim Fehlig
  2007-06-06 11:20 ` Masaki Kanno
@ 2007-06-06 15:12 ` Jim Fehlig
  2007-06-07  9:21   ` Masaki Kanno
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Fehlig @ 2007-06-06 15:12 UTC (permalink / raw)
  To: Masaki Kanno; +Cc: xen-devel, Tom Wilkie

Masaki Kanno wrote:
> Hi Jim,
>
> If the patch is applied, I think that "cpu_weight" and "cpu_cap" 
> disappear from information of xm list.  Is my thought right? 
>   

If xm is using the legacy interface, then yes 'xm list --long <dom>'
does not contain cpu_weight|cap.  The info is available using xm sched,
e.g.

jfehlig4:~ # xm sched-credit -d sles10_nographic
Name                              ID Weight Cap
sles10_nographic                  29    512   50

Domain must be running however -  but this is also true to change the
values.

If xm is configured to use XenAPI, which I understand will be the
default soon, you get:

jfehlig4:/usr/lib64/python/site-packages/xen/xend # xm li -l sles10_graphics
(domain
    (PV_args 'TERM=xterm ')
    (VIFs (bea9a278-a393-0186-210b-ea6f45870468))
    (PV_bootloader /usr/lib/xen/boot/domUloader.py)
    (VTPMs ())
    ...

    (VCPUs_params "{'cap': '50', 'weight': '512'}")
    ...
)

Note that using either or both cpu_weight|cap in domain config file
works as before.

How to proceed with this patch depends on when/if xm will be moved to
XenAPI.  If this will not occur for some time,  then I should adjust the
patch to preserve cpu_weight|cap in sexpr.

Regards,
Jim

> Best regards,
>  Kan
>
>   
>> When creating domains that specify scheduler parameters with XenAPI, the
>> specified parameters are not used when starting the domain.  As an
>> example, here is a snippet of internal config for a domain created via
>> XenAPI that contains scheduling params:
>>
>> (domain
>>    (domid 6)
>>    (vcpus_params ((cap 100) (weight 512)))
>>    ...
>>    (cpu_weight 256)
>>    (cpu_cap 0)
>>    ...
>> )
>>
>> Starting the domain results in following scheduler settings:
>>
>> jfehlig4:/home/jfehlig/cim/cimxml # xm sched-credit -d sles10_nographic
>> Name                              ID Weight Cap
>> sles10_nographic                   6    256    0
>>
>> The attached patch collapses cpu_weight and cpu_cap in XendConfig into
>> the vcpus_params dictionary.  The patch has been tested using xm and
>> XenAPI on config with and without scheduler parameters.
>>
>> Regards,
>> Jim
>>
>> Signed-off-by: Jim Fehlig <jfehlig@novell.com>
>>
>>
>>
>> -------------------------------text/plain-------------------------------
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>     
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][xend] Fix handling of scheduler params
  2007-06-06 15:12 ` Jim Fehlig
@ 2007-06-07  9:21   ` Masaki Kanno
  0 siblings, 0 replies; 4+ messages in thread
From: Masaki Kanno @ 2007-06-07  9:21 UTC (permalink / raw)
  To: Jim Fehlig; +Cc: xen-devel, Tom Wilkie, Masaki Kanno


>Masaki Kanno wrote:
>> Hi Jim,
>>
>> If the patch is applied, I think that "cpu_weight" and "cpu_cap" 
>> disappear from information of xm list.  Is my thought right? 
>>   
>
>If xm is using the legacy interface, then yes 'xm list --long <dom>'
>does not contain cpu_weight|cap.  The info is available using xm sched,
>e.g.
>
>jfehlig4:~ # xm sched-credit -d sles10_nographic
>Name                              ID Weight Cap
>sles10_nographic                  29    512   50
>
>Domain must be running however -  but this is also true to change the
>values.
>
>If xm is configured to use XenAPI, which I understand will be the
>default soon, you get:
>
>jfehlig4:/usr/lib64/python/site-packages/xen/xend # xm li -l sles10_graphics
>(domain
>    (PV_args 'TERM=xterm ')
>    (VIFs (bea9a278-a393-0186-210b-ea6f45870468))
>    (PV_bootloader /usr/lib/xen/boot/domUloader.py)
>    (VTPMs ())
>    ...
>
>    (VCPUs_params "{'cap': '50', 'weight': '512'}")
>    ...
>)
>
>Note that using either or both cpu_weight|cap in domain config file
>works as before.
>
>How to proceed with this patch depends on when/if xm will be moved to
>XenAPI.  If this will not occur for some time,  then I should adjust the
>patch to preserve cpu_weight|cap in sexpr.

Hi Jim,

I think that configuration and state of domain had better be 
shown only by information of xm list command.  But I think that 
the patch is necessary for XenAPI.  Therefore I do not intend to 
deny the patch.

I hope that xm is moved to XenAPI.  Or to show values of both 
cpu_weight and cpu_cap of non-running managed domain, I may post 
a patch for xm sched command. 

Best regards,
 Kan

>
>Regards,
>Jim
>
>> Best regards,
>>  Kan
>>
>>   
>>> When creating domains that specify scheduler parameters with XenAPI, the
>>> specified parameters are not used when starting the domain.  As an
>>> example, here is a snippet of internal config for a domain created via
>>> XenAPI that contains scheduling params:
>>>
>>> (domain
>>>    (domid 6)
>>>    (vcpus_params ((cap 100) (weight 512)))
>>>    ...
>>>    (cpu_weight 256)
>>>    (cpu_cap 0)
>>>    ...
>>> )
>>>
>>> Starting the domain results in following scheduler settings:
>>>
>>> jfehlig4:/home/jfehlig/cim/cimxml # xm sched-credit -d sles10_nographic
>>> Name                              ID Weight Cap
>>> sles10_nographic                   6    256    0
>>>
>>> The attached patch collapses cpu_weight and cpu_cap in XendConfig into
>>> the vcpus_params dictionary.  The patch has been tested using xm and
>>> XenAPI on config with and without scheduler parameters.
>>>
>>> Regards,
>>> Jim
>>>
>>> Signed-off-by: Jim Fehlig <jfehlig@novell.com>
>>>
>>>
>>>
>>> -------------------------------text/plain-------------------------------
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>     
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>   
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-07  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06  1:21 [PATCH][xend] Fix handling of scheduler params Jim Fehlig
2007-06-06 11:20 ` Masaki Kanno
2007-06-06 15:12 ` Jim Fehlig
2007-06-07  9:21   ` Masaki Kanno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.