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

2020-05-29 Thread Markus Armbruster
Markus Armbruster writes: > David Hildenbrand writes: > +static void realize_event_facility(DeviceState *dev, Error **errp) +{ +SCLPEventFacility *event_facility = EVENT_FACILITY(dev); +Error *local_err = NULL; + +

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

2020-05-26 Thread Cornelia Huck
On Tue, 26 May 2020 13:23:43 +0200 Paolo Bonzini wrote: > On 26/05/20 11:45, Cornelia Huck wrote: > > On Tue, 19 May 2020 16:55:46 +0200 > > Markus Armbruster wrote: > > > >> init_event_facility() creates the SCLP events bus with two SCLP event > >> devices (sclpquiesce and

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

2020-05-26 Thread Paolo Bonzini
On 26/05/20 11:45, Cornelia Huck wrote: > On Tue, 19 May 2020 16:55:46 +0200 > Markus Armbruster wrote: > >> init_event_facility() creates the SCLP events bus with two SCLP event >> devices (sclpquiesce and sclp-cpu-hotplug). It leaves the devices >> unrealized. A comment explains they will be

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

2020-05-26 Thread David Hildenbrand
On 19.05.20 16:55, Markus Armbruster wrote: > init_event_facility() creates the SCLP events bus with two SCLP event > devices (sclpquiesce and sclp-cpu-hotplug). It leaves the devices > unrealized. A comment explains they will be realized "via the bus". > > The bus's realize method

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

2020-05-26 Thread Cornelia Huck
On Tue, 19 May 2020 16:55:46 +0200 Markus Armbruster wrote: > init_event_facility() creates the SCLP events bus with two SCLP event > devices (sclpquiesce and sclp-cpu-hotplug). It leaves the devices > unrealized. A comment explains they will be realized "via the bus". > > The bus's realize

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

2020-05-26 Thread Markus Armbruster
Paolo Bonzini writes: > On 26/05/20 08:27, Markus Armbruster wrote: >>> It cannot happen, because a device must be unparented before it's >>> destroyed and unparenting takes care of unrealizing the device. >> >> I can't see where unparenting takes care of unrealizing. Can you help >> me? > >

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

2020-05-26 Thread Paolo Bonzini
On 26/05/20 08:27, Markus Armbruster wrote: >> It cannot happen, because a device must be unparented before it's >> destroyed and unparenting takes care of unrealizing the device. > > I can't see where unparenting takes care of unrealizing. Can you help > me? Hidden in plain sight: static void

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

2020-05-26 Thread Markus Armbruster
Paolo Bonzini writes: > On 25/05/20 09:01, Markus Armbruster wrote: >>> 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.

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

2020-05-25 Thread Paolo Bonzini
On 25/05/20 09:01, Markus Armbruster wrote: >> 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

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

2020-05-25 Thread Markus Armbruster
David Hildenbrand writes: >>> +static void realize_event_facility(DeviceState *dev, Error **errp) >>> +{ >>> +SCLPEventFacility *event_facility = EVENT_FACILITY(dev); >>> +Error *local_err = NULL; >>> + >>> +qdev_realize(DEVICE(_facility->quiesce), >>> +

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

2020-05-21 Thread David Hildenbrand
>> +static void realize_event_facility(DeviceState *dev, Error **errp) >> +{ >> +SCLPEventFacility *event_facility = EVENT_FACILITY(dev); >> +Error *local_err = NULL; >> + >> +qdev_realize(DEVICE(_facility->quiesce), >> + BUS(_facility->sbus), _err); >> +if

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

2020-05-20 Thread David Hildenbrand
[...] > The common code in question is bus_set_realized(), which has a TODO > comment asking for recursive realization. It's been asking for years. > > The only devices sclp_events_bus_realize() will ever realize are the > two init_event_facility() puts there. > > Simplify as follows: > > *