xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Coverity issues for credit2 CAP series
@ 2017-09-27 11:46 Wei Liu
  2017-09-27 11:46 ` [PATCH 1/2] xen/credit2: add missing unlock Wei Liu
  2017-09-27 11:46 ` [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2 Wei Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Liu @ 2017-09-27 11:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

Wei Liu (2):
  xen/credit2: add missing unlock
  python/libxc: extend the call to get/set cap for credit2

 tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++-------
 xen/common/sched_credit2.c        |  1 +
 2 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* [PATCH 1/2] xen/credit2: add missing unlock
  2017-09-27 11:46 [PATCH 0/2] Coverity issues for credit2 CAP series Wei Liu
@ 2017-09-27 11:46 ` Wei Liu
  2017-09-27 12:10   ` Dario Faggioli
  2017-09-27 11:46 ` [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2 Wei Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Liu @ 2017-09-27 11:46 UTC (permalink / raw)
  To: Xen-devel; +Cc: George Dunlap, Dario Faggioli, Wei Liu

Coverity-ID: 1418531

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
---
 xen/common/sched_credit2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index d33c881c3d..18f39cafe4 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -2831,6 +2831,7 @@ csched2_dom_cntl(
             if ( op->u.credit2.cap > 100 * sdom->nr_vcpus )
             {
                 rc = -EINVAL;
+                write_unlock_irqrestore(&prv->lock, flags);
                 break;
             }
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2
  2017-09-27 11:46 [PATCH 0/2] Coverity issues for credit2 CAP series Wei Liu
  2017-09-27 11:46 ` [PATCH 1/2] xen/credit2: add missing unlock Wei Liu
@ 2017-09-27 11:46 ` Wei Liu
  2017-09-27 12:18   ` Dario Faggioli
  2017-09-27 12:38   ` Marek Marczykowski-Górecki
  1 sibling, 2 replies; 6+ messages in thread
From: Wei Liu @ 2017-09-27 11:46 UTC (permalink / raw)
  To: Xen-devel
  Cc: George Dunlap, Dario Faggioli, Wei Liu,
	Marek Marczykowski-Górecki

Commit 68817024 ("xen: credit2: allow to set and get utilization cap")
added a new parameter. Implement it for the python binding as well.

Coverity-ID: 1418532

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Compile-test only.
---
 tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index aa9f8e4d9e..f501764100 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1348,16 +1348,19 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,
 {
     uint32_t domid;
     uint16_t weight;
-    static char *kwd_list[] = { "domid", "weight", NULL };
-    static char kwd_type[] = "I|H";
-    struct xen_domctl_sched_credit2 sdom;
+    uint16_t cap;
+    static char *kwd_list[] = { "domid", "weight", "cap", NULL };
+    static char kwd_type[] = "I|HH";
+    struct xen_domctl_sched_credit2 sdom = { };
 
     weight = 0;
+    cap = 0;
     if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
-                                     &domid, &weight) )
+                                     &domid, &weight, &cap) )
         return NULL;
 
     sdom.weight = weight;
+    sdom.cap = cap;
 
     if ( xc_sched_credit2_domain_set(self->xc_handle, domid, &sdom) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
@@ -1369,7 +1372,7 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,
 static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)
 {
     uint32_t domid;
-    struct xen_domctl_sched_credit2 sdom;
+    struct xen_domctl_sched_credit2 sdom = { };
 
     if( !PyArg_ParseTuple(args, "I", &domid) )
         return NULL;
@@ -1377,8 +1380,8 @@ static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)
     if ( xc_sched_credit2_domain_get(self->xc_handle, domid, &sdom) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
 
-    return Py_BuildValue("{s:H}",
-                         "weight",  sdom.weight);
+    return Py_BuildValue("{s:HH}",
+                         "weight", "cap",  sdom.weight, sdom.cap);
 }
 
 static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH 1/2] xen/credit2: add missing unlock
  2017-09-27 11:46 ` [PATCH 1/2] xen/credit2: add missing unlock Wei Liu
@ 2017-09-27 12:10   ` Dario Faggioli
  0 siblings, 0 replies; 6+ messages in thread
From: Dario Faggioli @ 2017-09-27 12:10 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: George Dunlap


[-- Attachment #1.1: Type: text/plain, Size: 953 bytes --]

On Wed, 2017-09-27 at 12:46 +0100, Wei Liu wrote:
> Coverity-ID: 1418531
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
> index d33c881c3d..18f39cafe4 100644
> --- a/xen/common/sched_credit2.c
> +++ b/xen/common/sched_credit2.c
> @@ -2831,6 +2831,7 @@ csched2_dom_cntl(
>              if ( op->u.credit2.cap > 100 * sdom->nr_vcpus )
>              {
>                  rc = -EINVAL;
> +                write_unlock_irqrestore(&prv->lock, flags);
>
Indeed... :-/

Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2
  2017-09-27 11:46 ` [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2 Wei Liu
@ 2017-09-27 12:18   ` Dario Faggioli
  2017-09-27 12:38   ` Marek Marczykowski-Górecki
  1 sibling, 0 replies; 6+ messages in thread
From: Dario Faggioli @ 2017-09-27 12:18 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: George Dunlap, Marek Marczykowski-Górecki


[-- Attachment #1.1: Type: text/plain, Size: 919 bytes --]

On Wed, 2017-09-27 at 12:46 +0100, Wei Liu wrote:
> Commit 68817024 ("xen: credit2: allow to set and get utilization
> cap")
> added a new parameter. Implement it for the python binding as well.
> 
> Coverity-ID: 1418532
> 
Right. Sorry, I tend to forget about these more often that I would want
to. :-(

I'll try to be more careful.

> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Dario Faggioli <dario.faggioli@citrix.com>
> Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> 
FWIW:

Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2
  2017-09-27 11:46 ` [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2 Wei Liu
  2017-09-27 12:18   ` Dario Faggioli
@ 2017-09-27 12:38   ` Marek Marczykowski-Górecki
  1 sibling, 0 replies; 6+ messages in thread
From: Marek Marczykowski-Górecki @ 2017-09-27 12:38 UTC (permalink / raw)
  To: Wei Liu; +Cc: George Dunlap, Xen-devel, Dario Faggioli


[-- Attachment #1.1: Type: text/plain, Size: 2950 bytes --]

On Wed, Sep 27, 2017 at 12:46:22PM +0100, Wei Liu wrote:
> Commit 68817024 ("xen: credit2: allow to set and get utilization cap")
> added a new parameter. Implement it for the python binding as well.
> 
> Coverity-ID: 1418532
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

> ---
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Dario Faggioli <dario.faggioli@citrix.com>
> Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> 
> Compile-test only.
> ---
>  tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
> index aa9f8e4d9e..f501764100 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -1348,16 +1348,19 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,
>  {
>      uint32_t domid;
>      uint16_t weight;
> -    static char *kwd_list[] = { "domid", "weight", NULL };
> -    static char kwd_type[] = "I|H";
> -    struct xen_domctl_sched_credit2 sdom;
> +    uint16_t cap;
> +    static char *kwd_list[] = { "domid", "weight", "cap", NULL };
> +    static char kwd_type[] = "I|HH";
> +    struct xen_domctl_sched_credit2 sdom = { };
>  
>      weight = 0;
> +    cap = 0;
>      if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
> -                                     &domid, &weight) )
> +                                     &domid, &weight, &cap) )
>          return NULL;
>  
>      sdom.weight = weight;
> +    sdom.cap = cap;
>  
>      if ( xc_sched_credit2_domain_set(self->xc_handle, domid, &sdom) != 0 )
>          return pyxc_error_to_exception(self->xc_handle);
> @@ -1369,7 +1372,7 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,
>  static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)
>  {
>      uint32_t domid;
> -    struct xen_domctl_sched_credit2 sdom;
> +    struct xen_domctl_sched_credit2 sdom = { };
>  
>      if( !PyArg_ParseTuple(args, "I", &domid) )
>          return NULL;
> @@ -1377,8 +1380,8 @@ static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)
>      if ( xc_sched_credit2_domain_get(self->xc_handle, domid, &sdom) != 0 )
>          return pyxc_error_to_exception(self->xc_handle);
>  
> -    return Py_BuildValue("{s:H}",
> -                         "weight",  sdom.weight);
> +    return Py_BuildValue("{s:HH}",
> +                         "weight", "cap",  sdom.weight, sdom.cap);
>  }
>  
>  static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-09-27 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27 11:46 [PATCH 0/2] Coverity issues for credit2 CAP series Wei Liu
2017-09-27 11:46 ` [PATCH 1/2] xen/credit2: add missing unlock Wei Liu
2017-09-27 12:10   ` Dario Faggioli
2017-09-27 11:46 ` [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2 Wei Liu
2017-09-27 12:18   ` Dario Faggioli
2017-09-27 12:38   ` Marek Marczykowski-Górecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).