# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273140857 -3600
# Node ID 1c9f7df0d2d6a6871059e8df0fc0571f7b35e591
# Parent 460d156da874f4c0e763681e02e9b980426a1e22
cpupools: Fix cpupool sysctl locking.
Signed-off-by: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
---
xen/common/cpupool.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff -r 460d156da874 -r 1c9f7df0d2d6 xen/common/cpupool.c
--- a/xen/common/cpupool.c Thu May 06 11:13:22 2010 +0100
+++ b/xen/common/cpupool.c Thu May 06 11:14:17 2010 +0100
@@ -37,6 +37,7 @@ static cpumask_t cpupool_locked_cpus = C
* as it was obtained!
*/
static DEFINE_SPINLOCK(cpupool_lock);
+static DEFINE_SPINLOCK(cpupool_ctl_lock);
DEFINE_PER_CPU(struct cpupool *, cpupool);
@@ -401,6 +402,8 @@ int cpupool_do_sysctl(struct xen_sysctl_
int ret;
struct cpupool *c;
+ spin_lock(&cpupool_ctl_lock);
+
switch ( op->op )
{
@@ -426,9 +429,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
case XEN_SYSCTL_CPUPOOL_OP_DESTROY:
{
- spin_lock(&cpupool_lock);
c = cpupool_find_by_id(op->cpupool_id, 1);
- spin_unlock(&cpupool_lock);
ret = -ENOENT;
if ( c == NULL )
break;
@@ -438,9 +439,7 @@ int cpupool_do_sysctl(struct xen_sysctl_
case XEN_SYSCTL_CPUPOOL_OP_INFO:
{
- spin_lock(&cpupool_lock);
c = cpupool_find_by_id(op->cpupool_id, 0);
- spin_unlock(&cpupool_lock);
ret = -ENOENT;
if ( c == NULL )
break;
@@ -484,9 +483,7 @@ addcpu_out:
{
unsigned cpu;
- spin_lock(&cpupool_lock);
c = cpupool_find_by_id(op->cpupool_id, 0);
- spin_unlock(&cpupool_lock);
ret = -ENOENT;
if ( c == NULL )
break;
@@ -560,6 +557,8 @@ addcpu_out:
}
+ spin_unlock(&cpupool_ctl_lock);
+
return ret;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|