Skip to contentSkip to conversation

xen: enable per-VCPU parameter for RTDS

PATCH In review Chong Li 2 participants 2 messages Apr 4, 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]>

Fix a bug in sched_credit.c and sched_credit2.c: in the default case of csched_dom_cntl and csched2_dom_cntl, function returns without unlocking prv->lock.

---
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
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Chong Li

From: Chong-Li <[email protected]>

Fix a bug in sched_credit.c and sched_credit2.c: in the default case of csched_dom_cntl and csched2_dom_cntl, function returns without unlocking prv->lock.

This should mention what commit introduced the bug. Of course, this is not a requirement for any bugfix, but in cases like this, where we know it, it's IMO an important piece of information.

Also, I find it that the changelog itself contains a lot of information that are already available by looking at the patch itself (e.g., files and function names), while it should be a more high level description of what happened/what is being fixed.

So, with a changelog like this:

  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.

This patch is:

Let me just say that, I think the code would look much better if a 'int rc = 0' variable was declared at the beginning, used like this:

Quoted 8 lines
xen/common/sched_credit.c +0 -0
@@ -1101,6 +1101,7 @@ csched_dom_cntl(
              sdom->cap = op->u.credit.cap;
          break;

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

          rc = -EINVAL;
          break;

and then returned.

But since this is functionally equivalent, I'm ok with the current form, if that can help speeding up things, and I'll be satisfied by an updated changelog.

Thanks for looking into this so quickly,
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