Skip to contentSkip to conversation

save/restore cpu_weight and cpu_cap

PATCH In review Andrew Jones 2 participants 5 messages Jul 31, 2009 – Aug 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 save/restore cpu_weight and cpu_cap

This patch allows vcpus_params cpu_weight and cpu_cap to be saved and restored. Most the code to support this already existed, but the save path needed to be updated to explicitly save these params, and the restore path needed to be updated to resend the params down to the kernel.

(quoted diff) +0 -0

b/tools/python/xen/xend/XendConfig.py

tools/python/xen/xend/XendConfig.py +2 -0
@@ -1088,6 +1088,10 @@
             if self.has_key(legacy) and self[legacy] not in (None, []):
                 sxpr.append([legacy, self[legacy]])
 
+        if self.has_key('vcpus_params'):
+            sxpr.append(['cpu_weight',

int(self['vcpus_params'].get('weight', 256))])
+ sxpr.append(['cpu_cap', int(self['vcpus_params'].get('cap',
0))])
+

         if self.has_key('security_label'):
             sxpr.append(['security_label', self['security_label']])
(quoted diff) +0 -0

b/tools/python/xen/xend/XendDomainInfo.py

tools/python/xen/xend/XendDomainInfo.py +0 -0
@@ -2448,6 +2448,8 @@
                 raise VmError("Cpu cap out of range, valid range is

from 0 to %s for specified number of vcpus" %

                               (self.getVCpuCount() * 100))

+ xc.sched_credit_domain_set(self.domid, weight, cap)
+
# Test whether the devices can be assigned with VT-d self.info.update_platform_pci()
pci = self.info["platform"].get("pci")

#1 lore raw

Argh... I shouldn't cut+paste patches into email editors. Sending again without allowing evil auto-wrap to mess with it.

Andrew

# HG changeset patch
# User Andrew Jones <[email protected]>
# Date 1249039326 -7200
# Node ID 5e4fdbc78430d50d9f66f2f199dfbb1368663613 # Parent 41b2c4e4f6746c638192b88ea37d3d25196850ad save/restore cpu_weight and cpu_cap

This patch allows vcpus_params cpu_weight and cpu_cap to be saved and restored. Most the code to support this already existed, but the save path needed to be updated to explicitly save these params, and the restore path needed to be updated to resend the params down to the kernel.

tools/python/xen/xend/XendConfig.py +4 -0
@@ -1088,6 +1088,10 @@
             if self.has_key(legacy) and self[legacy] not in (None, []):
                 sxpr.append([legacy, self[legacy]])
 
+        if self.has_key('vcpus_params'):
+            sxpr.append(['cpu_weight', int(self['vcpus_params'].get('weight', 256))])
+            sxpr.append(['cpu_cap', int(self['vcpus_params'].get('cap', 0))])
+
         if self.has_key('security_label'):
             sxpr.append(['security_label', self['security_label']])
 
tools/python/xen/xend/XendDomainInfo.py +2 -0
@@ -2448,6 +2448,8 @@
                 raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
                               (self.getVCpuCount() * 100))
 
+            xc.sched_credit_domain_set(self.domid, weight, cap)
+
         # Test whether the devices can be assigned with VT-d
         self.info.update_platform_pci()
         pci = self.info["platform"].get("pci")

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

#2 lore raw
Quoted 3 lines · Andrew Jones

Argh... I shouldn't cut+paste patches into email editors. Sending again without allowing evil auto-wrap to mess with it.

Hi Andrew,

Without your patch, I can save/restore cpu_weight and cpu_cap as follows.

# xm create vm1 cpu_weight=512 cpu_cap=100
Using config file "/etc/xen/vm1".
Started domain vm1 (id=1)
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  1    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 22.504581706)
# xm save vm1 /root/vm1.save
# xm restore /root/vm1.save 
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  2    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 2.200074199)

What is your problem?
How can I reproduce your problem?

FYI, can changeset 19955 help you?

Best regards,
Kan

#3 lore raw

Hi Kan,

Thanks for catching my mess-up. It looks like I messed-up and didn't test on the tip. So I completely missed changeset 19955, which corrects the exact same issue I was attempting to correct. Please disregard my patch submittal.

Andrew

Quoted 40 lines · Masaki Kanno
Quoted 3 lines · Andrew Jones

Argh... I shouldn't cut+paste patches into email editors. Sending again without allowing evil auto-wrap to mess with it.

Hi Andrew,

Without your patch, I can save/restore cpu_weight and cpu_cap as follows.

# xm create vm1 cpu_weight=512 cpu_cap=100
Using config file "/etc/xen/vm1".
Started domain vm1 (id=1)
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  1    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 22.504581706)
# xm save vm1 /root/vm1.save
# xm restore /root/vm1.save 
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  2    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 2.200074199)

What is your problem?
How can I reproduce your problem?

FYI, can changeset 19955 help you?

Best regards,
Kan

#4 lore raw

Hi Kan,

I just caught up on my mail and see that you've submitted a patch that reverts most of 19955 due to the redundant domctl calls after putting in this patch - changeset 20006. That works too.

Andrew

Quoted 57 lines · Andrew Jones

Hi Kan,

Thanks for catching my mess-up. It looks like I messed-up and didn't test on the tip. So I completely missed changeset 19955, which corrects the exact same issue I was attempting to correct. Please disregard my patch submittal.

Andrew

Quoted 31 lines · Masaki Kanno
Quoted 3 lines · Andrew Jones

Argh... I shouldn't cut+paste patches into email editors. Sending again without allowing evil auto-wrap to mess with it.

Hi Andrew,

Without your patch, I can save/restore cpu_weight and cpu_cap as follows.

# xm create vm1 cpu_weight=512 cpu_cap=100
Using config file "/etc/xen/vm1".
Started domain vm1 (id=1)
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  1    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 22.504581706)
# xm save vm1 /root/vm1.save
# xm restore /root/vm1.save 
# xm sched-credit -d vm1
Name                                ID Weight  Cap
vm1                                  2    512  100
# xm list --long vm1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 100)
    (cpu_time 2.200074199)
Quoted 9 lines

What is your problem?
How can I reproduce your problem?

FYI, can changeset 19955 help you?

Best regards,
Kan

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