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

Re: [Xen-devel] [PATCH 3/4] Update vcpu hotplug logic



On Fri, May 31, 2013 at 05:33:12PM +0100, Anthony PERARD wrote:
> From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> 
> Add vcpu online/offline check to avoid redundant SCI interrupt.
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
> 
> Port from qemu-xen-traditionnal to qemu-xen.
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
.. some notes below.
> ---
>  hw/acpi_piix4.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index bc7b454..49c38d3 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -706,16 +706,24 @@ static int piix4_device_hotplug(DeviceState *qdev, 
> PCIDevice *dev,
>      return 0;
>  }
>  
> -static void enable_processor(PIIX4PMState *g, int cpu)
> +static int enable_processor(PIIX4PMState *g, int cpu)
>  {
> +    if (g->cpus_sts[cpu/8] & (1 << (cpu%8)))
> +        return 0;

Don't know if the styleguide in QEME is at this point, but I thought
that it was suppose to have space between the "/" and "%", so you have:

    if (g->cpus_sts[cpu / 8] & (1 << (cpu % 8)))

?
> +
>      g->ar.gpe.sts[0] |= 4;
>      g->cpus_sts[cpu/8] |= (1 << (cpu%8));
> +    return 1;
>  }
>  
> -static void disable_processor(PIIX4PMState *g, int cpu)
> +static int disable_processor(PIIX4PMState *g, int cpu)
>  {
> +    if (!(g->cpus_sts[cpu/8] & (1 << (cpu%8))))
> +        return 0;
> +
>      g->ar.gpe.sts[0] |= 4;
>      g->cpus_sts[cpu/8] &= ~(1 << (cpu%8));
> +    return 1;
>  }
>  
>  void qemu_cpu_add_remove(int cpu, int state)
> @@ -725,10 +733,15 @@ void qemu_cpu_add_remove(int cpu, int state)
>          return;
>      }
>  
> -    if (state)
> -        enable_processor(acpi_state, cpu);
> -    else
> -        disable_processor(acpi_state, cpu);
> +    if (state) {
> +        if (!enable_processor(acpi_state, cpu)) {
> +            return;
> +        }
> +    } else {
> +        if (!disable_processor(acpi_state, cpu)) {
> +            return;
> +        }
> +    }
>  
>      pm_update_sci(acpi_state);
>  }
> -- 
> Anthony PERARD
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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