xcp-1.6-updates/xen-4.1.hg

changeset 23236:ffda50fa20ab

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@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 24201:9c6bea25f712
xen-unstable date: Thu Nov 24 17:56:26 2011 +0100
author Jan Beulich <jbeulich@suse.com>
date Wed Mar 07 08:13:00 2012 +0000 (2012-03-07)
parents dab13447cd8c
children a6bbda6dc322
files xen/arch/x86/platform_hypercall.c
line diff
     1.1 --- a/xen/arch/x86/platform_hypercall.c	Wed Mar 07 08:10:58 2012 +0000
     1.2 +++ b/xen/arch/x86/platform_hypercall.c	Wed Mar 07 08:13:00 2012 +0000
     1.3 @@ -420,13 +420,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
     1.4          if ( (g_info->xen_cpuid >= NR_CPUS) ||
     1.5               !cpu_present(g_info->xen_cpuid) )
     1.6          {
     1.7 -            g_info->flags |= XEN_PCPU_FLAGS_INVALID;
     1.8 +            g_info->flags = XEN_PCPU_FLAGS_INVALID;
     1.9          }
    1.10          else
    1.11          {
    1.12              g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
    1.13              g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
    1.14              ASSERT(g_info->apic_id != BAD_APICID);
    1.15 +            g_info->flags = 0;
    1.16              if (cpu_online(g_info->xen_cpuid))
    1.17                  g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
    1.18          }
    1.19 @@ -443,7 +444,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.20      {
    1.21          int cpu = op->u.cpu_ol.cpuid;
    1.22  
    1.23 -        if ( !cpu_present(cpu) )
    1.24 +        if ( cpu >= NR_CPUS || !cpu_present(cpu) )
    1.25          {
    1.26              ret = -EINVAL;
    1.27              break;
    1.28 @@ -464,7 +465,13 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.29      {
    1.30          int cpu = op->u.cpu_ol.cpuid;
    1.31  
    1.32 -        if ( !cpu_present(cpu) )
    1.33 +        if ( cpu == 0 )
    1.34 +        {
    1.35 +            ret = -EOPNOTSUPP;
    1.36 +            break;
    1.37 +        }
    1.38 +
    1.39 +        if ( cpu >= NR_CPUS || !cpu_present(cpu) )
    1.40          {
    1.41              ret = -EINVAL;
    1.42              break;