qemu-s390x
[Top][All Lists]
Advanced

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

Re: [PATCH 50/55] s390x/event-facility: Simplify creation of SCLP event


From: Markus Armbruster
Subject: Re: [PATCH 50/55] s390x/event-facility: Simplify creation of SCLP event devices
Date: Mon, 25 May 2020 09:01:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

David Hildenbrand <address@hidden> writes:

>>> +static void realize_event_facility(DeviceState *dev, Error **errp)
>>> +{
>>> +    SCLPEventFacility *event_facility = EVENT_FACILITY(dev);
>>> +    Error *local_err = NULL;
>>> +
>>> +    qdev_realize(DEVICE(&event_facility->quiesce),
>>> +                 BUS(&event_facility->sbus), &local_err);
>>> +    if (local_err) {
>>> +        error_propagate(errp, local_err);
>>> +        return;
>>> +    }
>>> +    qdev_realize(DEVICE(&event_facility->cpu_hotplug),
>>> +                 BUS(&event_facility->sbus), errp);
>> 
>> Just wondering, do we have to care about un-realizing quiesce in case
>> this fails?
>
> Just remembered that we fail creating the machine and therefore abort. So not 
> necessary :)

True.

But let's review briefly what happens when a realize method fails.

In theory, realize fails cleanly, i.e. doing nothing.  Another attempt
could be made then.

In practice, realize failure is always followed by destruction, unless
preempted by outright exit(1).

Destroying a device must also destroy its components.

Paolo, is destroying a realized device okay, or does it have to be
unrealized first?  I can't see automatic unrealize on destruction...

>>> }
>>> 
>>> static void reset_event_facility(DeviceState *dev)
>>> @@ -479,6 +467,7 @@ static void init_event_facility_class(ObjectClass 
>>> *klass, void *data)
>>>     DeviceClass *dc = DEVICE_CLASS(sbdc);
>>>     SCLPEventFacilityClass *k = EVENT_FACILITY_CLASS(dc);
>>> 
>>> +    dc->realize = realize_event_facility;
>>>     dc->reset = reset_event_facility;
>>>     dc->vmsd = &vmstate_event_facility;
>>>     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>>> 
>> 
>> LGTM
>> 
>> Reviewed-by: David Hildenbrand <address@hidden>

Thanks!




reply via email to

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