All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][xend] save/restore cpu_weight and cpu_cap
@ 2009-07-31 11:46 Andrew Jones
  2009-07-31 12:37 ` [PATCH v2][xend] " Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2009-07-31 11:46 UTC (permalink / raw)
  To: xen-devel


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.

diff --git a/tools/python/xen/xend/XendConfig.py
b/tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -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']])

diff --git a/tools/python/xen/xend/XendDomainInfo.py
b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -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")

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

* Re: [PATCH v2][xend] save/restore cpu_weight and cpu_cap
  2009-07-31 11:46 [PATCH][xend] save/restore cpu_weight and cpu_cap Andrew Jones
@ 2009-07-31 12:37 ` Andrew Jones
  2009-08-03  1:43   ` Masaki Kanno
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2009-07-31 12:37 UTC (permalink / raw)
  To: xen-devel

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

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

Andrew




[-- Attachment #2: vcpus-params-save-restore.patch --]
[-- Type: text/x-patch, Size: 1760 bytes --]

# HG changeset patch
# User Andrew Jones <drjones@redhat.com>
# 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.

diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py
+++ b/tools/python/xen/xend/XendConfig.py
@@ -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']])
 
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -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")

[-- 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] 5+ messages in thread

* Re: [PATCH v2][xend] save/restore cpu_weight and cpu_cap
  2009-07-31 12:37 ` [PATCH v2][xend] " Andrew Jones
@ 2009-08-03  1:43   ` Masaki Kanno
  2009-08-05 13:34     ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Masaki Kanno @ 2009-08-03  1:43 UTC (permalink / raw)
  To: Andrew Jones, xen-devel

Fri, 31 Jul 2009 14:37:01 +0200, Andrew Jones wrote:

>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

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

* Re: [PATCH v2][xend] save/restore cpu_weight and cpu_cap
  2009-08-03  1:43   ` Masaki Kanno
@ 2009-08-05 13:34     ` Andrew Jones
  2009-08-05 15:05       ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2009-08-05 13:34 UTC (permalink / raw)
  To: Masaki Kanno; +Cc: xen-devel

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


On Mon, 2009-08-03 at 10:43 +0900, Masaki Kanno wrote:
> Fri, 31 Jul 2009 14:37:01 +0200, Andrew Jones wrote:
> 
> >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
> 
> 

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

* Re: [PATCH v2][xend] save/restore cpu_weight and cpu_cap
  2009-08-05 13:34     ` Andrew Jones
@ 2009-08-05 15:05       ` Andrew Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2009-08-05 15:05 UTC (permalink / raw)
  To: Masaki Kanno; +Cc: xen-devel

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


On Wed, 2009-08-05 at 15:34 +0200, Andrew Jones wrote:
> 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
> 
> 
> On Mon, 2009-08-03 at 10:43 +0900, Masaki Kanno wrote:
> > Fri, 31 Jul 2009 14:37:01 +0200, Andrew Jones wrote:
> > 
> > >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
> > 
> > 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2009-08-05 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-31 11:46 [PATCH][xend] save/restore cpu_weight and cpu_cap Andrew Jones
2009-07-31 12:37 ` [PATCH v2][xend] " Andrew Jones
2009-08-03  1:43   ` Masaki Kanno
2009-08-05 13:34     ` Andrew Jones
2009-08-05 15:05       ` Andrew Jones

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.