Received: from eggs.gnu.org ([2001:4830:134:3::10]:43362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUZ1-0000zT-Ta for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:56:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPUYx-0003sf-RT for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:55:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUYx-0003sb-LP for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:55:51 -0400 Date: Tue, 19 Jul 2016 09:55:47 -0300 From: Eduardo Habkost Message-ID: <20160719125547.GE3337@thinpad.lan.raisama.net> References: <1468515285-173356-5-git-send-email-imammedo@redhat.com> <1468830682-38702-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1468830682-38702-1-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 04/16] pc: forbid BSP removal List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, pkrempa@redhat.com, bdas@redhat.com, eduardo.otubo@profitbricks.com, mst@redhat.com On Mon, Jul 18, 2016 at 10:31:22AM +0200, Igor Mammedov wrote: > Boot CPU is assumed to always present in QEMU code, so > untile that assumptions are gone, deny removal request, > In another words QEMU won't support BSP hot-unplug. > > Signed-off-by: Igor Mammedov Reviewed-by: Eduardo Habkost > --- > v5: > - s/1st CPU (BSP)/Boot CPU/ > Eduardo Habkost > - intialize idx to -1 and assert on it, > Eduardo Habkost > (note: that should nexer happen in current code as we don't > have stray CPUs and most likely never will, but it doesn't > hurt to cautios) > --- > hw/i386/pc.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index 110f1bf..e15fcc1 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -1757,10 +1757,18 @@ out: > static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, > DeviceState *dev, Error **errp) > { > + int idx = -1; > HotplugHandlerClass *hhc; > Error *local_err = NULL; > PCMachineState *pcms = PC_MACHINE(hotplug_dev); > > + pc_find_cpu_slot(pcms, CPU(dev), &idx); > + assert(idx != -1); > + if (idx == 0) { > + error_setg(&local_err, "Boot CPU is unpluggable"); > + goto out; > + } > + > hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); > > -- > 2.7.4 > -- Eduardo