qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 05/10] move out net queue structs define


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH v9 05/10] move out net queue structs define
Date: Mon, 7 Sep 2015 12:00:04 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Sep 07, 2015 at 06:53:49PM +0800, Yang Hongyang wrote:
> On 09/07/2015 05:11 PM, Stefan Hajnoczi wrote:
> [...]
> >>Thanks very much for the suggestion, I've already implemented it and tested,
> >>the code looks cleaner now.
> >>
> >>The last issue is the QOM thing, do Markus and Andreas have more input
> >>about that?
> >
> >If you would like to see examples of QOM usage, take a look at
> >iothread.c and/or backends/hostmem.c.
> >
> >The key things are:
> >
> >1. They use include/qom/object.h to register a type based on
> >    TYPE_OBJECT and their properties are registered using
> >    object_property_add_*().
> >
> >2. They implement the TYPE_USER_CREATABLE interface so the -object
> >    command-line option can be used to instantiate them.  See
> >    object_interfaces.h.
> >
> >As a result, a lot of code becomes unnecessary and iothread.c, in
> >particular, is quite short.
> 
> After looking into this, I have some questions on the implement, could you
> please help me on this because I don't know much about the object mechanism:
> 
> The netfilter need to be initialized after the net_init_clients, because we
> need to attach the filter to the net client. But currently, net client is not
> using QOM, and seems that it is initialized after objects been created. So 
> here
> comes the problem: how can I initialize a certain object later, is it 
> possiable?

It is currently a bit hacky - most objects are initialized very early,
but we have a similar problem with rng-egd which must be created /after/
chardevs. To deal with this in vl.c main() we have two helper methods
object_create_initial and object_create_delayed. The delayed method though
still happens before the net clients are created. We could probably just
move the objec_create_delayed method invokation to later on, after net
clients are created, but if that doesn't work just add an extra helper
object_create_very_delayed :-)

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

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