Received: from eggs.gnu.org ([2001:4830:134:3::10]:33298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMwNO-0003zX-1z for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMwNJ-0003FX-R6 for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:01:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMwNJ-0003FP-LR for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:01:17 -0400 Date: Tue, 12 Jul 2016 14:01:13 +0200 From: Igor Mammedov Message-ID: <20160712140113.0052795a@nial.brq.redhat.com> In-Reply-To: <20160712022851.GD19132@thinpad.lan.raisama.net> References: <1467786055-85835-1-git-send-email-imammedo@redhat.com> <1467786055-85835-5-git-send-email-imammedo@redhat.com> <20160712022851.GD19132@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 04/19] pc: cpu: consolidate apic-id validity checks in pc_cpu_pre_plug() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, pkrempa@redhat.com, mst@redhat.com, armbru@redhat.com, eduardo.otubo@profitbricks.com, marcel@redhat.com, pbonzini@redhat.com, rth@twiddle.net On Mon, 11 Jul 2016 23:28:51 -0300 Eduardo Habkost wrote: > On Wed, Jul 06, 2016 at 08:20:40AM +0200, Igor Mammedov wrote: > [...] > > +static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, > > + DeviceState *dev, Error **errp) > > +{ > > + int idx; > > + X86CPU *cpu = X86_CPU(dev); > > + PCMachineState *pcms = PC_MACHINE(hotplug_dev); > > + CPUArchId *cpu_slot = pc_find_cpu_slot(pcms, CPU(dev), &idx); > > Why are you passing &idx to pc_find_cpu_slot() here, if you don't > use it for anything? > +static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ [...] + if (cpu_slot->cpu) { + error_setg(errp, "CPU[%ld] with APIC ID %" PRIu32 " exists", + cpu_slot - pcms->possible_cpus->cpus, it should have been used here, so I'll fix this place to use idx and along the way print APIC ID in hex + cpu->apic_id); + return; + } +}