diff mbox

[1/3] xen: return different error values for cpupool operations

Message ID 1460732057-30032-2-git-send-email-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß April 15, 2016, 2:54 p.m. UTC
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@eu.citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/cpupool.c  | 10 +++++-----
 xen/common/schedule.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Ian Jackson April 15, 2016, 3:18 p.m. UTC | #1
Juergen Gross writes ("[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.

For what it's worth

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

although I have no real ability to review this code for correctness.

Ian.
Dario Faggioli April 15, 2016, 3:25 p.m. UTC | #2
On Fri, 2016-04-15 at 16:18 +0100, Ian Jackson wrote:
> Juergen Gross writes ("[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.
> For what it's worth
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>

Regards,
Dario
Jan Beulich April 20, 2016, 11:23 a.m. UTC | #3
>>> Juergen Gross <jgross@suse.com> 04/15/16 4:54 PM >>>
>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@eu.citrix.com>
>Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox

Patch

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;
                 }