aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/sysctl.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-17 14:25:41 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-17 14:25:41 +0000
commitb44d50121f8afef94704ff639617d1e32056802e (patch)
tree5bd632d0b808e33a14f4614aca06dd806189384c /xen/arch/x86/sysctl.c
parent6ea019bf653fe043a7b4625c58be7d01876cd7af (diff)
downloadxen-b44d50121f8afef94704ff639617d1e32056802e.tar.gz
xen-b44d50121f8afef94704ff639617d1e32056802e.tar.bz2
xen-b44d50121f8afef94704ff639617d1e32056802e.zip
Add CPU status info and a status call to the CPU on/offline sysctls.
Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
Diffstat (limited to 'xen/arch/x86/sysctl.c')
-rw-r--r--xen/arch/x86/sysctl.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index dbb54ede09..faf3f5157c 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -38,7 +38,7 @@ static long cpu_down_helper(void *data)
long arch_do_sysctl(
struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
{
- long ret = 0;
+ long ret = 0, status;
switch ( sysctl->cmd )
{
@@ -102,19 +102,41 @@ long arch_do_sysctl(
{
unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
+ if (cpu_present(cpu)) {
+ status = cpu_online(cpu) ? XEN_CPU_HOTPLUG_STATUS_ONLINE :
+ XEN_CPU_HOTPLUG_STATUS_OFFLINE;
+ } else {
+ status = -EINVAL;
+ }
+
switch ( sysctl->u.cpu_hotplug.op )
{
case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
ret = cpu_up(cpu);
+ /*
+ * In the case of a true hotplug, this CPU wasn't present
+ * before, so return the 'new' status for it.
+ */
+ if (ret == 0 && status == -EINVAL)
+ status = XEN_CPU_HOTPLUG_STATUS_NEW;
break;
case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE:
ret = continue_hypercall_on_cpu(
0, cpu_down_helper, (void *)(unsigned long)cpu);
break;
+ case XEN_SYSCTL_CPU_HOTPLUG_STATUS:
+ ret = 0;
+ break;
default:
ret = -EINVAL;
break;
}
+
+ /*
+ * If the operation was successful, return the old status.
+ */
+ if (ret >= 0)
+ ret = status;
}
break;