Skip to contentSkip to conversation

xen: enable per-VCPU parameter for RTDS

PATCH In review Chong Li 4 participants 4 messages Apr 4, 2016 – Apr 5, 2016

lore
Share & tools
lore

Chong Li

author
#0 lore raw

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

From: Chong-Li <[email protected]>

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.

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  | 1 +
 xen/common/sched_credit2.c | 1 +
 2 files changed, 2 insertions(+)
xen/common/sched_credit.c +1 -0
index e5d15d8..fa6b7f0 100644
@@ -1101,6 +1101,7 @@ csched_dom_cntl(
             sdom->cap = op->u.credit.cap;
         break;
     default:
+        spin_unlock_irqrestore(&prv->lock, flags);
         return -EINVAL;
     }
 
xen/common/sched_credit2.c +1 -0
index d48ed5a..cf444c9 100644
@@ -1457,6 +1457,7 @@ csched2_dom_cntl(
         }
         break;
     default:
+        spin_unlock_irqrestore(&prv->lock, flags);
         return -EINVAL;
     }
 
Signature · 7 lines
1.9.1


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

From: Chong-Li <[email protected]>

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 (which is far more of a problem than just the spinlock).

Quoted 6 lines

Fix it.

This patch is not SoB by anyone other than you.

Quoted 20 lines

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

---
 xen/common/sched_credit.c  | 1 +
 xen/common/sched_credit2.c | 1 +
 2 files changed, 2 insertions(+)
xen/common/sched_credit.c +0 -0
index e5d15d8..fa6b7f0 100644

xen/common/sched_credit.c csched_dom_cntl( · line 1107

Quoted 7 lines
xen/common/sched_credit.c +1 -0
@@ -1101,6 +1101,7 @@ csched_dom_cntl(
             sdom->cap = op->u.credit.cap;
         break;
     default:
+        spin_unlock_irqrestore(&prv->lock, flags);
         return -EINVAL;
     }
 

While Dario didn't care too much how you fixed the issue, I do.

Please use an "int rc = 0" and remove remove the return statement (instead, assigning rc = -EINVAL; and a break;). It makes far more readable and understandable code, which is better in the long run.

~Andrew

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

#2 lore raw
Quoted 50 lines · Andrew Cooper
Quoted 6 lines · Chong Li

From: Chong-Li <[email protected]>

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 (which is far more of a problem than just the spinlock).

Quoted 6 lines

Fix it.

This patch is not SoB by anyone other than you.

Quoted 20 lines

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

---
 xen/common/sched_credit.c  | 1 +
 xen/common/sched_credit2.c | 1 +
 2 files changed, 2 insertions(+)
xen/common/sched_credit.c +0 -0
index e5d15d8..fa6b7f0 100644

xen/common/sched_credit.c csched_dom_cntl( · line 1107

Quoted 7 lines
xen/common/sched_credit.c +1 -0
@@ -1101,6 +1101,7 @@ csched_dom_cntl(
             sdom->cap = op->u.credit.cap;
         break;
     default:
+        spin_unlock_irqrestore(&prv->lock, flags);
         return -EINVAL;
     }
 

While Dario didn't care too much how you fixed the issue, I do.

Quoted 3 lines

Please use an "int rc = 0" and remove remove the return statement (instead, assigning rc = -EINVAL; and a break;). It makes far more readable and understandable code, which is better in the long run.

Well Dario's a scheduler maintainer and you're not.

But in any case, I also prefer the rc / break (or goto out) pattern enough to ask for a re-send. (But I now see that a v3 has already been sent.)

-George

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

#3 lore raw
Quoted 22 lines · George Dunlap
Quoted 21 lines · Andrew Cooper
Quoted 13 lines · Chong Li

---
 xen/common/sched_credit.c  | 1 +
 xen/common/sched_credit2.c | 1 +

 2 files changed, 2 insertions(+)
xen/common/sched_credit.c +0 -0
index e5d15d8..fa6b7f0 100644
@@ -1101,6 +1101,7 @@ csched_dom_cntl(
              sdom->cap = op->u.credit.cap;
          break;
Quoted 5 lines

     default:
+        spin_unlock_irqrestore(&prv->lock, flags); return -EINVAL;
     }

While Dario didn't care too much how you fixed the issue, I do.

Quoted 6 lines
Quoted 3 lines

Please use an "int rc = 0" and remove remove the return statement (instead, assigning rc = -EINVAL; and a break;).  It makes far more readable and understandable code, which is better in the long run.

Well Dario's a scheduler maintainer and you're not.

Eheh :-)

Quoted 5 lines

But in any case, I also prefer the rc / break (or goto out) pattern enough to ask for a re-send.  (But I now see that a v3 has already been
sent.)

Yeah, I said I was ok in the event that we wanted to check in the fix ASAP, editing the changelog during commit. If a resend were to be done, I'd have hoped the structure to be changed as said above... I probably should have said it more explicitly.

Impressive that we're all on the same page (at least, from a technical point of view! :-P)

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