From: Chong Li <lichong659@gmail.com>
To: xen-devel@lists.xen.org
Cc: Chong Li <chong.li@wustl.edu>,
george.dunlap@eu.citrix.com, dario.faggioli@citrix.com,
mengxu@cis.upenn.edu, jbeulich@suse.com, lichong659@gmail.com,
dgolomb@seas.upenn.edu
Subject: [PATCH v4] xen: sched: fix deadlock when changing scheduling parameters
Date: Tue, 5 Apr 2016 17:22:17 -0500 [thread overview]
Message-ID: <1459894937-4690-1-git-send-email-lichong659@gmail.com> (raw)
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.
Signed-off-by: Chong Li <chong.li@wustl.edu>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
---
CC: <dario.faggioli@citrix.com>
CC: <george.dunlap@eu.citrix.com>
CC: <dgolomb@seas.upenn.edu>
CC: <mengxu@cis.upenn.edu>
CC: <jbeulich@suse.com>
CC: <lichong659@gmail.com>
---
xen/common/sched_credit.c | 6 ++++--
xen/common/sched_credit2.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index e5d15d8..4c4927f 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -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
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index d48ed5a..b8c8e40 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -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 *
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
reply other threads:[~2016-04-05 22:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459894937-4690-1-git-send-email-lichong659@gmail.com \
--to=lichong659@gmail.com \
--cc=chong.li@wustl.edu \
--cc=dario.faggioli@citrix.com \
--cc=dgolomb@seas.upenn.edu \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=mengxu@cis.upenn.edu \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).