From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZEOF-0005Jy-Oq for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:08:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZENy-0002q0-KC for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:08:47 -0500 Received: from mx2.parallels.com ([199.115.105.18]:50829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZENy-0002mf-0q for qemu-devel@nongnu.org; Fri, 26 Feb 2016 04:08:30 -0500 Message-ID: <56D015F8.5030600@virtuozzo.com> Date: Fri, 26 Feb 2016 12:08:08 +0300 From: Vladimir Sementsov-Ogievskiy MIME-Version: 1.0 References: <1456343639-3471-1-git-send-email-mst@redhat.com> <1456343639-3471-6-git-send-email-mst@redhat.com> <56CEA6BE.60504@virtuozzo.com> <20160225102409-mutt-send-email-mst@redhat.com> <56CEC19C.4020400@virtuozzo.com> <20160225110947-mutt-send-email-mst@redhat.com> <56CECF63.5060002@virtuozzo.com> <56CED2CC.3040208@redhat.com> <20160225122131-mutt-send-email-mst@redhat.com> In-Reply-To: <20160225122131-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 05/23] pc-dimm: add pc_dimm_build_list() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Paolo Bonzini Cc: Peter Maydell , qemu-devel@nongnu.org, Igor Mammedov On 25.02.2016 13:22, Michael S. Tsirkin wrote: > On Thu, Feb 25, 2016 at 11:09:16AM +0100, Paolo Bonzini wrote: >> >> On 25/02/2016 10:54, Vladimir Sementsov-Ogievskiy wrote: >>> On 25.02.2016 12:11, Michael S. Tsirkin wrote: >>>> On Thu, Feb 25, 2016 at 11:55:56AM +0300, Vladimir Sementsov-Ogievskiy >>>> wrote: >>>>> On 25.02.2016 11:39, Michael S. Tsirkin wrote: >>>>>> On Thu, Feb 25, 2016 at 10:01:18AM +0300, Vladimir >>>>>> Sementsov-Ogievskiy wrote: >>>>>>> Stop! >>>>>> It builds fine here. Did you check out my tree? >>>>> anyway, this file should be here, as it is added into Makefile: >>>>> >>>>> --- a/stubs/Makefile.objs >>>>> +++ b/stubs/Makefile.objs >>>>> @@ -35,7 +35,7 @@ stub-obj-y += vmstate.o >>>>> stub-obj-$(CONFIG_WIN32) += fd-register.o >>>>> stub-obj-y += cpus.o >>>>> stub-obj-y += kvm.o >>>>> -stub-obj-y += qmp_pc_dimm_device_list.o >>>>> +stub-obj-y += pc_dimm.o >>>>> stub-obj-y += target-monitor-defs.o >>>>> stub-obj-y += target-get-monitor-def.o >>>>> stub-obj-y += vhost.o >>>>> >>>> Hmm that's right. >>>> Thanks! >>>> Looks like it was picking up an old object in the filesystem :( >>>> I'll respin - for now, does everything work for you if you drop >>>> this line from the makefile? >>> it will break compilation for targets without memory hotplug, it was >>> discussed on list. stubs are necessary. >> mst, >> >> indeed it's not clear to me why you're deleting qmp_pc_dimm_device_list.c... >> >> On the other hand, pc_dimm_build_list doesn't need a stub. Just put it >> in hw/virtio/virtio-balloon.c. >> >> Paolo > Like this then? > > diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h > index 0f587a4..f6cbc78 100644 > --- a/include/hw/mem/pc-dimm.h > +++ b/include/hw/mem/pc-dimm.h > @@ -95,6 +95,4 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms, > void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms, > MemoryRegion *mr); > > -int pc_dimm_build_list(Object *obj, void *opaque); > - > #endif > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c > index 09e99ce..835179e 100644 > --- a/hw/mem/pc-dimm.c > +++ b/hw/mem/pc-dimm.c > @@ -267,21 +267,6 @@ static int pc_dimm_build_list_sorted(Object *obj, void *opaque) > return 0; > } > > -int pc_dimm_build_list(Object *obj, void *opaque) > -{ > - GSList **list = opaque; > - > - if (object_dynamic_cast(obj, TYPE_PC_DIMM)) { > - DeviceState *dev = DEVICE(obj); > - if (dev->realized) { /* only realized DIMMs matter */ > - *list = g_slist_prepend(*list, dev); > - } > - } > - > - object_child_foreach(obj, pc_dimm_build_list, opaque); > - return 0; > -} > - > uint64_t pc_dimm_get_free_addr(uint64_t address_space_start, > uint64_t address_space_size, > uint64_t *hint, uint64_t align, uint64_t size, > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c > index 3fb6c52..24eab0a 100644 > --- a/hw/virtio/virtio-balloon.c > +++ b/hw/virtio/virtio-balloon.c > @@ -305,12 +305,27 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data) > memcpy(config_data, &config, sizeof(struct virtio_balloon_config)); > } > > +int build_dimm_list(Object *obj, void *opaque) better is make it static, as it is used only here. > +{ > + GSList **list = opaque; > + > + if (object_dynamic_cast(obj, TYPE_PC_DIMM)) { > + DeviceState *dev = DEVICE(obj); > + if (dev->realized) { /* only realized DIMMs matter */ > + *list = g_slist_prepend(*list, dev); > + } > + } > + > + object_child_foreach(obj, build_dimm_list, opaque); > + return 0; > +} > + > static ram_addr_t get_current_ram_size(void) > { > GSList *list = NULL, *item; > ram_addr_t size = ram_size; > > - pc_dimm_build_list(qdev_get_machine(), &list); > + build_dimm_list(qdev_get_machine(), &list); > for (item = list; item; item = g_slist_next(item)) { > Object *obj = OBJECT(item->data); > if (!strcmp(object_get_typename(obj), TYPE_PC_DIMM)) { > > -- Best regards, Vladimir