From: Marcel Apfelbaum <marcel.a@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, mst@redhat.com,
Alexey Kardashevskiy <aik@ozlabs.ru>,
armbru@redhat.com, lcapitulino@redhat.com, blauwirbel@gmail.com,
aliguori@amazon.com, imammedo@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 3/3] hw/boards: converted current_machine to be an instance of MachineCLass
Date: Fri, 07 Mar 2014 22:41:42 +0200 [thread overview]
Message-ID: <1394224902.2663.69.camel@localhost.localdomain> (raw)
In-Reply-To: <531A0220.7030405@suse.de>
On Fri, 2014-03-07 at 18:30 +0100, Andreas Färber wrote:
> Am 07.03.2014 17:22, schrieb Marcel Apfelbaum:
> > On Fri, 2014-03-07 at 12:27 +0100, Andreas Färber wrote:
> >> Am 07.03.2014 06:32, schrieb Marcel Apfelbaum:
> >>> On Fri, 2014-03-07 at 00:44 +0100, Andreas Färber wrote:
> >>>> Am 05.03.2014 18:30, schrieb Marcel Apfelbaum:
> >>>>> In order to allow attaching machine options to a machine instance,
> >>>>> current_machine is converted into MachineState.
> >>>>> As a first step of deprecating QEMUMachine, some of the functions
> >>>>> were modified to return MachineCLass.
> >>>>>
> >>>>> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> >>>>
> >>>> Looks mostly good, but same issue as Alexey's patch: We are risking
> >>>> qdev_get_machine() creating a Container-typed /machine node.
> >>>>
> >>>> What about the following on top?
> >>> Hi Andreas,
> >>>
> >>> I checked with the debugger and qdev_get_machine is called
> >>> long after we add the machine to the QOM tree.
> >>> However, the race still exists as someone can call qdev_get_machine
> >>> before the machine is added to the tree, not being aware of that.
> >>>
> >>> Your change solves the problem, thank you!
> >>> Do you want me to add this diff and resend,
> >>> or I will send yours separately?
> >>
> >> My preference would be to avoid another round of review on my part by
> >> simply squashing into your 3/3.
> > There is a problem with it: 'make check fails' on test-qdev-global-props.
> > - 'qdev_get_machine()' is called by 'device_set_realized()' because static_prop_type
> > has TYPE_DEVICE as parent.
> > - The machine is added to the QOM tree *only in vl's main* and this test does not
> > reach it, but assumes that always will be a machine in the QOM tree.
> > This is no longer true.
> >
> > Possible solution would be making existing 'null machine' a subclass of MachineClass
> > and add it manually to QOM on this test(and other places as necessary).
>
> The following hack fixes this particular failure for me (ran into it
> while trying to generate the HTML report):
>
> diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c
> index e4ad173..31bac15 100644
> --- a/tests/test-qdev-global-props.c
> +++ b/tests/test-qdev-global-props.c
> @@ -167,6 +167,9 @@ int main(int argc, char **argv)
> g_test_init(&argc, &argv, NULL);
>
> module_call_init(MODULE_INIT_QOM);
> +
> + object_property_add_child(object_get_root(), "machine",
> object_new("container"), NULL);
> +
Great! Thanks! I was trying to create a null-machine, but for this scenario
a container is more than enough.
> type_register_static(&static_prop_type);
> type_register_static(&dynamic_prop_type);
>
>
> Not yet suitable for squashing obviously.
I tested it and make check passes for all architectures, so why not?
It seems elegant and not a hack (this scenario does not require an actual machine).
Thanks,
Marcel
>
> Andreas
>
> > The risk here is
> > that there are other places where the machine needs to be added manually to the QOM tree.
> > (I am trying this option, but make check gets stuck !!!, debugging)
> >
> > Other possible solution is to add some kind of "CONFIG_MACHINE_IS_QOM_OBJECT" define
> > and use this in qdev_get_machine() implementation. (ugly?)
> >
> > Finally, is possible to be aware that may be a race when doing code review. ("dangerous"?)
> >
> > Any thoughts?
> > Thanks,
> > Marcel
> >
> >
> >
> >>
> >> Cheers,
> >> Andreas
> >>
> >
> >
> >
>
>
next prev parent reply other threads:[~2014-03-07 20:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 17:30 [Qemu-devel] [PATCH v3 0/3] qemu-machine as a QOM object Marcel Apfelbaum
2014-03-05 17:30 ` [Qemu-devel] [PATCH v3 1/3] hw/core: introduced qemu machine as " Marcel Apfelbaum
2014-03-06 22:43 ` Andreas Färber
2014-03-07 11:31 ` Andreas Färber
2014-03-05 17:30 ` [Qemu-devel] [PATCH v3 2/3] vl: use qemu machine QOM class instead of global machines list Marcel Apfelbaum
2014-03-06 22:55 ` Andreas Färber
2014-03-05 17:30 ` [Qemu-devel] [PATCH v3 3/3] hw/boards: converted current_machine to be an instance of MachineCLass Marcel Apfelbaum
2014-03-05 17:36 ` Eric Blake
2014-03-05 17:59 ` Marcel Apfelbaum
2014-03-06 23:44 ` Andreas Färber
2014-03-07 1:16 ` Alexey Kardashevskiy
2014-03-07 5:40 ` Marcel Apfelbaum
2014-03-07 5:32 ` Marcel Apfelbaum
2014-03-07 11:27 ` Andreas Färber
2014-03-07 16:22 ` Marcel Apfelbaum
2014-03-07 16:27 ` Paolo Bonzini
2014-03-07 17:30 ` Andreas Färber
2014-03-07 20:41 ` Marcel Apfelbaum [this message]
2014-03-11 15:44 ` Marcel Apfelbaum
2014-03-11 16:48 ` Andreas Färber
2014-03-11 19:28 ` Marcel Apfelbaum
2014-03-07 8:36 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394224902.2663.69.camel@localhost.localdomain \
--to=marcel.a@redhat.com \
--cc=afaerber@suse.de \
--cc=aik@ozlabs.ru \
--cc=aliguori@amazon.com \
--cc=armbru@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).