Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Andreas Färber
Am 06.02.2012 20:25, schrieb Juan Quintela:
 Please send in any agenda items you are interested in covering.

I had some follow-up questions to the last call that remained
unanswered. We don't really need a call for that though, email is fine.

http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg04065.html

How is the realize step (DeviceState::init) supposed to translate to
Object-derived classes (e.g., CPU) and where to draw the line between
initfn and realize.

For virtual methods Anthony outlined the intended scheme here:
http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg00622.html
(Derived classes should save the parent's function pointer in their own
Class and initialize it from the parent class' function pointer.)

Another topic that can be answered by email is what the time planning
for the 4th QOM series looks like. Are there things that developers of
new devices should keep in mind / start doing differently wrt SysBus?

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Paolo Bonzini

On 02/07/2012 02:45 PM, Andreas Färber wrote:

Another topic that can be answered by email is what the time planning
for the 4th QOM series looks like. Are there things that developers of
new devices should keep in mind / start doing differently wrt SysBus?


Another related question is, should the 4th QOM series present a full 
composition tree based on the legacy qdev bus concept?  Currently it 
doesn't, but if not, why not?  That would help _a lot_ with removing 
PROP_PTR.


Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM call agenda for Tuesday 7

2012-02-07 Thread Juan Quintela
Juan Quintela quint...@redhat.com wrote:
 Hi

 Please send in any agenda items you are interested in covering.

As there were only one topic for the call, and Andreas suggested to use
email, we cancel this week call.

Have a nice day, Juan.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 07:52 AM, Paolo Bonzini wrote:

On 02/07/2012 02:45 PM, Andreas Färber wrote:

Another topic that can be answered by email is what the time planning
for the 4th QOM series looks like.


qom-upstream.16 is pretty close to ready to be sent out for v1.  It's fairly 
tricky getting these things into a bisectable state.  I think I've got about a 
days worth of work left so hopefully in terms of calendar time, probably this 
friday.


In terms of merging, once it's gotten the appropriate reviews.  This won't be a 
rebase-pain so we'll just treat it like a normal series.



Are there things that developers of
new devices should keep in mind / start doing differently wrt SysBus?


It's probably a good time to read object.h if you haven't already.  In terms of 
deprecating things, I'd prefer to deprecate by removing which basically means 
we'd only deprecate SysBus after converting all of the current users.


A big consideration at this point is compatibility.  It's not clear to me what 
interfaces we really have to maintain compatibility for.


For instance, the 4th series breaks setting -global properties based on bus 
name.  But this is 1) not used by libvirt 2) not actually documented anywhere 
and 3) such a subtle implementation detail that I don't think more than a few 
people even know it's possible.



Another related question is, should the 4th QOM series present a full
composition tree based on the legacy qdev bus concept?


Composition, no.  The legacy qbus concept doesn't model composition because it 
puts children created by composition (like the Cirrus VGA adapter) in the same 
context as a device created by a user (like an e1000 network card).



Currently it doesn't, but
if not, why not? That would help _a lot_ with removing PROP_PTR.


One thing that we could do, is modify qdev_create() like:

DeviceState *qdev_create_with_name(BusState *bus, const char *typename,
   const char *name)
{
   // ...
   object_property_add_child(legacy_machine_root(), name, OBJECT(dev), err);
   // assert if err due to conflicting property names
}

DeviceState *qdev_create(BusState *bus, const char *typename)
{
   return qdev_create_with_name(bus, typename, typename);
}

Most devices only have a single instance.  In the cases where there are multiple 
instances, we'll have to fix it up manually but that really shouldn't be all 
that hard.


That gives us composition paths and a clear goal for removing the legacy paths 
(we'd want to work toward eliminating /legacy-machine).


device_add doesn't use qdev_create() and neither would properly refactored 
devices (they'd use object_init).


Regards.

Anthony Liguori


Paolo



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Paolo Bonzini

On 02/07/2012 03:56 PM, Anthony Liguori wrote:

Another related question is, should the 4th QOM series present a full
composition tree based on the legacy qdev bus concept?


Composition, no. The legacy qbus concept doesn't model composition
because it puts children created by composition (like the Cirrus VGA
adapter) in the same context as a device created by a user (like an
e1000 network card).


Currently it doesn't, but
if not, why not? That would help _a lot_ with removing PROP_PTR.


One thing that we could do, is modify qdev_create() like:

DeviceState *qdev_create_with_name(BusState *bus, const char *typename,
const char *name)
{
// ...
object_property_add_child(legacy_machine_root(), name, OBJECT(dev), err);
// assert if err due to conflicting property names
}

DeviceState *qdev_create(BusState *bus, const char *typename)
{
return qdev_create_with_name(bus, typename, typename);
}

Most devices only have a single instance.   In the cases where there are
multiple instances, we'll have to fix it up manually but that really
shouldn't be all that hard.


I'm wary of all plans that require to go through all the code once. 
What about simply /devices/default/child[...] or something like that?


BTW, I would like to change /i440fx to /devices/i440fx, so that we will 
have clean namespaces:


/block
...
/chardev
...
/clocks
...
/devices
/peripheral
... # named devices created with -device
/peripheral-anon
/child[...] # unnamed devices created with -device
/default
/child[...] # created with qdev_create

Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 09:21 AM, Paolo Bonzini wrote:

On 02/07/2012 03:56 PM, Anthony Liguori wrote:

Another related question is, should the 4th QOM series present a full
composition tree based on the legacy qdev bus concept?


Composition, no. The legacy qbus concept doesn't model composition
because it puts children created by composition (like the Cirrus VGA
adapter) in the same context as a device created by a user (like an
e1000 network card).


Currently it doesn't, but
if not, why not? That would help _a lot_ with removing PROP_PTR.


One thing that we could do, is modify qdev_create() like:

DeviceState *qdev_create_with_name(BusState *bus, const char *typename,
const char *name)
{
// ...
object_property_add_child(legacy_machine_root(), name, OBJECT(dev), err);
// assert if err due to conflicting property names
}

DeviceState *qdev_create(BusState *bus, const char *typename)
{
return qdev_create_with_name(bus, typename, typename);
}

Most devices only have a single instance. In the cases where there are
multiple instances, we'll have to fix it up manually but that really
shouldn't be all that hard.


I'm wary of all plans that require to go through all the code once. What about
simply /devices/default/child[...] or something like that?


The paths would be unstable, but maybe that's okay.  I'd suggest doing 
child[rand()] to avoid the appearance that these paths are in any way shape or 
form stable.



BTW, I would like to change /i440fx to /devices/i440fx, so that we will have
clean namespaces:

/block
...
/chardev
...
/clocks
...
/devices
/peripheral
... # named devices created with -device
/peripheral-anon
/child[...] # unnamed devices created with -device
/default
/child[...] # created with qdev_create


Yeah, this makes sense.  By clocks, you mean things like rtc_clock, vm_clock, 
etc?  Not the omap clocks which happen to live in /clocks in your series?


Regards,

Anthony Liguori



Paolo



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Paolo Bonzini

On 02/07/2012 05:24 PM, Anthony Liguori wrote:

I'm wary of all plans that require to go through all the code once. What about
simply /devices/default/child[...] or something like that?


The paths would be unstable, but maybe that's okay.  I'd suggest
doing child[rand()] to avoid the appearance that these paths are in
any way shape or form stable.


Sounds a bit inconvenient for humans (who in the end are those who debug 
things :)).



BTW, I would like to change /i440fx to /devices/i440fx, so that we
will have clean namespaces:

/block
/chardev
/clocks
/devices


Yeah, this makes sense.  By clocks, you mean things like rtc_clock,
vm_clock, etc?  Not the omap clocks which happen to live in /clocks in
your series?


No, I really meant the OMAP clocks. :)  Basically if you have an 
abstract subclass TYPE_FOOS of TYPE_OBJECT, its instances would reside 
under /foos or something easily related to foos.


Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 10:27 AM, Paolo Bonzini wrote:

On 02/07/2012 05:24 PM, Anthony Liguori wrote:

I'm wary of all plans that require to go through all the code once. What about
simply /devices/default/child[...] or something like that?


The paths would be unstable, but maybe that's okay. I'd suggest
doing child[rand()] to avoid the appearance that these paths are in
any way shape or form stable.


Sounds a bit inconvenient for humans (who in the end are those who debug things
:)).


There are tons of human readable paths to a single object so I don't think it's 
a problem.  But no big deal with way since /devices/default should go away anyway.





BTW, I would like to change /i440fx to /devices/i440fx, so that we
will have clean namespaces:

/block
/chardev
/clocks
/devices


Yeah, this makes sense. By clocks, you mean things like rtc_clock,
vm_clock, etc? Not the omap clocks which happen to live in /clocks in
your series?


No, I really meant the OMAP clocks. :) Basically if you have an abstract
subclass TYPE_FOOS of TYPE_OBJECT, its instances would reside under /foos or
something easily related to foos.


Hrm, I don't like that very much.

OMAP clocks are devices.  Don't they belong in the devices hierarchy under the 
omap-clocks branch?


The fact that they aren't DeviceState's is because DeviceState is a pile of 
cruft.  Perhaps we should introduce a more streamlined Device base class and 
rename DeviceState to LegacyDevice or something like that.


Regards,

Anthony Liguori



Paolo



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Peter Maydell
On 7 February 2012 16:33, Anthony Liguori anth...@codemonkey.ws wrote:
 OMAP clocks are devices.  Don't they belong in the devices hierarchy under
 the omap-clocks branch?

I think they should be interfaces, not devices. The device would be the PRCM
(power, reset and clock manager) which provides a pile of registers
for configuring
the clocks and also outbound clock interfaces which you then wire up to the
various devices like uart/usb/etc in the same way as you would IRQs or
GPIO.

-- PMM
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Andreas Färber
Am 07.02.2012 16:21, schrieb Paolo Bonzini:
 BTW, I would like to change /i440fx to /devices/i440fx, so that we will
 have clean namespaces:
 
 /block
 ...
 /chardev
 ...
 /clocks
 ...
 /devices
 /peripheral
 ... # named devices created with -device
 /peripheral-anon
 /child[...] # unnamed devices created with -device
 /default
 /child[...] # created with qdev_create

I don't like that, I prefer /i440fx over /devices/i440fx. I don't mind
the other root-level nodes though.

For PC-style machines I'd expect board-level stuff like the CPUs to
appear directly under /. That would roughly correspond to the
OpenFirmware device tree then. For embedded devices with SoCs I expect
them to show up as childs of the SoC, but definitely not under some
artificial /cpus.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 10:41 AM, Andreas Färber wrote:

Am 07.02.2012 16:21, schrieb Paolo Bonzini:

BTW, I would like to change /i440fx to /devices/i440fx, so that we will
have clean namespaces:

/block
 ...
/chardev
 ...
/clocks
 ...
/devices
 /peripheral
 ... # named devices created with -device
 /peripheral-anon
 /child[...] # unnamed devices created with -device
 /default
 /child[...] # created with qdev_create


I don't like that, I prefer /i440fx over /devices/i440fx. I don't mind
the other root-level nodes though.


Let's try Paolo's cleanup for now.  I am worried about proliferation of things 
in the root hierarchy and the nice advantage of having /devices is that we can 
work towards making our build infrastructure roughly match our hierarchy.


Since 1.1 is unstable for QOM, we can always change it later.



For PC-style machines I'd expect board-level stuff like the CPUs to
appear directly under /. That would roughly correspond to the
OpenFirmware device tree then.


I think devices trees are a bad example that should not be emulated.

Regards,

Anthony Liguori
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Paolo Bonzini

On 02/07/2012 05:33 PM, Anthony Liguori wrote:

Hrm, I don't like that very much.


Yes, me neither actually.

If the object representing the state of the OMAP board (struct 
omap_mpu_state_s) is QOMified, the clocks can easily get under it in the 
composition tree.  Right now, that part is not even qdev. :)



OMAP clocks are devices.  Don't they belong in the devices hierarchy
under the omap-clocks branch?


If they were devices, yes.  But they're not, and it wouldn't have been a 
great time investment to refactor them. :)


Perhaps we can have /machine instead of /devices, a more generic name 
would do well.  Then...



The fact that they aren't DeviceState's is because DeviceState is a pile
of cruft.  Perhaps we should introduce a more streamlined Device base
class and rename DeviceState to LegacyDevice or something like that.


... light-weight components can inherit straight from Object and go 
under /machine.  There would be /machine/clocks for example.


Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 07:45 AM, Andreas Färber wrote:

Am 06.02.2012 20:25, schrieb Juan Quintela:

Please send in any agenda items you are interested in covering.


I had some follow-up questions to the last call that remained
unanswered. We don't really need a call for that though, email is fine.

http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg04065.html

How is the realize step (DeviceState::init) supposed to translate to
Object-derived classes (e.g., CPU) and where to draw the line between
initfn and realize.


Realize probably should be folded into Object or some intermediate object.

The idea is that there will be a realized boolean property.  When the level 
changes, it will invoke a realize() or unrealize() method depending on the 
direction.  DeviceState will implement realize() and invoke init().  For 
unrealize(), it will invoke exit().



For virtual methods Anthony outlined the intended scheme here:
http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg00622.html
(Derived classes should save the parent's function pointer in their own
Class and initialize it from the parent class' function pointer.)

Another topic that can be answered by email is what the time planning
for the 4th QOM series looks like. Are there things that developers of
new devices should keep in mind / start doing differently wrt SysBus?


I think I answered this elsewhere.

Regards,

ANthony Liguori


Andreas



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Andreas Färber
Am 07.02.2012 19:01, schrieb Anthony Liguori:
 On 02/07/2012 07:45 AM, Andreas Färber wrote:
 http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg04065.html

 How is the realize step (DeviceState::init) supposed to translate to
 Object-derived classes (e.g., CPU) and where to draw the line between
 initfn and realize.
 
 Realize probably should be folded into Object or some intermediate object.
 
 The idea is that there will be a realized boolean property.  When the
 level changes, it will invoke a realize() or unrealize() method
 depending on the direction.  DeviceState will implement realize() and
 invoke init().  For unrealize(), it will invoke exit().

That's fine. Question is, who is in charge of setting the realized
property and some rules of what do we put in initfn and what in realize.
Take the CPU, should CPU reset be done in realize or initfn? realize
might overwrite values set by the user after initfn but would provide us
with a reproducible state wrt reboot.

Starting the VCPU thread would definitely be for realize, but currently
this is all done from cpu_*_init() and having sequential calls to initfn
and realize doesn't offer any advantage over doing it all in initfn.

So given we do the split, who knows about these objects to call their
realize function? Will there be some global QOM logic that calls realize
on all objects instantiated so far (any ordering constraints then?) or
is everyone themselves responsible for making this work, i.e. must I
keep a global list of all CPUs initfn'ed to have their realize method
called later?

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] KVM call agenda for Tuesday 7

2012-02-07 Thread Anthony Liguori

On 02/07/2012 12:17 PM, Andreas Färber wrote:

Am 07.02.2012 19:01, schrieb Anthony Liguori:

On 02/07/2012 07:45 AM, Andreas Färber wrote:

http://lists.gnu.org/archive/html/qemu-devel/2012-01/msg04065.html

How is the realize step (DeviceState::init) supposed to translate to
Object-derived classes (e.g., CPU) and where to draw the line between
initfn and realize.


Realize probably should be folded into Object or some intermediate object.

The idea is that there will be a realized boolean property.  When the
level changes, it will invoke a realize() or unrealize() method
depending on the direction.  DeviceState will implement realize() and
invoke init().  For unrealize(), it will invoke exit().


That's fine. Question is, who is in charge of setting the realized
property


Ideally, the user, but there is a lot of refactoring to get there.

Realize should propagate through the composition tree (in such a way that it can 
be overridden, of course).



and some rules of what do we put in initfn and what in realize.


instance_init:
 - initialize fields that don't depend on properties
 - install properties
 - initialize children

realize:
 - validate all properties have sane values
 - perform initialization that depends on properties
 - take any actions that would logically start the device
 - propagate to children

unrealize:
 - take any actions that would logically stop the device
 - propagate to children
 - restore fields to the values after reset

finalize:
 - take any actions that would logically stop the device
 - free any sources of the device

What we think of reset today is unrealize().  What with thing of as qdev_init is 
instance_init + realize.


One thing I'd like to do is make the default implementation of unrealize() 
essentially be finalize + reinit in the same memory location.  This would make 
it so that the vast majority of devices would not need to implement reset.



Take the CPU, should CPU reset be done in realize or initfn?


Forget about reset as you know it.  initfn should initialize state.  Realize 
should only deal with starting the VM.



realize
might overwrite values set by the user after initfn but would provide us
with a reproducible state wrt reboot.

Starting the VCPU thread would definitely be for realize, but currently
this is all done from cpu_*_init() and having sequential calls to initfn
and realize doesn't offer any advantage over doing it all in initfn.


In general, if something can be done in initfn, it should be done there.


So given we do the split, who knows about these objects to call their
realize function?


'/' is an object (it's a container).  It will have a realize property that it 
propagates to all of it's children.


So a user simply has to set /.realize = true and that will realize the entire 
graph of objects.



Will there be some global QOM logic that calls realize
on all objects instantiated so far (any ordering constraints then?) or
is everyone themselves responsible for making this work, i.e. must I
keep a global list of all CPUs initfn'ed to have their realize method
called later?


Nope, it all will just magically work.

Regards,

Anthony Liguori



Andreas



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


KVM call agenda for Tuesday 7

2012-02-06 Thread Juan Quintela

Hi

Please send in any agenda items you are interested in covering.

Cheers,

Juan.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html