All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check for valid CPU_CAP value when creating (constructing) new domain
@ 2009-03-30  6:43 Michal Novotny
  2009-03-30  7:07 ` Masaki Kanno
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Novotny @ 2009-03-30  6:43 UTC (permalink / raw)
  To: xen-devel

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

Hi,

This patch implements check for valid cpu_cap value when creating domain (in range 0 to VcpuCount * 100 as when changing scheduler parameters).

Signed-off-by: Michal Novotny <minovotn@redhat.com>


[-- Attachment #2: xen-valid-cap-value-when-creating-domain.patch --]
[-- Type: text/plain, Size: 753 bytes --]

diff -r 0b13d9787622 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 24 06:55:29 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 30 08:39:01 2009 +0200
@@ -2305,6 +2305,11 @@
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
 
+        cap = self.getCap()
+        if cap < 0 or cap > self.info['VCPUs_max'] * 100:
+            raise VmError("Invalid CAP range, valid range is from 0 to %s for specified number of vcpus" %
+                         (int(self.info['VCPUs_max']) * 100) )
+
         # Test whether the devices can be assigned with VT-d
         pci = self.info["platform"].get("pci")
         pci_str = ''

[-- 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] Check for valid CPU_CAP value when creating (constructing) new domain
  2009-03-30  6:43 [PATCH] Check for valid CPU_CAP value when creating (constructing) new domain Michal Novotny
@ 2009-03-30  7:07 ` Masaki Kanno
  2009-03-30  7:35   ` Michal Novotny
  0 siblings, 1 reply; 5+ messages in thread
From: Masaki Kanno @ 2009-03-30  7:07 UTC (permalink / raw)
  To: Michal Novotny, xen-devel

Hi Michal,

Why does the patch implement only CPU_CAP?
You should consider CPU_WEIGHT too.
And you should consider scheduler types too.

Best regards,
 Kan

Mon, 30 Mar 2009 08:43:07 +0200, Michal Novotny wrote:

>Hi,
>
>This patch implements check for valid cpu_cap value when creating domain (
>in range 0 to VcpuCount * 100 as when changing scheduler parameters).
>
>Signed-off-by: Michal Novotny <minovotn@redhat.com>
>
>
>-------------------------------text/plain-------------------------------
>_______________________________________________
>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] Check for valid CPU_CAP value when creating (constructing) new domain
  2009-03-30  7:07 ` Masaki Kanno
@ 2009-03-30  7:35   ` Michal Novotny
  2009-03-30  7:52     ` [PATCH] Check for valid CPU_CAP value when creating(constructing) " Masaki Kanno
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Novotny @ 2009-03-30  7:35 UTC (permalink / raw)
  To: Masaki Kanno; +Cc: xen-devel

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

Hi Kan,
this is new version of my patch implementing check for both CPU_CAP and 
CPU_WEIGHT and also considering int type for both (asserting it).

Best regards,
Michal

Masaki Kanno wrote:
> Hi Michal,
>
> Why does the patch implement only CPU_CAP?
> You should consider CPU_WEIGHT too.
> And you should consider scheduler types too.
>
> Best regards,
>  Kan
>
> Mon, 30 Mar 2009 08:43:07 +0200, Michal Novotny wrote:
>
>   
>> Hi,
>>
>> This patch implements check for valid cpu_cap value when creating domain (
>> in range 0 to VcpuCount * 100 as when changing scheduler parameters).
>>
>> Signed-off-by: Michal Novotny <minovotn@redhat.com>
>>
>>
>> -------------------------------text/plain-------------------------------
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>     
>
>   


[-- Attachment #2: xen-valid-cap-value-when-creating-domain.patch --]
[-- Type: text/plain, Size: 967 bytes --]

diff -r 0b13d9787622 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 24 06:55:29 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 30 09:27:37 2009 +0200
@@ -2305,6 +2305,20 @@
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
 
+	# Check for cpu_{cap|weight} validity
+	cap = self.getCap()
+	weight = self.getWeight()
+
+	assert type(weight) == int
+	assert type(cap) == int
+
+	if weight < 1 or weight > 65535:
+	    raise VmError("Cpu weight out of range, valid values are within range from 1 to 65535")
+
+	if cap < 0 or cap > dominfo.getVCpuCount() * 100:
+	    raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
+			  (dominfo.getVCpuCount() * 100))
+
         # Test whether the devices can be assigned with VT-d
         pci = self.info["platform"].get("pci")
         pci_str = ''

[-- 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] Check for valid CPU_CAP value when creating(constructing) new domain
  2009-03-30  7:35   ` Michal Novotny
@ 2009-03-30  7:52     ` Masaki Kanno
  2009-03-30  7:55       ` Michal Novotny
  0 siblings, 1 reply; 5+ messages in thread
From: Masaki Kanno @ 2009-03-30  7:52 UTC (permalink / raw)
  To: Michal Novotny; +Cc: xen-devel

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1483 bytes --]

Hi Michal,

I have added the following fixes to your patch.
 - Check scheduler type
 - Replace tab-indent with space-indent

How about the patch?

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>

Best regards,
 Kan


Mon, 30 Mar 2009 09:35:42 +0200, Michal Novotny wrote:

>Hi Kan,
>this is new version of my patch implementing check for both CPU_CAP and 
>CPU_WEIGHT and also considering int type for both (asserting it).
>
>Best regards,
>Michal
>
>Masaki Kanno wrote:
>> Hi Michal,
>>
>> Why does the patch implement only CPU_CAP?
>> You should consider CPU_WEIGHT too.
>> And you should consider scheduler types too.
>>
>> Best regards,
>>  Kan
>>
>> Mon, 30 Mar 2009 08:43:07 +0200, Michal Novotny wrote:
>>
>>   
>>> Hi,
>>>
>>> This patch implements check for valid cpu_cap value when creating domain (
>>> in range 0 to VcpuCount * 100 as when changing scheduler parameters).
>>>
>>> Signed-off-by: Michal Novotny <minovotn@redhat.com>
>>>
>>>
>>> -------------------------------text/plain-------------------------------
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>     
>>
>>   
>
>
>-------------------------------text/plain-------------------------------
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel

[-- Attachment #2: xen-valid-cap-value-when-creating-domain.patch --]
[-- Type: application/octet-stream, Size: 1190 bytes --]

diff -r 0b13d9787622 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Tue Mar 24 06:55:29 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Mar 30 16:40:33 2009 +0900
@@ -2305,6 +2305,21 @@ class XendDomainInfo:
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
 
+        # Check for cpu_{cap|weight} validity for credit scheduler
+        if XendNode.instance().xenschedinfo() == 'credit':
+            cap = self.getCap()
+            weight = self.getWeight()
+
+            assert type(weight) == int
+            assert type(cap) == int
+
+            if weight < 1 or weight > 65535:
+                raise VmError("Cpu weight out of range, valid values are within range from 1 to 65535")
+
+            if cap < 0 or cap > dominfo.getVCpuCount() * 100:
+                raise VmError("Cpu cap out of range, valid range is from 0 to %s for specified number of vcpus" %
+                              (dominfo.getVCpuCount() * 100))
+
         # Test whether the devices can be assigned with VT-d
         pci = self.info["platform"].get("pci")
         pci_str = ''

[-- 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] Check for valid CPU_CAP value when creating(constructing) new domain
  2009-03-30  7:52     ` [PATCH] Check for valid CPU_CAP value when creating(constructing) " Masaki Kanno
@ 2009-03-30  7:55       ` Michal Novotny
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Novotny @ 2009-03-30  7:55 UTC (permalink / raw)
  To: Masaki Kanno, xen-devel

Hi Kan,
looks fine to me. Sorry about indents - I forgot I was writing it in 
gedit now and not Midnight Commander editor - and that I forgot about 
scheduler type.

Best regards,
   Michal

Masaki Kanno wrote:
> Hi Michal,
>
> I have added the following fixes to your patch.
>  - Check scheduler type
>  - Replace tab-indent with space-indent
>
> How about the patch?
>
> Signed-off-by: Michal Novotny <minovotn@redhat.com>
> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>
> Best regards,
>  Kan
>
>
> Mon, 30 Mar 2009 09:35:42 +0200, Michal Novotny wrote:
>
>   
>> Hi Kan,
>> this is new version of my patch implementing check for both CPU_CAP and 
>> CPU_WEIGHT and also considering int type for both (asserting it).
>>
>> Best regards,
>> Michal
>>
>> Masaki Kanno wrote:
>>     
>>> Hi Michal,
>>>
>>> Why does the patch implement only CPU_CAP?
>>> You should consider CPU_WEIGHT too.
>>> And you should consider scheduler types too.
>>>
>>> Best regards,
>>>  Kan
>>>
>>> Mon, 30 Mar 2009 08:43:07 +0200, Michal Novotny wrote:
>>>
>>>   
>>>       
>>>> Hi,
>>>>
>>>> This patch implements check for valid cpu_cap value when creating domain (
>>>> in range 0 to VcpuCount * 100 as when changing scheduler parameters).
>>>>
>>>> Signed-off-by: Michal Novotny <minovotn@redhat.com>
>>>>
>>>>
>>>> -------------------------------text/plain-------------------------------
>>>> _______________________________________________
>>>> Xen-devel mailing list
>>>> Xen-devel@lists.xensource.com
>>>> http://lists.xensource.com/xen-devel
>>>>     
>>>>         
>>>   
>>>       
>> -------------------------------text/plain-------------------------------
>> _______________________________________________
>> 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-03-30  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-30  6:43 [PATCH] Check for valid CPU_CAP value when creating (constructing) new domain Michal Novotny
2009-03-30  7:07 ` Masaki Kanno
2009-03-30  7:35   ` Michal Novotny
2009-03-30  7:52     ` [PATCH] Check for valid CPU_CAP value when creating(constructing) " Masaki Kanno
2009-03-30  7:55       ` Michal Novotny

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.