[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] xen: return different error values for cpupool operations



Today there are several different situations in which moving a cpu
from or to a cpupool will return -EBUSY. This makes it hard for the
user to know what he did wrong, as the Xen tools are not capable to
print a detailed error message.

Depending on the situation return different error codes in order to
enable the tools to print useful messages.

Requested-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/cpupool.c  | 10 +++++-----
 xen/common/schedule.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index d0189f8..5dacc61 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -264,7 +264,7 @@ static int cpupool_assign_cpu_locked(struct cpupool *c, 
unsigned int cpu)
     struct domain *d;
 
     if ( (cpupool_moving_cpu == cpu) && (c != cpupool_cpu_moving) )
-        return -EBUSY;
+        return -EADDRNOTAVAIL;
     ret = schedule_cpu_switch(cpu, c);
     if ( ret )
         return ret;
@@ -301,7 +301,7 @@ static long cpupool_unassign_cpu_helper(void *info)
     spin_lock(&cpupool_lock);
     if ( c != cpupool_cpu_moving )
     {
-        ret = -EBUSY;
+        ret = -EADDRNOTAVAIL;
         goto out;
     }
 
@@ -366,7 +366,7 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned 
int cpu)
                     c->cpupool_id, cpu);
 
     spin_lock(&cpupool_lock);
-    ret = -EBUSY;
+    ret = -EADDRNOTAVAIL;
     if ( (cpupool_moving_cpu != -1) && (cpu != cpupool_moving_cpu) )
         goto out;
     if ( cpumask_test_cpu(cpu, &cpupool_locked_cpus) )
@@ -537,7 +537,7 @@ static int cpupool_cpu_add(unsigned int cpu)
  */
 static int cpupool_cpu_remove(unsigned int cpu)
 {
-    int ret = -EBUSY;
+    int ret = -ENODEV;
 
     spin_lock(&cpupool_lock);
     if ( system_state == SYS_STATE_suspend )
@@ -647,7 +647,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)
         ret = -EINVAL;
         if ( cpu >= nr_cpu_ids )
             goto addcpu_out;
-        ret = -EBUSY;
+        ret = -ENODEV;
         if ( !cpumask_test_cpu(cpu, &cpupool_free_cpus) )
             goto addcpu_out;
         c = cpupool_find_by_id(op->cpupool_id);
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 013e5f1..5546999 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -688,7 +688,7 @@ int cpu_disable_scheduler(unsigned int cpu)
                 {
                     /* The vcpu is temporarily pinned, can't move it. */
                     vcpu_schedule_unlock_irqrestore(lock, flags, v);
-                    ret = -EBUSY;
+                    ret = -EADDRINUSE;
                     break;
                 }
 
-- 
2.6.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.