All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
@ 2020-07-20 17:23 Philippe Mathieu-Daudé
  2020-07-20 19:41 ` Richard Henderson
  2020-07-21  8:15 ` Markus Armbruster
  0 siblings, 2 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-20 17:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Philippe Mathieu-Daudé,
	Markus Armbruster, Michael S. Tsirkin

When realizing a Super I/O with IDE controller [*], we get:

  qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
  Aborted (core dumped)

This is because the device is already realized when we try to
add the QOM property to the parent. Fix by realizing *after*
adding the QOM relationship.

[*] Set ISASuperIOClass::ide.count = N with N not zero

Fixes: e508430619 ("hw/isa/superio: Make the components QOM children")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/isa/isa-superio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index e2e47d8fd9..179c185695 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
         if (k->ide.get_irq) {
             qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
         }
-        isa_realize_and_unref(isa, bus, &error_fatal);
         object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa));
+        isa_realize_and_unref(isa, bus, &error_fatal);
         sio->ide = isa;
         trace_superio_create_ide(0,
                                  k->ide.get_iobase ?
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
  2020-07-20 17:23 [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization Philippe Mathieu-Daudé
@ 2020-07-20 19:41 ` Richard Henderson
  2020-07-21  8:15 ` Markus Armbruster
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2020-07-20 19:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Paolo Bonzini, Markus Armbruster, Michael S. Tsirkin

On 7/20/20 10:23 AM, Philippe Mathieu-Daudé wrote:
> When realizing a Super I/O with IDE controller [*], we get:
> 
>   qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
>   Aborted (core dumped)
> 
> This is because the device is already realized when we try to
> add the QOM property to the parent. Fix by realizing *after*
> adding the QOM relationship.
> 
> [*] Set ISASuperIOClass::ide.count = N with N not zero
> 
> Fixes: e508430619 ("hw/isa/superio: Make the components QOM children")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/isa/isa-superio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
  2020-07-20 17:23 [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization Philippe Mathieu-Daudé
  2020-07-20 19:41 ` Richard Henderson
@ 2020-07-21  8:15 ` Markus Armbruster
  2020-07-21  8:46   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2020-07-21  8:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Michael S. Tsirkin

Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> When realizing a Super I/O with IDE controller [*], we get:
>
>   qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
>   Aborted (core dumped)
>
> This is because the device is already realized when we try to
> add the QOM property to the parent. Fix by realizing *after*
> adding the QOM relationship.
>
> [*] Set ISASuperIOClass::ide.count = N with N not zero

Is this a latent bug, or can it bite in master?  If the latter, can you
show how to reproduce?

> Fixes: e508430619 ("hw/isa/superio: Make the components QOM children")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/isa/isa-superio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
> index e2e47d8fd9..179c185695 100644
> --- a/hw/isa/isa-superio.c
> +++ b/hw/isa/isa-superio.c
> @@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
>          if (k->ide.get_irq) {
>              qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
>          }
> -        isa_realize_and_unref(isa, bus, &error_fatal);
>          object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa));
> +        isa_realize_and_unref(isa, bus, &error_fatal);
>          sio->ide = isa;
>          trace_superio_create_ide(0,
>                                   k->ide.get_iobase ?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
  2020-07-21  8:15 ` Markus Armbruster
@ 2020-07-21  8:46   ` Philippe Mathieu-Daudé
  2020-07-21  9:57     ` Markus Armbruster
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-21  8:46 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Michael S. Tsirkin

On 7/21/20 10:15 AM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> 
>> When realizing a Super I/O with IDE controller [*], we get:
>>
>>   qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
>>   Aborted (core dumped)
>>
>> This is because the device is already realized when we try to
>> add the QOM property to the parent. Fix by realizing *after*
>> adding the QOM relationship.
>>
>> [*] Set ISASuperIOClass::ide.count = N with N not zero
> 
> Is this a latent bug, or can it bite in master?  If the latter, can you
> show how to reproduce?

Latent bug for master:

$ git grep ide.count
hw/isa/isa-superio.c:149:    if (k->ide.count && (!k->ide.is_enabled ||
k->ide.is_enabled(sio, 0))) {
hw/isa/isa-superio.c:197:    sc->ide.count = 0;
hw/isa/smc37c669-superio.c:100:    sc->ide.count = 0;
hw/isa/vt82c686.c:529:    sc->ide.count = 0;

I hit it rebasing undergoing series for 5.2 and testing them.

> 
>> Fixes: e508430619 ("hw/isa/superio: Make the components QOM children")
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  hw/isa/isa-superio.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
>> index e2e47d8fd9..179c185695 100644
>> --- a/hw/isa/isa-superio.c
>> +++ b/hw/isa/isa-superio.c
>> @@ -158,8 +158,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
>>          if (k->ide.get_irq) {
>>              qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
>>          }
>> -        isa_realize_and_unref(isa, bus, &error_fatal);
>>          object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa));
>> +        isa_realize_and_unref(isa, bus, &error_fatal);
>>          sio->ide = isa;
>>          trace_superio_create_ide(0,
>>                                   k->ide.get_iobase ?
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
  2020-07-21  8:46   ` Philippe Mathieu-Daudé
@ 2020-07-21  9:57     ` Markus Armbruster
  2020-07-21 12:46       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2020-07-21  9:57 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Michael S. Tsirkin

Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 7/21/20 10:15 AM, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>> 
>>> When realizing a Super I/O with IDE controller [*], we get:
>>>
>>>   qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
>>>   Aborted (core dumped)
>>>
>>> This is because the device is already realized when we try to
>>> add the QOM property to the parent. Fix by realizing *after*
>>> adding the QOM relationship.
>>>
>>> [*] Set ISASuperIOClass::ide.count = N with N not zero
>> 
>> Is this a latent bug, or can it bite in master?  If the latter, can you
>> show how to reproduce?
>
> Latent bug for master:
>
> $ git grep ide.count
> hw/isa/isa-superio.c:149:    if (k->ide.count && (!k->ide.is_enabled ||
> k->ide.is_enabled(sio, 0))) {
> hw/isa/isa-superio.c:197:    sc->ide.count = 0;
> hw/isa/smc37c669-superio.c:100:    sc->ide.count = 0;
> hw/isa/vt82c686.c:529:    sc->ide.count = 0;
>
> I hit it rebasing undergoing series for 5.2 and testing them.

Let's tweak the commit message like this

    [*] Set ISASuperIOClass::ide.count = N with N not zero (no such
    thing currently exists; the bug is latent)

Preferably with that or something like it:
Reviewed-by: Markus Armbruster <armbru@redhat.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization
  2020-07-21  9:57     ` Markus Armbruster
@ 2020-07-21 12:46       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-21 12:46 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-trivial, Paolo Bonzini, qemu-devel, Michael S. Tsirkin

On 7/21/20 11:57 AM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> 
>> On 7/21/20 10:15 AM, Markus Armbruster wrote:
>>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>>
>>>> When realizing a Super I/O with IDE controller [*], we get:
>>>>
>>>>   qom/object.c:1684: object_property_try_add_child: Assertion `!child->parent' failed.
>>>>   Aborted (core dumped)
>>>>
>>>> This is because the device is already realized when we try to
>>>> add the QOM property to the parent. Fix by realizing *after*
>>>> adding the QOM relationship.
>>>>
>>>> [*] Set ISASuperIOClass::ide.count = N with N not zero
>>>
>>> Is this a latent bug, or can it bite in master?  If the latter, can you
>>> show how to reproduce?
>>
>> Latent bug for master:
>>
>> $ git grep ide.count
>> hw/isa/isa-superio.c:149:    if (k->ide.count && (!k->ide.is_enabled ||
>> k->ide.is_enabled(sio, 0))) {
>> hw/isa/isa-superio.c:197:    sc->ide.count = 0;
>> hw/isa/smc37c669-superio.c:100:    sc->ide.count = 0;
>> hw/isa/vt82c686.c:529:    sc->ide.count = 0;
>>
>> I hit it rebasing undergoing series for 5.2 and testing them.
> 
> Let's tweak the commit message like this
> 
>     [*] Set ISASuperIOClass::ide.count = N with N not zero (no such
>     thing currently exists; the bug is latent)
> 
> Preferably with that or something like it:
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

OK. I still consider it worthwhile fixing for 5.1, as while it
doesn't bite master, forks might be affected, since the bug is
in master.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-21 12:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 17:23 [PATCH-for-5.1] hw/isa/isa-superio: Fix IDE controller realization Philippe Mathieu-Daudé
2020-07-20 19:41 ` Richard Henderson
2020-07-21  8:15 ` Markus Armbruster
2020-07-21  8:46   ` Philippe Mathieu-Daudé
2020-07-21  9:57     ` Markus Armbruster
2020-07-21 12:46       ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.