xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>,
	wei.liu2@citrix.com, andrew.cooper3@citrix.com,
	dario.faggioli@citrix.com, ian.jackson@eu.citrix.com,
	david.vrabel@citrix.com, jbeulich@suse.com
Subject: [PATCH 1/3] xen: return different error values for cpupool operations
Date: Fri, 15 Apr 2016 16:54:15 +0200	[thread overview]
Message-ID: <1460732057-30032-2-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1460732057-30032-1-git-send-email-jgross@suse.com>

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(-)

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@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-04-15 14:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 14:54 [PATCH 0/3] adjust error return values for cpupool operations Juergen Gross
2016-04-15 14:54 ` Juergen Gross [this message]
2016-04-15 15:18   ` [PATCH 1/3] xen: return different error " Ian Jackson
2016-04-15 15:25     ` Dario Faggioli
2016-04-20 11:23   ` Jan Beulich
2016-04-15 14:54 ` [PATCH 2/3] libxc: adjust retry loop in xc_cpupool_removecpu() Juergen Gross
2016-04-15 15:19   ` Ian Jackson
2016-04-15 15:26     ` Dario Faggioli
2016-04-15 16:07   ` Alan Robinson
2016-04-20 13:47     ` [PATCH 0/3] adjust error return values for cpupool operations Ian Jackson
2016-04-15 14:54 ` [PATCH 3/3] xen: Document XEN_SYSCTL_CPUPOOL_OP_* error codes Juergen Gross
2016-04-15 15:25   ` Ian Jackson
2016-04-15 16:02     ` Juergen Gross
2016-04-15 14:58 ` [PATCH 0/3] adjust error return values for cpupool operations Wei Liu

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=1460732057-30032-2-git-send-email-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --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).