WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Add CPU status info and a status call to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add CPU status info and a status call to the CPU on/offline sysctls.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Mar 2009 08:35:28 -0700
Delivery-date: Tue, 17 Mar 2009 08:36:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1237299941 0
# Node ID 821a4a8911f08a922075a7947f905ad53d1d0dee
# Parent  372ec886ad0c9c5d470d95f49fa6f012af533eaa
Add CPU status info and a status call to the CPU on/offline sysctls.

Signed-off-by: Frank van der Linden <frank.vanderlinden@xxxxxxx>
---
 xen/arch/x86/smpboot.c      |    4 +++-
 xen/arch/x86/sysctl.c       |   24 +++++++++++++++++++++++-
 xen/include/public/sysctl.h |    9 +++++++++
 3 files changed, 35 insertions(+), 2 deletions(-)

diff -r 372ec886ad0c -r 821a4a8911f0 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Tue Mar 17 14:24:08 2009 +0000
+++ b/xen/arch/x86/smpboot.c    Tue Mar 17 14:25:41 2009 +0000
@@ -1426,8 +1426,10 @@ int __devinit __cpu_up(unsigned int cpu)
         * cpu_callin_map is set during AP kickstart process. Its reset
         * when a cpu is taken offline from cpu_exit_clear().
         */
-       if (!cpu_isset(cpu, cpu_callin_map))
+       if (!cpu_isset(cpu, cpu_callin_map)) {
                ret = __smp_prepare_cpu(cpu);
+               smpboot_restore_warm_reset_vector();
+       }
 
        if (ret)
                return -EIO;
diff -r 372ec886ad0c -r 821a4a8911f0 xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c     Tue Mar 17 14:24:08 2009 +0000
+++ b/xen/arch/x86/sysctl.c     Tue Mar 17 14:25:41 2009 +0000
@@ -38,7 +38,7 @@ long arch_do_sysctl(
 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;
 
diff -r 372ec886ad0c -r 821a4a8911f0 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Tue Mar 17 14:24:08 2009 +0000
+++ b/xen/include/public/sysctl.h       Tue Mar 17 14:25:41 2009 +0000
@@ -262,12 +262,21 @@ typedef struct xen_sysctl_get_pmstat xen
 typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t);
 
+/*
+ * Status codes. Must be greater than 0 to avoid confusing
+ * sysctl callers that see 0 as a plain successful return.
+ */
+#define XEN_CPU_HOTPLUG_STATUS_OFFLINE 1
+#define XEN_CPU_HOTPLUG_STATUS_ONLINE  2
+#define XEN_CPU_HOTPLUG_STATUS_NEW     3
+
 #define XEN_SYSCTL_cpu_hotplug       11
 struct xen_sysctl_cpu_hotplug {
     /* IN variables */
     uint32_t cpu;   /* Physical cpu. */
 #define XEN_SYSCTL_CPU_HOTPLUG_ONLINE  0
 #define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
+#define XEN_SYSCTL_CPU_HOTPLUG_STATUS 2
     uint32_t op;    /* hotplug opcode */
 };
 typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add CPU status info and a status call to the CPU on/offline sysctls., Xen patchbot-unstable <=