qemu-devel
[Top][All Lists]
Advanced

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

Re: Infinite loop in bus_unparent(), qdev bug or qdev misuse?


From: Peter Maydell
Subject: Re: Infinite loop in bus_unparent(), qdev bug or qdev misuse?
Date: Mon, 4 May 2020 16:25:06 +0100

On Mon, 4 May 2020 at 16:11, Paolo Bonzini <address@hidden> wrote:
>
> On 04/05/20 16:38, Markus Armbruster wrote:
> > makes no progreess because OBJECT(dev)->parent is still null, and
> > therefore object_unparent() does nothing.
> >
> > Possible culprit: qdev_try_create() calls qdev_set_parent_bus(), which
> > adds the device to the bus, but leaves ->parent null.  If this isn't
> > wrong outright, it's at least a dangerous state.
> >
> > Work-around: call qdev_set_id(dev, NULL) right after qdev_create().
> > This sets ->parent.
>
> That's a good one, and especially a safe one, since it matches
> qdev_device_add.  It has the disadvantage of having to touch all
> qdev_create() calls.

qdev_create() is supposed to be a "board code etc uses this to
create devices" function; I don't think we should impose extra
usage requirements like "you must immediately afterwards call this
function you weren't calling before". If qdev_set_id() needs to
be called, why not call it inside qdev_create() ?

thanks
-- PMM



reply via email to

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