From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOCFU-0004xd-FI for qemu-devel@nongnu.org; Fri, 05 Apr 2013 15:24:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UOCFN-0007yL-D1 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 15:24:32 -0400 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:37558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOCFN-0007y7-88 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 15:24:25 -0400 Received: by mail-ob0-f169.google.com with SMTP id wp18so3320918obc.28 for ; Fri, 05 Apr 2013 12:24:24 -0700 (PDT) From: Anthony Liguori In-Reply-To: References: <1365168490-29616-1-git-send-email-kwolf@redhat.com> <1365168490-29616-2-git-send-email-kwolf@redhat.com> <878v4wj55c.fsf@codemonkey.ws> Date: Fri, 05 Apr 2013 14:24:06 -0500 Message-ID: <878v4wdbmx.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 1/8] virtio-blk-x: fix configuration synchronization. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , qemu-devel@nongnu.org, KONRAD =?utf-8?B?RnLDqWTDqXJpYw==?= Peter Maydell writes: > On 5 April 2013 17:47, Anthony Liguori wrote: >> Kevin Wolf writes: >> >>> From: KONRAD Frederic >>> >>> The virtio-blk-x configuration is not in sync with virtio-blk configuration. >>> So this patch remove the virtio-blk-x configuration field, and use virtio-blk >>> one for setting the properties. >>> >>> This also remove a useless configuration copy in virtio_blk_device_init. >>> >>> Signed-off-by: KONRAD Frederic >>> Tested-by: Cornelia Huck >>> Signed-off-by: Kevin Wolf >> >> This breaks -M pc-1.0 as it breaks global properties. > > The first level analysis of why this happens: > > (1) global values are set as part of DeviceState's instance_init function > [and we set the config_wce field to 0 here] > (2) virtio_blk_pci_instance_init is a subclass instance_init so runs second > (3) it calls object_initialize on its embedded virtio-blk object > (4) the DeviceState instance_init for that child object sets the > properties to their init values [thus resetting config_wce to 1] > > The effect is that at the moment you can't have a property on > a parent object whose value is stored in the child object > (unless you do something hacky like read the default before > calling object_initialize and restore it afterwards]. > > It seems to me that the underlying problem here is that we > set global values too early -- they should be set after a > device is completely instance_init'd, not halfway through init. Here is an in-progress series that forwards properties from the virtio-blk-pci to virtio-blk. I think it's the best solution. The approach needs some polishing but I wanted to share early. https://github.com/aliguori/qemu/commits/qom-forward.1 Regards, Anthony Liguori > > -- PMM