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

[Xen-changelog] [xen-4.1-testing] x86: small fixes to pcpu platform op handling



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1331107980 0
# Node ID ffda50fa20ab376821e19edcdf9042df31fabffe
# Parent  dab13447cd8cdf2e1623538a182dcacbb6ef2077
x86: small fixes to pcpu platform op handling

XENPF_get_cpuinfo should init the flags output field rather than only
modify it.

XENPF_cpu_online must check for the input CPU number to be in range.

XENPF_cpu_offline must also do that, and should also reject attempts
to
offline CPU 0 (this fails in cpu_down() too, but preventing this here
appears more correct given that the code here calls
continue_hypercall_on_cpu(0, ...), which would be flawed if cpu_down()
would ever allow bringing down CPU 0 (and a distinct error code is
easier to deal with when debugging issues).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   24201:9c6bea25f712
xen-unstable date:        Thu Nov 24 17:56:26 2011 +0100
---


diff -r dab13447cd8c -r ffda50fa20ab xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Wed Mar 07 08:10:58 2012 +0000
+++ b/xen/arch/x86/platform_hypercall.c Wed Mar 07 08:13:00 2012 +0000
@@ -420,13 +420,14 @@
         if ( (g_info->xen_cpuid >= NR_CPUS) ||
              !cpu_present(g_info->xen_cpuid) )
         {
-            g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+            g_info->flags = XEN_PCPU_FLAGS_INVALID;
         }
         else
         {
             g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
             g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
             ASSERT(g_info->apic_id != BAD_APICID);
+            g_info->flags = 0;
             if (cpu_online(g_info->xen_cpuid))
                 g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
         }
@@ -443,7 +444,7 @@
     {
         int cpu = op->u.cpu_ol.cpuid;
 
-        if ( !cpu_present(cpu) )
+        if ( cpu >= NR_CPUS || !cpu_present(cpu) )
         {
             ret = -EINVAL;
             break;
@@ -464,7 +465,13 @@
     {
         int cpu = op->u.cpu_ol.cpuid;
 
-        if ( !cpu_present(cpu) )
+        if ( cpu == 0 )
+        {
+            ret = -EOPNOTSUPP;
+            break;
+        }
+
+        if ( cpu >= NR_CPUS || !cpu_present(cpu) )
         {
             ret = -EINVAL;
             break;

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


 


Rackspace

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