qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [RFC PATCH v2 20/23] spapr: Remove vCPU objects after CPU


From: David Gibson
Subject: Re: [Qemu-ppc] [RFC PATCH v2 20/23] spapr: Remove vCPU objects after CPU hot unplug
Date: Wed, 25 Mar 2015 16:46:09 +1100
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Mar 23, 2015 at 07:06:01PM +0530, Bharata B Rao wrote:
> Release the vCPU objects after CPU hot unplug so that vCPU fd
> can be parked and reused.
> 
> Signed-off-by: Bharata B Rao <address@hidden>

I think this patch is simple enough it should just be folded in with
the previous one.

> ---
>  hw/ppc/spapr.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7b8784d..3e56d9e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1886,6 +1886,23 @@ static void spapr_cpu_hotplug_add(DeviceState *dev, 
> CPUState *cs, Error **errp)
>      }
>  }
>  
> +static void spapr_cpu_release(DeviceState *dev, void *opaque)
> +{
> +    CPUState *cs;
> +    int i;
> +    int id = ppc_get_vcpu_dt_id(POWERPC_CPU(CPU(dev)));
> +
> +    for (i = id; i < id + smp_threads; i++) {
> +        CPU_FOREACH(cs) {
> +            PowerPCCPU *cpu = POWERPC_CPU(cs);
> +
> +            if (i == ppc_get_vcpu_dt_id(cpu)) {
> +                cpu_remove(cs);
> +            }
> +        }
> +    }
> +}
> +
>  static void spapr_cpu_hotplug_remove(DeviceState *dev, CPUState *cs,
>                                       Error **errp)
>  {
> @@ -1895,7 +1912,7 @@ static void spapr_cpu_hotplug_remove(DeviceState *dev, 
> CPUState *cs,
>          spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, id);
>      sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
>  
> -    drck->detach(drc, dev, NULL, NULL, errp);
> +    drck->detach(drc, dev, spapr_cpu_release, NULL, errp);
>  }
>  
>  static void spapr_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: pgpQEgXgR4ZiY.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]