Skip to contentSkip to conversation

xen: enable per-VCPU parameter for RTDS

PATCH In review Chong Li 6 participants 6 messages Apr 5, 2016

lore
Share & tools
lore

Chong Li

author
#0 lore raw

PATCH 1/1 xen: enable per-VCPU parameter for RTDS

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced a bug: it made it possible, in Credit and Credit2, when doing domain or vcpu parameters' manipulation, to leave the hypervisor with a spinlock held and interrupts disabled.

Fix it.

---
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>
CC: <[email protected]>

---
 xen/common/sched_credit.c  | 6 ++++--
 xen/common/sched_credit2.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
xen/common/sched_credit.c +4 -2
index e5d15d8..4c4927f 100644
@@ -1075,6 +1075,7 @@ csched_dom_cntl(
     struct csched_dom * const sdom = CSCHED_DOM(d);
     struct csched_private *prv = CSCHED_PRIV(ops);
     unsigned long flags;
+    int rc = 0;
 
     /* Protect both get and put branches with the pluggable scheduler
      * lock. Runq lock not needed anywhere in here. */
@@ -1101,12 +1102,13 @@ csched_dom_cntl(
             sdom->cap = op->u.credit.cap;
         break;
     default:
-        return -EINVAL;
+        rc = -EINVAL;
+        break;
     }
 
     spin_unlock_irqrestore(&prv->lock, flags);
 
-    return 0;
+    return rc;
 }
 
 static inline void
xen/common/sched_credit2.c +4 -2
index d48ed5a..b8c8e40 100644
@@ -1416,6 +1416,7 @@ csched2_dom_cntl(
     struct csched2_dom * const sdom = CSCHED2_DOM(d);
     struct csched2_private *prv = CSCHED2_PRIV(ops);
     unsigned long flags;
+    int rc = 0;
 
     /* Must hold csched2_priv lock to read and update sdom,
      * runq lock to update csvcs. */
@@ -1457,12 +1458,13 @@ csched2_dom_cntl(
         }
         break;
     default:
-        return -EINVAL;
+        rc = -EINVAL;
+        break;
     }
 
     spin_unlock_irqrestore(&prv->lock, flags);
 
-    return 0;
+    return rc;
 }
 
 static void *
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw
Quoted 10 lines · Chong Li

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced a bug: it made it possible, in Credit and Credit2, when doing domain or vcpu parameters' manipulation, to leave the hypervisor with a spinlock held and interrupts disabled.

Fix it.

I'm wondering if the title "xen: enable per-VCPU parameter for RTDS" is suitable for this patch, although I don't have a better title.

The title in my mind is: xen: fix incorrect lock for credit and credit2 I won't fight for this title, though. :-)

Probably no need to resend...

Thanks,

Meng

Signature · 9 lines
Meng Xu
PhD Student in Computer and Information Science
University of Pennsylvania
http://www.cis.upenn.edu/~mengxu/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw
In reply to Chong Li
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 05.04.16 at 03:07, <[email protected]> wrote:

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced a bug: it made it possible, in Credit and Credit2, when doing domain or vcpu parameters' manipulation, to leave the hypervisor with a spinlock held and interrupts disabled.

Fix it.

This appears to be the 3rd variant of the patch, all with the same bogus subject, and no versioning information at all. Please remember that mails can arrive out of order, so there's no way to reliably tell which one got sent first. So for this to go in I'm expecting you to re-send with a proper subject and an indication that this is not the initial version of the patch.

Jan

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

#3 lore raw
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 05.04.16 at 03:07, <[email protected]> wrote:

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced a bug: it made it possible, in Credit and Credit2, when doing domain or vcpu parameters' manipulation, to leave the hypervisor with a spinlock held and interrupts disabled.

Fix it.

Quoted 8 lines
Quoted 1 line

This appears to be the 3rd variant of the patch, all with the same bogus subject, and no versioning information at all. Please remember that mails can arrive out of order, so there's no way to reliably tell which one got sent first. So for this to go in I'm expecting you to re-send with a proper subject and an indication that this is not the initial version of the patch.

And since this version of the patch is functionally different than the one Dario acked, you should drop his Acked-by as well.

Thanks for being responsive in fixing this bug; and sorry for all the criticism, but OSS development is very detail-oriented, and it takes a while to internalize all the rules for how things should be done.

-George

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

#4 lore raw
Quoted 11 lines · George Dunlap
Quoted 10 lines · Jan Beulich

Quoted 3 lines

This appears to be the 3rd variant of the patch, all with the same bogus subject, and no versioning information at all. Please remember that mails can arrive out of order, so there's no way to reliably tell which one got sent first. So for this to go in I'm expecting you to re-send with a proper subject and an indication that this is not the initial version of the patch.

Quoted 4 lines

And since this version of the patch is functionally different than the
one Dario acked, you should drop his Acked-by as well.

Indeed you should have.

But, with the subject fixed (something like "xen: sched: fix deadlock when changing scheduling parameters") and properly versioned, you can add it again:

Quoted 5 lines

Thanks for being responsive in fixing this bug; and sorry for all the criticism, but OSS development is very detail-oriented, and it takes a
while to internalize all the rules for how things should be done.

It does! :-)

Thanks and Regards,
Dario

Signature · 4 lines
<<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)

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

#5 lore raw
In reply to Chong Li
Quoted 10 lines · Chong Li

Commit f7b87b0745b4 ("enable per-VCPU parameter for RTDS") introduced a bug: it made it possible, in Credit and Credit2, when doing domain or vcpu parameters' manipulation, to leave the hypervisor with a spinlock held and interrupts disabled.

Fix it.

Chong, FYI Jan has committed this patch with a proper title. There is no need to send another version.

And for your future contributions please follow the guidelines several maintainers have given you.

Wei.

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