Skip to contentSkip to conversation

KVM call agenda for Tuesday 7

DISCUSSION Juan Quintela 5 participants 16 messages Feb 6, 2012 – Feb 7, 2012 KVM

lore
Share & tools
lore
#0 lore raw

Hi

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

Cheers,

Juan.

#1 lore raw

Am 06.02.2012 20:25, schrieb Juan Quintela:

Quoted 1 line

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
maintainer
#2 lore raw
Quoted 3 lines · Andreas Färber

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

#3 lore raw
Quoted 3 lines · Paolo Bonzini
Quoted 2 lines · Andreas Färber

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.

Quoted 2 lines
Quoted 2 lines

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.

Quoted 2 lines

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).

Quoted 2 lines

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

Quoted 2 lines

Paolo

maintainer
#4 lore raw
Quoted 21 lines · Anthony Liguori
Quoted 2 lines

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).

Quoted 2 lines

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
}

Quoted 8 lines

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

#5 lore raw
Quoted 27 lines · Paolo Bonzini
Quoted 26 lines · Anthony Liguori
Quoted 2 lines

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).

Quoted 2 lines

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); }

Quoted 6 lines
Quoted 3 lines

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.

Quoted 16 lines

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

Quoted 3 lines

Paolo

maintainer
#6 lore raw
Quoted 6 lines · Anthony Liguori
Quoted 2 lines

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 :)).

Quoted 11 lines
Quoted 7 lines

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

#7 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines · Anthony Liguori
Quoted 2 lines

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.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

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

/block
/chardev
/clocks
/devices

Quoted 7 lines
Quoted 3 lines

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

Quoted 3 lines

Paolo

#8 lore raw
Quoted 2 lines · Anthony Liguori

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

maintainer
#9 lore raw
In reply to Anthony Liguori
Quoted 1 line · Anthony Liguori

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. :)

Quoted 2 lines

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...

Quoted 3 lines

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

#10 lore raw
In reply to Paolo Bonzini

Am 07.02.2012 16:21, schrieb Paolo Bonzini:

Quoted 9 lines

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

/block

    ...
/chardev
    ...
/clocks
    ...
Quoted 7 lines

/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 child<>s of the SoC, but definitely not under some artificial /cpus.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#11 lore raw
Quoted 18 lines · Andreas Färber

Am 07.02.2012 16:21, schrieb Paolo Bonzini:

Quoted 9 lines

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

/block

     ...
/chardev
     ...
/clocks
     ...
Quoted 7 lines

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

Quoted 2 lines

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.

Quoted 4 lines

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

#12 lore raw
In reply to Andreas Färber
Quoted 11 lines · Andreas Färber

Am 06.02.2012 20:25, schrieb Juan Quintela:

Quoted 1 line

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().

Quoted 8 lines

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

Quoted 2 lines

Andreas

#13 lore raw

Am 07.02.2012 19:01, schrieb Anthony Liguori:

Quoted 7 lines · Andreas Färber
Quoted 5 lines

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.

Quoted 6 lines

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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#14 lore raw
Quoted 10 lines · Andreas Färber

Am 07.02.2012 19:01, schrieb Anthony Liguori:

Quoted 9 lines · Andreas Färber
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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).

Quoted 1 line

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.

Quoted 1 line

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.

Quoted 7 lines

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.

Quoted 2 lines

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.

Quoted 5 lines

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

Quoted 3 lines

Andreas

#15 lore raw
In reply to Juan Quintela
Quoted 3 lines · Juan Quintela

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.