qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/8] virtio-blk-x: fix configuration synchroniza


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1/8] virtio-blk-x: fix configuration synchronization.
Date: Fri, 5 Apr 2013 18:56:26 +0100

On 5 April 2013 17:47, Anthony Liguori <address@hidden> wrote:
> Kevin Wolf <address@hidden> writes:
>
>> From: KONRAD Frederic <address@hidden>
>>
>> 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 <address@hidden>
>> Tested-by: Cornelia Huck <address@hidden>
>> Signed-off-by: Kevin Wolf <address@hidden>
>
> 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.

-- PMM



reply via email to

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