qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [FIX PATCH] spapr: Gracefully fail CPU thread unplug


From: David Gibson
Subject: Re: [Qemu-devel] [FIX PATCH] spapr: Gracefully fail CPU thread unplug
Date: Thu, 18 Aug 2016 10:57:04 +1000
User-agent: Mutt/1.6.2 (2016-07-01)

On Wed, Aug 17, 2016 at 07:31:38PM +0530, Bharata B Rao wrote:
> sPAPR supports only Core level CPU plug and unplug, but nothing
> prevents user from issuing a device_del on the underlying thread
> device by using its qom path directly. This hits g_assert(hotplug_ctrl)
> in qdev_unplug().
> 
> Gracefully reject such unplug requests from ->unplug() handler
> 
> Reported-by: Shivaprasad G Bhat <address@hidden>
> Signed-off-by: Bharata B Rao <address@hidden>

Why isn't there a graceful failure if we return NULL from the
hotplug_handler()?  Doesn't that indicate a bug in the generic code?
Couldn't the same error be triggered by attempting to unplug some
other random device - say the RTC on x86, or the NVRAM on POWER?

Also I only just noticed that we've had a misspelling here for ages:
"hotpug_handler".

> ---
>  hw/ppc/spapr.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 30d6800..0e89d7d 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2344,6 +2344,9 @@ static void spapr_machine_device_unplug(HotplugHandler 
> *hotplug_dev,
>              return;
>          }
>          spapr_core_unplug(hotplug_dev, dev, errp);
> +    } else {
> +        error_setg(errp, "Unplug not supported for device type: %s",
> +                   object_get_typename(OBJECT(dev)));
>      }
>  }
>  
> @@ -2359,6 +2362,7 @@ static HotplugHandler 
> *spapr_get_hotpug_handler(MachineState *machine,
>                                               DeviceState *dev)
>  {
>      if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
> +        object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
>          object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
>          return HOTPLUG_HANDLER(machine);
>      }

-- 
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: signature.asc
Description: PGP signature


reply via email to

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