Skip to contentSkip to conversation

qemu: make default_write_config use mask table

PATCH Superseded Michael S. Tsirkin 17 participants 319 messages Jun 5, 2009 – Jul 23, 2009 1 message not in the archive Page 2 of 2

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#93 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin
Quoted 2 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

The allocation code could be moved out into a library, and libvirt could link with it (ducks).

Why does libvirt want to do allocation?

Regards,

Anthony Liguori

#109 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor

Libvirt does not support r2d. I hope it won't start to support it.

It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.

I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.

Quoted 8 lines
Quoted 3 lines

We can have default values for these types of devices or something like pci_addr=auto.

Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?

Error messages are not the only argument for pushing slot allocation to management. See my previous messages on the topic.

Quoted 17 lines
Quoted 10 lines
Quoted 9 lines

If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.

Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.

Quoted 6 lines

The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'

Quoted 5 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Signature · 1 line
error compiling committee.c: too many arguments to function
#110 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 4 lines · Anthony Liguori
Quoted 1 line · Dor Laor

Libvirt does not support r2d. I hope it won't start to support it.

It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.

I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.

Quoted 4 lines
Quoted 2 lines

We can have default values for these types of devices or something like pci_addr=auto.

Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?

Error messages are not the only argument for pushing slot allocation to management. See my previous messages on the topic.

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.

Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.

The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Signature · 1 line
error compiling committee.c: too many arguments to function
#224 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.

The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).

An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:

-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda

-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd

-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd

This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.

Regards,

Anthony Liguori

#225 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 2 lines · Avi Kivity

I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.

The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).

An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:

-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda

-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd

-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd

This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.

Regards,

Anthony Liguori

#94 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

Quoted 5 lines
Quoted 3 lines

The allocation code could be moved out into a library, and libvirt could link with it (ducks).

Why does libvirt want to do allocation?

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#95 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

Quoted 5 lines
Quoted 3 lines

The allocation code could be moved out into a library, and libvirt could link with it (ducks).

Why does libvirt want to do allocation?

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

Regards,
Daniel

Signature · 4 lines
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
#264 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin

And then pc-virtio-class-other-with-balloon-without-usb? Wouldn't it be more straightforward to have capability bits which can be switched on and off independently rather than trying to fit unrelated features into a machine type? IMO it only seems more work at first, and QA gets a bit nervious that they can't exhaustively test all options. But in the long run it simplifies things as you don't have to set policy and invent silly names.

We're strictly talking about default machine configs. That has nothing to do with capabilities. You still need to know what the default set of enabled capabilities were and keep track of that. All that I'm suggesting is that we use the machine name to collapse the default set of capabilities into something that libvirt can track.

The advantage of using something more opaque like that is that it simplifies things for management tools as they don't have to keep track of "capabilities" that we're adding. Heck, you could even do:

pc-00000034

Where "pc-%08x" % (capabilities) :-)

Regards,

Anthony Liguori

#265 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin

And then pc-virtio-class-other-with-balloon-without-usb? Wouldn't it be more straightforward to have capability bits which can be switched on and off independently rather than trying to fit unrelated features into a machine type? IMO it only seems more work at first, and QA gets a bit nervious that they can't exhaustively test all options. But in the long run it simplifies things as you don't have to set policy and invent silly names.

We're strictly talking about default machine configs. That has nothing to do with capabilities. You still need to know what the default set of enabled capabilities were and keep track of that. All that I'm suggesting is that we use the machine name to collapse the default set of capabilities into something that libvirt can track.

The advantage of using something more opaque like that is that it simplifies things for management tools as they don't have to keep track of "capabilities" that we're adding. Heck, you could even do:

pc-00000034

Where "pc-%08x" % (capabilities) :-)

Regards,

Anthony Liguori

#226 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 21 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity

I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.

The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).

An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:

(quoted diff) +0 -6
-controller type=lsi1234,addr=00:01,name=blah
-controller-disk controller=blah,addr=00:01,name=sda
 
-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd
 
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
Quoted 5 lines

This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

There's value in sticking to well-understood names and address formats.

Signature · 1 line
error compiling committee.c: too many arguments to function
#111 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 3 lines · Avi Kivity

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

I'm not sure how we got here but yeah, let's table this part of the discussion.

Regards,

Anthony Liguori

#112 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 1 line · Avi Kivity

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

I'm not sure how we got here but yeah, let's table this part of the discussion.

Regards,

Anthony Liguori

#96 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Daniel P. Berrange
Quoted 14 lines · Daniel P. Berrange
Quoted 12 lines · Anthony Liguori
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

The allocation code could be moved out into a library, and libvirt could link with it (ducks).

Quoted 9 lines
Quoted 2 lines

Why does libvirt want to do allocation?

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

It's not about what libvirt wants. It's about what will serve the end user the most.
Apart for stable guest ABI, end users need to have the option to control the slot for
their devices. Just like them have for physical machines. It's not theoretical discussion,
limiting issues with shared irq is one real life example.

Thanks, dor

#227 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 17 lines · Anthony Liguori
Quoted 2 lines · Avi Kivity

I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.

The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).

An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:

(quoted diff) +0 -6
-controller type=lsi1234,addr=00:01,name=blah
-controller-disk controller=blah,addr=00:01,name=sda
 
-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd
 
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
Quoted 1 line

This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

There's value in sticking to well-understood names and address formats.

Signature · 1 line
error compiling committee.c: too many arguments to function
#97 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Daniel P. Berrange
Quoted 11 lines · Daniel P. Berrange
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

The allocation code could be moved out into a library, and libvirt could link with it (ducks).

Quoted 9 lines
Quoted 2 lines

Why does libvirt want to do allocation?

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

It's not about what libvirt wants. It's about what will serve the end user the most. Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.

Thanks, dor

#98 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 11 lines · Dor Laor
Quoted 9 lines

It doesn't want to. As Mark said, libvirt just wants to be able to ensure
a stable guest ABI, of which stable PCI addresses is one aspect. This does
not imply libvirt wants to allocate the PCI addresses, just that it wants
a way to keep them stable. All else being equal I'd rather libvirt wasn't
in the PCI address allocation business.

Quoted 8 lines

It's not about what libvirt wants. It's about what will serve the end user the most.
Apart for stable guest ABI, end users need to have the option to control the slot for
their devices. Just like them have for physical machines. It's not theoretical discussion,
limiting issues with shared irq is one real life example.

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

Signature · 1 line
error compiling committee.c: too many arguments to function
#99 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Dor Laor
Quoted 7 lines · Dor Laor
Quoted 5 lines

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

Quoted 5 lines

It's not about what libvirt wants. It's about what will serve the end user the most. Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

Signature · 1 line
error compiling committee.c: too many arguments to function
#228 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 2 lines · Avi Kivity

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.

Regards,

Anthony Liguori

#229 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 1 line · Avi Kivity

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.

Regards,

Anthony Liguori

#230 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 10 lines · Anthony Liguori
Quoted 2 lines · Avi Kivity

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.

The code problems are easily solved by adding another level of indirection. User confusion problems are only aggravated by additional abstraction, though ("what do I put in addr=, here?").

Signature · 1 line
error compiling committee.c: too many arguments to function
#231 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 4 lines · Anthony Liguori
Quoted 1 line · Avi Kivity

I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.

I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.

The code problems are easily solved by adding another level of indirection. User confusion problems are only aggravated by additional abstraction, though ("what do I put in addr=, here?").

Signature · 1 line
error compiling committee.c: too many arguments to function
#113 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor

Libvirt does not support r2d. I hope it won't start to support it.

It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.

Quoted 4 lines

I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

Quoted 9 lines
Quoted 5 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

You can push the discussion to libvirt-devel, and the conclusion would most likely be:

"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.

We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."

libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.

Cheers,
Mark.

#106 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Dor Laor
Quoted 9 lines · Dor Laor
Quoted 6 lines

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

It's not about what libvirt wants. It's about what will serve the end user the most.

Absolutely. And not just about what most helps end users of libvirt based management apps, but also any app managing qemu.

Quoted 4 lines

Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.

Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.

Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.

Cheers,
Mark.

#107 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Dor Laor
Quoted 9 lines · Dor Laor
Quoted 6 lines

It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.

It's not about what libvirt wants. It's about what will serve the end user the most.

Absolutely. And not just about what most helps end users of libvirt based management apps, but also any app managing qemu.

Quoted 4 lines

Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.

Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.

Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.

Cheers,
Mark.

#114 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor

Libvirt does not support r2d. I hope it won't start to support it.

It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.

Quoted 4 lines

I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

Quoted 9 lines
Quoted 5 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

You can push the discussion to libvirt-devel, and the conclusion would most likely be:

"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.

We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."

libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.

Cheers,
Mark.

#115 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 8 lines · Mark McLoughlin
Quoted 4 lines

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

We propose to allow both qemu-allocated slots and user-allocated slots, so we're only ignoring the actual decision by the management tool providers, not their requirements.

Quoted 10 lines

You can push the discussion to libvirt-devel, and the conclusion would most likely be:

"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.

We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."

Well, they'll find out if they try default allocation. It's traditional to try all the complicated solutions before trying the simplest one, so I guess we'll just have to let them.

Quoted 3 lines

libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.

True, others will wind up doing things differently. In fact, I'm a little surprised that libvirt is involved, since the place to do inventory is in the management app itself (it's true that libvirt also maintains its own database, so the line is blurred).

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

#108 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 7 lines · Mark McLoughlin

Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.

Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.

Think any installer's partitioning utility. It will provide a default placement and try to hide it from you. If you ask, it will let you place the partitions yourself.

The management app is the end user's agent. When we push something there, we allow it to choose something, or push the decision further up to the user.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

#116 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 3 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed. It doesn't matter though because it's orthogonal to the current proposal.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

Quoted 8 lines
Quoted 4 lines

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.

To summarize, I think we have:

1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files

Regards,

Anthony Liguori

#117 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 3 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed. It doesn't matter though because it's orthogonal to the current proposal.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.

To summarize, I think we have:

1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files

Regards,

Anthony Liguori

#118 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 3 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type

s/whenever/qemu stable release/

Quoted 1 line

- Use explicit versions in name: pc-v1, pc-v2

pc-qemu-0.10?

This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)

Quoted 2 lines

or use more descriptive names pc-with-usb
- Easily transitions to device config files

Combinatorial explosion. Just use -usb.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#119 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 2 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type

s/whenever/qemu stable release/

Quoted 1 line

- Use explicit versions in name: pc-v1, pc-v2

pc-qemu-0.10?

This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)

Quoted 2 lines

or use more descriptive names pc-with-usb
- Easily transitions to device config files

Combinatorial explosion. Just use -usb.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#120 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 7 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type

s/whenever/qemu stable release/

Quoted 7 lines
Quoted 1 line

- Use explicit versions in name: pc-v1, pc-v2

pc-qemu-0.10?

This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)

Yup, that makes a whole lot of sense.

Regards,

Anthony Liguori

#121 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 2 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type

s/whenever/qemu stable release/

Quoted 1 line

- Use explicit versions in name: pc-v1, pc-v2

pc-qemu-0.10?

This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)

Yup, that makes a whole lot of sense.

Regards,

Anthony Liguori

#122 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 2 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way,

introduce a new machine type

Quoted 1 line
Quoted 7 lines

s/whenever/qemu stable release/

Quoted 2 lines

- Use explicit versions in name: pc-v1, pc-v2

pc-qemu-0.10?

pc-2009.06? Or given the hardware, should that be pc-1997?

#123 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 5 lines · Blue Swirl
Quoted 2 lines

pc-qemu-0.10?

pc-2009.06? Or given the hardware, should that be pc-1997?

pc-qemu-0.10 has the obvious benefit of allowing people to immediately know what's the oldest version of qemu that supports it.

Signature · 1 line
error compiling committee.c: too many arguments to function
#124 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Blue Swirl
Quoted 5 lines · Blue Swirl
Quoted 2 lines

pc-qemu-0.10?

pc-2009.06? Or given the hardware, should that be pc-1997?

pc-qemu-0.10 has the obvious benefit of allowing people to immediately know what's the oldest version of qemu that supports it.

Signature · 1 line
error compiling committee.c: too many arguments to function
#125 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

Quoted 1 line

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

Quoted 8 lines
Quoted 4 lines

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.

Quoted 6 lines

To summarize, I think we have:

1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.

That helps, but it's not enough on its own.

The management app needs to figure out what addresses to pass either by:

a) Initially allowing qemu to do the address allocation, and thereafter using those addresses - this requires some way to query the addresses of devices

or b) Doing the initial address allocation itself - this requires some
way to query what slots are available.

Quoted 5 lines

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files

To be clear - you're not proposing this is a solution to the "stable PCI addresses" problem, are you? The main requirement is for the addresses to stay stable even if the user adds/removes other devices.

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

Cheers,
Mark.

#126 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

Quoted 1 line

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.

Quoted 8 lines
Quoted 4 lines

However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.

Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?

This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.

Quoted 6 lines

To summarize, I think we have:

1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.

That helps, but it's not enough on its own.

The management app needs to figure out what addresses to pass either by:

a) Initially allowing qemu to do the address allocation, and thereafter using those addresses - this requires some way to query the addresses of devices

or b) Doing the initial address allocation itself - this requires some
way to query what slots are available.

Quoted 5 lines

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files

To be clear - you're not proposing this is a solution to the "stable PCI addresses" problem, are you? The main requirement is for the addresses to stay stable even if the user adds/removes other devices.

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

Cheers,
Mark.

#127 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 8 lines · Mark McLoughlin
Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

Quoted 8 lines
Quoted 3 lines

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards. Worst case we hardcode those numbers (gasp, faint).

Quoted 6 lines
Quoted 2 lines

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

It's part of the solution, but hardly a difficult the most difficult part.

Quoted 3 lines

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

     $ qemu -print-default-machine

or maybe

     $ qemu -show default-machine
     $ qemu -show pci-bus
     $ qemu -show me a way out
Signature · 1 line
error compiling committee.c: too many arguments to function
#128 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 8 lines · Mark McLoughlin
Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

Quoted 8 lines
Quoted 3 lines

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards. Worst case we hardcode those numbers (gasp, faint).

Quoted 6 lines
Quoted 2 lines

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

It's part of the solution, but hardly a difficult the most difficult part.

Quoted 3 lines

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

    $ qemu -print-default-machine

or maybe

    $ qemu -show default-machine
    $ qemu -show pci-bus
    $ qemu -show me a way out
Signature · 1 line
error compiling committee.c: too many arguments to function
#129 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 13 lines · Avi Kivity
Quoted 12 lines · Mark McLoughlin
Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

Quoted 7 lines
Quoted 4 lines

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards.

If they're so obviously well-known, I don't see how the query mechanism would not be straightforward, which is the comment I was replying to.

Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

It's part of the solution, but hardly a difficult the most difficult part.

Agree.

Quoted 5 lines
Quoted 3 lines

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

     $ qemu -print-default-machine

Or:

  $ readlink /usr/share/qemu/machine-types/pc.dt

Cheers,
Mark.

#130 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Mark McLoughlin
Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin

So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.

I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.

Quoted 7 lines
Quoted 4 lines

If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.

A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards.

If they're so obviously well-known, I don't see how the query mechanism would not be straightforward, which is the comment I was replying to.

Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It doesn't matter though because it's orthogonal to the current proposal.

It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.

It's part of the solution, but hardly a difficult the most difficult part.

Agree.

Quoted 5 lines
Quoted 3 lines

This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.

     $ qemu -print-default-machine

Or:

  $ readlink /usr/share/qemu/machine-types/pc.dt

Cheers,
Mark.

#131 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 6 lines · Mark McLoughlin
Quoted 2 lines

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Yeah, there's precedent too.

Quoted 5 lines

Or:

   $ readlink /usr/share/qemu/machine-types/pc.dt

That works if you have exactly one qemu installed. It's best if qemu itself is the entry point (qemu -print-device-tree).

Though I wouldn't want to inflict it upon the management application writers.

Signature · 1 line
error compiling committee.c: too many arguments to function
#132 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 6 lines · Mark McLoughlin
Quoted 2 lines

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Yeah, there's precedent too.

Quoted 5 lines

Or:

   $ readlink /usr/share/qemu/machine-types/pc.dt

That works if you have exactly one qemu installed. It's best if qemu itself is the entry point (qemu -print-device-tree).

Though I wouldn't want to inflict it upon the management application writers.

Signature · 1 line
error compiling committee.c: too many arguments to function
#100 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

-- Jamie

#101 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 4 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

-- Jamie

#45 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 5 lines · Mark McLoughlin
Quoted 2 lines

After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.

Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.

As long as qemu can accept a machine config _and_ -drive file=foo (and monitor commands to add/remove devices), libvirt could merge by simply calling qemu with whatever additional command line options or monitor commands modify the config, then dump the new config.

That way, virtio would not have to deal with that complexity. It would be written in one place: qemu.

Or better, a utility: qemu-machine-config.

-- Jamie

#46 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 5 lines · Mark McLoughlin
Quoted 2 lines

After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.

Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.

As long as qemu can accept a machine config _and_ -drive file=foo (and monitor commands to add/remove devices), libvirt could merge by simply calling qemu with whatever additional command line options or monitor commands modify the config, then dump the new config.

That way, virtio would not have to deal with that complexity. It would be written in one place: qemu.

Or better, a utility: qemu-machine-config.

-- Jamie

#133 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 4 lines · Mark McLoughlin
Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Make them part of the machine configuration.

After all, they are part of the machine configuration, and ACPI, BIOS etc. need to know about all the machine slots anyway.

Having said that, I prefer the idea that slot allocation is handled either in Qemu, or in a separate utility called qemu-machine-config (for working with machine configs), or in a library libqemu-machine-config.so.

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

-- Jamie

#144 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 4 lines · Mark McLoughlin
Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

Make them part of the machine configuration.

After all, they are part of the machine configuration, and ACPI, BIOS etc. need to know about all the machine slots anyway.

Having said that, I prefer the idea that slot allocation is handled either in Qemu, or in a separate utility called qemu-machine-config (for working with machine configs), or in a library libqemu-machine-config.so.

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

-- Jamie

#102 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Jamie Lokier
Quoted 11 lines · Jamie Lokier
Quoted 5 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.

virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#103 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Jamie Lokier
Quoted 11 lines · Jamie Lokier
Quoted 5 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.

virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#134 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Jamie Lokier
Quoted 5 lines · Jamie Lokier
Quoted 4 lines · Mark McLoughlin
Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

I was being sarcastic - libvirt currently must parse qemu -help, and even has some test infrastructure to check that it works with various versions of qemu. Extending this would not be nice and clean :-)

Quoted 4 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

Cheers,
Mark.

#135 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Jamie Lokier
Quoted 5 lines · Jamie Lokier
Quoted 4 lines · Mark McLoughlin
Quoted 1 line

Worst case we hardcode those numbers (gasp, faint).

Maybe we can just add the open slots to the -help output. That'd be nice and clean.

I was being sarcastic - libvirt currently must parse qemu -help, and even has some test infrastructure to check that it works with various versions of qemu. Extending this would not be nice and clean :-)

Quoted 4 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

Cheers,
Mark.

#136 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 8 lines · Mark McLoughlin
Quoted 5 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this. Management already has to allocate MAC addresses, UUIDs, IDE interface and master/slave role, SCSI LUNs/targets/whatever. It has to understand NUMA (if not do actual allocation). Even if it doesn't allocate the slots, it has to be able to query them so it can tell the user which NIC or controller is connected where, or to do hotunplug. It has to understand that there is a limitation on the number of slots, and know what that limitation is (unless it feels that launching an overcommitted guest and showing an error to the user is preferable to not allowing the user to overcommit in the first place.

If you'll review my patent application for pci slot allocation, you'll see the following line:

slot_nr = nb_allocated_slots++; /* Allocate pci slot */

while there is a lot of complicated setup code before that (see the prior art section as well), I believe licensees could well implement the algorithm in two short months, including testing.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#137 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 8 lines · Mark McLoughlin
Quoted 5 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this. Management already has to allocate MAC addresses, UUIDs, IDE interface and master/slave role, SCSI LUNs/targets/whatever. It has to understand NUMA (if not do actual allocation). Even if it doesn't allocate the slots, it has to be able to query them so it can tell the user which NIC or controller is connected where, or to do hotunplug. It has to understand that there is a limitation on the number of slots, and know what that limitation is (unless it feels that launching an overcommitted guest and showing an error to the user is preferable to not allowing the user to overcommit in the first place.

If you'll review my patent application for pci slot allocation, you'll see the following line:

slot_nr = nb_allocated_slots++; /* Allocate pci slot */

while there is a lot of complicated setup code before that (see the prior art section as well), I believe licensees could well implement the algorithm in two short months, including testing.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#138 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 9 lines · Avi Kivity
Quoted 6 lines · Mark McLoughlin
Quoted 4 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this.

Take note of the "arcane machine-dependent slot allocation knowledge" bit.

If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

Cheers,
Mark.

#139 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Mark McLoughlin
Quoted 4 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this.

Take note of the "arcane machine-dependent slot allocation knowledge" bit.

If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

Cheers,
Mark.

#140 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

Quoted 14 lines · Mark McLoughlin
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Mark McLoughlin
Quoted 5 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this.

Quoted 7 lines

Take note of the "arcane machine-dependent slot allocation knowledge" bit.

If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.

That's the thinking.

Quoted 5 lines

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.

Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.

It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#141 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Mark McLoughlin
Quoted 14 lines · Mark McLoughlin
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Mark McLoughlin
Quoted 5 lines

I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.

Indeed.

I don't understand this.

Quoted 7 lines

Take note of the "arcane machine-dependent slot allocation knowledge" bit.

If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.

That's the thinking.

Quoted 5 lines

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.

Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.

It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#104 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Jamie Lokier
Quoted 4 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

Quoted 7 lines

virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.

virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.

I guess I meant virtio disks, so that's ok.

-- Jamie

#105 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Jamie Lokier
Quoted 4 lines · Avi Kivity

Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.

virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?

Quoted 7 lines

virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.

virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.

I guess I meant virtio disks, so that's ok.

-- Jamie

#142 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 16 lines · Avi Kivity
Quoted 5 lines

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.

Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.

Quoted 6 lines

It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.

To be honest, an elaborate machine description is probably fine...

A fancy constraint solver is not required. A simple one strikes me as about as simple as what you'd hard-code anyway, but with fewer special cases.

Note that the result can fail due to things like insufficient address space for all the device BARs even when they _are_ in the right slots. Especially if there are lots of slots, or bridges which can provide unlimited slots.

That is arcane: device-dependent, CPU-dependent, machine-dependent, RAM-size dependent (in a non-linear way), device-option-dependent and probably QEMU-version-dependent too.

It would be nice if libvirt (et al) would prevent the user from creating a VM with insufficient BAR space for that machine, but I'm not sure how to do it sanely, without arcane knowledge getting about.

Maybe that idea of a .so shared by qemu and libvirt, to manipulate device configurations, is a sane one after all.

-- Jamie

#143 lore raw

Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity
Quoted 16 lines · Avi Kivity
Quoted 5 lines

If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.

You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.

Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.

Quoted 6 lines

It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.

To be honest, an elaborate machine description is probably fine...

A fancy constraint solver is not required. A simple one strikes me as about as simple as what you'd hard-code anyway, but with fewer special cases.

Note that the result can fail due to things like insufficient address space for all the device BARs even when they _are_ in the right slots. Especially if there are lots of slots, or bridges which can provide unlimited slots.

That is arcane: device-dependent, CPU-dependent, machine-dependent, RAM-size dependent (in a non-linear way), device-option-dependent and probably QEMU-version-dependent too.

It would be nice if libvirt (et al) would prevent the user from creating a VM with insufficient BAR space for that machine, but I'm not sure how to do it sanely, without arcane knowledge getting about.

Maybe that idea of a .so shared by qemu and libvirt, to manipulate device configurations, is a sane one after all.

-- Jamie

#145 lore raw

RE: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]

In reply to Avi Kivity

Hi all,

On real hardware, I usually do not care about PCI address - instead I use slot numbers. A standard main board has about 5 pci slots where you can plug in cards. So if a card is damaged, I usually say something like 'please replace the card in the first slot'.

Can't we simply define a 'slot to pci address' mapping for each platform? For example, we reserve some pci addresses for standard hardware like ide and scsi controller, and use the rest for the slot mapping:

pci addr 1 -> reserved
pci addr 2 -> reserved for ide
pci addr 3 -> reserved for scsi
pci addr 4 -> reserved for usb hub
...

pci addr 8 -> slot 7
pci addr 9 -> slot 6
pci addr 10 -> slot 5
pci addr 11 -> slot 4
pci addr 12 -> slot 3
pci addr 13 -> slot 2
pci addr 14 -> slot 1
pci addr 15 -> slot 0

The management application can then use those slot numbers to place a device into a specific bus position.

- net nic,model=e1000,slot=0

Or is that too inflexible?

- Dietmar

#146 lore raw

cover Change virtio blk/console PCI classes and introduce compat machine type [was Re: Configuration vs. compat hints]

In reply to Anthony Liguori
Quoted 5 lines · Anthony Liguori

2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files

Okay, here's a small series of patches which changes the virtio block and console machine types and introduces a pc-0-10 machine type which uses the old PCI classes.

Cheers,
Mark.

#147 lore raw

PATCH 1/3 Change default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI

Windows virtio driver cannot pass DTM (certification) tests while the storage class is PCI_CLASS_STORAGE_UNKNOWN.

A new qdev type is introduced to allow devices using the old class to be created for compatibility with qemu-0.10.x.

---
 hw/virtio-pci.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
hw/virtio-pci.c +17 -3
index f7da503..93ee5e1 100644
@@ -414,7 +414,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
     virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
 }
 
-static void virtio_blk_init_pci(PCIDevice *pci_dev)
+static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev,
+                                           uint16_t class_code)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
@@ -423,8 +424,17 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    PCI_CLASS_STORAGE_OTHER,
-                    0x00);
+                    class_code, 0x00);
+}
+
+static void virtio_blk_init_pci(PCIDevice *pci_dev)
+{
+    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_SCSI);
+}
+
+static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)
+{
+    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -476,6 +486,10 @@ static void virtio_pci_register_devices(void)
                       virtio_console_init_pci);
     pci_qdev_register("virtio-balloon-pci", sizeof(VirtIOPCIProxy),
                       virtio_balloon_init_pci);
+
+    /* For compatibility with 0.10 */
+    pci_qdev_register("virtio-blk-pci-0-10", sizeof(VirtIOPCIProxy),
+                      virtio_blk_init_pci_0_10);
 }
 
 device_init(virtio_pci_register_devices)
Signature · 1 line
1.6.2.5
#148 lore raw

PATCH 2/3 Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER

We're using PCI_CLASS_DISPLAY_OTHER now, but qemu-kvm.git is using PCI_CLASS_OTHERS because:

"As a PCI_CLASS_DISPLAY_OTHER, it reduces primary display somehow on
Windows XP (possibly Windows disables acceleration since it fails to find a driver)."

While this is valid, many versions of X will get confused by it. Class major number of 0 gets treated as a possibly prehistoric VGA device, and then the autoconfig logic gets confused trying to figure out whether the virtio console or the pv vga device are the real VGA.

We should really set a proper class ID. 0x0780 (serial / other) seems most appropriate. This shouldn't require any kernel changes, the modalias for virtio looks like:

alias: pci:v00001AF4d*sv*sd*bc*sc*i*

so won't care what the base class or subclass are.

It shows up in the guest as:

00:05.0 Communication controller: Qumranet, Inc. Virtio console

A new qdev type is introduced to allow devices using the old class to be created for compatibility with qemu-0.10.x.

---
 hw/pci_ids.h    |    3 +++
 hw/virtio-pci.c |   18 +++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
hw/pci_ids.h +3 -0
index 3afe674..2fe60ee 100644
@@ -35,6 +35,9 @@
 #define PCI_CLASS_BRIDGE_PCI             0x0604
 #define PCI_CLASS_BRIDGE_OTHER           0x0680
 
+#define PCI_CLASS_SERIAL_OTHER           0x0780
+
+#define PCI_CLASS_PROCESSOR_CO           0x0b40
 #define PCI_CLASS_COMMUNICATION_OTHER    0x0780
 
 #define PCI_CLASS_PROCESSOR_CO           0x0b40
hw/virtio-pci.c +15 -3
index 93ee5e1..6d3420d 100644
@@ -437,7 +437,8 @@ static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)
     virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER);
 }
 
-static void virtio_console_init_pci(PCIDevice *pci_dev)
+static void virtio_console_init_pci_with_class(PCIDevice *pci_dev,
+                                               uint16_t class_code)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
@@ -446,8 +447,17 @@ static void virtio_console_init_pci(PCIDevice *pci_dev)
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_CONSOLE,
-                    PCI_CLASS_DISPLAY_OTHER,
-                    0x00);
+                    class_code, 0x00);
+}
+
+static void virtio_console_init_pci(PCIDevice *pci_dev)
+{
+    virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_SERIAL_OTHER);
+}
+
+static void virtio_console_init_pci_0_10(PCIDevice *pci_dev)
+{
+    virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_DISPLAY_OTHER);
 }
 
 static void virtio_net_init_pci(PCIDevice *pci_dev)
@@ -490,6 +500,8 @@ static void virtio_pci_register_devices(void)
     /* For compatibility with 0.10 */
     pci_qdev_register("virtio-blk-pci-0-10", sizeof(VirtIOPCIProxy),
                       virtio_blk_init_pci_0_10);
+    pci_qdev_register("virtio-console-pci-0-10", sizeof(VirtIOPCIProxy),
+                      virtio_console_init_pci_0_10);
 }
 
 device_init(virtio_pci_register_devices)
Signature · 1 line
1.6.2.5
#149 lore raw

PATCH 3/3 Add a pc-0-10 machine type for compatibility with 0.10.x

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.

---
 hw/pc.c |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)
hw/pc.c +40 -6
index 553ba5c..9025f78 100644
@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
-                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *kernel_filename,
+                     const char *kernel_cmdline,
                      const char *initrd_filename,
-                     int pci_enabled, const char *cpu_model)
+                     const char *cpu_model,
+                     int pci_enabled,
+                     int compat_0_10)
 {
     char *filename;
     int ret, linux_boot, i;
@@ -1104,6 +1107,7 @@ static void pc_init1(ram_addr_t ram_size,
     BlockDriverState *fd[MAX_FD];
     int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
     void *fw_cfg;
+    const char *virtio_blk_name, *virtio_console_name;
 
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
@@ -1394,13 +1398,21 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }
 
+    virtio_blk_name = "virtio-blk-pci";
+    virtio_console_name = "virtio-console-pci";
+
+    if (compat_0_10) {
+        virtio_blk_name = "virtio-blk-pci-0-10";
+        virtio_console_name = "virtio-console-pci-0-10";
+    }
+
     /* Add virtio block devices */
     if (pci_enabled) {
         int index;
         int unit_id = 0;
 
         while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
-            pci_dev = pci_create("virtio-blk-pci",
+            pci_dev = pci_create(virtio_blk_name,
                                  drives_table[index].devaddr);
             qdev_init(&pci_dev->qdev);
             unit_id++;
@@ -1417,7 +1429,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (pci_enabled) {
         for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
             if (virtcon_hds[i]) {
-                pci_create_simple(pci_bus, -1, "virtio-console-pci");
+                pci_create_simple(pci_bus, -1, virtio_console_name);
             }
         }
     }
@@ -1432,7 +1444,7 @@ static void pc_init_pci(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, 1, cpu_model);
+             initrd_filename, cpu_model, 1, 0);
 }
 
 static void pc_init_isa(ram_addr_t ram_size,
@@ -1444,7 +1456,19 @@ static void pc_init_isa(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, 0, cpu_model);
+             initrd_filename, cpu_model, 0, 0);
+}
+
+static void pc_init_pci_0_10(ram_addr_t ram_size,
+                             const char *boot_device,
+                             const char *kernel_filename,
+                             const char *kernel_cmdline,
+                             const char *initrd_filename,
+                             const char *cpu_model)
+{
+    pc_init1(ram_size, boot_device,
+             kernel_filename, kernel_cmdline,
+             initrd_filename, cpu_model, 1, 1);
 }
 
 /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1470,10 +1494,20 @@ static QEMUMachine isapc_machine = {
     .max_cpus = 1,
 };
 
+static QEMUMachine pc_0_10_machine = {
+    .name = "pc-0-10",
+    .desc = "Standard PC compatibile with qemu 0.10.x",
+    .init = pc_init_pci_0_10,
+    .max_cpus = 255,
+};
+
 static void pc_machine_init(void)
 {
     qemu_register_machine(&pc_machine);
     qemu_register_machine(&isapc_machine);
+
+    /* For compatibility with 0.10.x */
+    qemu_register_machine(&pc_0_10_machine);
 }
 
 machine_init(pc_machine_init);
Signature · 1 line
1.6.2.5
#150 lore raw

Re: [Qemu-devel] [PATCH 3/3] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 15 lines · Mark McLoughlin

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.

---
  hw/pc.c |   46 ++++++++++++++++++++++++++++++++++++++++------
  1 files changed, 40 insertions(+), 6 deletions(-)
hw/pc.c +0 -0
index 553ba5c..9025f78 100644
@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)
  /* PC hardware initialisation */
  static void pc_init1(ram_addr_t ram_size,

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1093

Quoted 10 lines
hw/pc.c +5 -2
                       const char *boot_device,
-                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *kernel_filename,
+                     const char *kernel_cmdline,
                       const char *initrd_filename,
-                     int pci_enabled, const char *cpu_model)
+                     const char *cpu_model,
+                     int pci_enabled,
+                     int compat_0_10)
 

compat_level ( == COMPAT_DEFAULT, COMPAT_0_10 ).

hw/pc.c static QEMUMachine isapc_machine = { · line 1499

Quoted 4 lines
hw/pc.c +3 -0
+static QEMUMachine pc_0_10_machine = {
+    .name = "pc-0-10",
+    .desc = "Standard PC compatibile with qemu 0.10.x",

"compatible"

hw/pc.c static QEMUMachine isapc_machine = { · line 1501

Quoted 3 lines
hw/pc.c +2 -0
+    .init = pc_init_pci_0_10,
+    .max_cpus = 255,

.compat_level = COMPAT_0_10,

Quoted 3 lines
hw/pc.c +2 -0
+};
+
Signature · 1 line
error compiling committee.c: too many arguments to function
#151 lore raw

Re: [Qemu-devel] [PATCH 3/3] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 35 lines · Avi Kivity
Quoted 15 lines · Mark McLoughlin

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.

---
  hw/pc.c |   46 ++++++++++++++++++++++++++++++++++++++++------
  1 files changed, 40 insertions(+), 6 deletions(-)
hw/pc.c +0 -0
index 553ba5c..9025f78 100644
@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)
  /* PC hardware initialisation */
  static void pc_init1(ram_addr_t ram_size,

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1093

Quoted 10 lines
hw/pc.c +5 -2
                       const char *boot_device,
-                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *kernel_filename,
+                     const char *kernel_cmdline,
                       const char *initrd_filename,
-                     int pci_enabled, const char *cpu_model)
+                     const char *cpu_model,
+                     int pci_enabled,
+                     int compat_0_10)
 

compat_level ( == COMPAT_DEFAULT, COMPAT_0_10 ).

hw/pc.c static QEMUMachine isapc_machine = { · line 1499

Quoted 4 lines
hw/pc.c +3 -0
+static QEMUMachine pc_0_10_machine = {
+    .name = "pc-0-10",
+    .desc = "Standard PC compatibile with qemu 0.10.x",
Quoted 7 lines

"compatible"

hw/pc.c static QEMUMachine isapc_machine = { · line 1501

Quoted 3 lines
hw/pc.c +2 -0
+    .init = pc_init_pci_0_10,
+    .max_cpus = 255,

.compat_level = COMPAT_0_10,

Yep, this would be nice.

To do it, I'd add a machine_compat_level enum member to QEMUMachine and pass a QEMUMachine pointer to QEMUMachineInitFunc.

Happy to do that, and fix up the >50 affected machine types, but before going to that bother I'd prefer to first get some indication that the general approach would be accepted :-)

Following up with a slightly better patch, but still confined to hw/pc.c

Cheers,
Mark.

#152 lore raw

PATCH v2 3/3 Add a pc-0-10 machine type for compatibility with 0.10.x

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.

---
 hw/pc.c |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 6 deletions(-)
hw/pc.c +53 -6
index 553ba5c..de23fa7 100644
@@ -1081,12 +1081,20 @@ static CPUState *pc_new_cpu(const char *cpu_model)
     return env;
 }
 
+enum {
+    COMPAT_DEFAULT = 0,
+    COMPAT_0_10, /* compatible with qemu 0.10.x */
+};
+
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
-                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *kernel_filename,
+                     const char *kernel_cmdline,
                      const char *initrd_filename,
-                     int pci_enabled, const char *cpu_model)
+                     const char *cpu_model,
+                     int pci_enabled,
+                     int compat_level)
 {
     char *filename;
     int ret, linux_boot, i;
@@ -1104,6 +1112,7 @@ static void pc_init1(ram_addr_t ram_size,
     BlockDriverState *fd[MAX_FD];
     int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
     void *fw_cfg;
+    const char *virtio_blk_name, *virtio_console_name;
 
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
@@ -1394,13 +1403,26 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }
 
+    switch (compat_level) {
+    case COMPAT_DEFAULT:
+    default:
+        virtio_blk_name = "virtio-blk-pci";
+        virtio_console_name = "virtio-console-pci";
+        break;
+
+    case COMPAT_0_10:
+        virtio_blk_name = "virtio-blk-pci-0-10";
+        virtio_console_name = "virtio-console-pci-0-10";
+        break;
+    }
+
     /* Add virtio block devices */
     if (pci_enabled) {
         int index;
         int unit_id = 0;
 
         while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
-            pci_dev = pci_create("virtio-blk-pci",
+            pci_dev = pci_create(virtio_blk_name,
                                  drives_table[index].devaddr);
             qdev_init(&pci_dev->qdev);
             unit_id++;
@@ -1417,7 +1439,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (pci_enabled) {
         for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
             if (virtcon_hds[i]) {
-                pci_create_simple(pci_bus, -1, "virtio-console-pci");
+                pci_create_simple(pci_bus, -1, virtio_console_name);
             }
         }
     }
@@ -1432,7 +1454,8 @@ static void pc_init_pci(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, 1, cpu_model);
+             initrd_filename, cpu_model,
+             1, COMPAT_DEFAULT);
 }
 
 static void pc_init_isa(ram_addr_t ram_size,
@@ -1444,7 +1467,21 @@ static void pc_init_isa(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, 0, cpu_model);
+             initrd_filename, cpu_model,
+             0, COMPAT_DEFAULT);
+}
+
+static void pc_init_pci_0_10(ram_addr_t ram_size,
+                             const char *boot_device,
+                             const char *kernel_filename,
+                             const char *kernel_cmdline,
+                             const char *initrd_filename,
+                             const char *cpu_model)
+{
+    pc_init1(ram_size, boot_device,
+             kernel_filename, kernel_cmdline,
+             initrd_filename, cpu_model,
+             1, COMPAT_0_10);
 }
 
 /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1470,10 +1507,20 @@ static QEMUMachine isapc_machine = {
     .max_cpus = 1,
 };
 
+static QEMUMachine pc_0_10_machine = {
+    .name = "pc-0-10",
+    .desc = "Standard PC compatible with qemu 0.10.x",
+    .init = pc_init_pci_0_10,
+    .max_cpus = 255,
+};
+
 static void pc_machine_init(void)
 {
     qemu_register_machine(&pc_machine);
     qemu_register_machine(&isapc_machine);
+
+    /* For compatibility with 0.10.x */
+    qemu_register_machine(&pc_0_10_machine);
 }
 
 machine_init(pc_machine_init);
Signature · 1 line
1.6.2.5
#153 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087

Quoted 7 lines · Mark McLoughlin

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.

hw/pc.c +4 -0
+enum {
+    COMPAT_DEFAULT = 0,
+    COMPAT_0_10, /* compatible with qemu 0.10.x */
+};

Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.

Maybe better add a global '-compat' switch and a global compat enum where every driver can just look at?

Another question: Is migrating from 0.11 in 0.10-compat mode to 0.10 supposed to work? If so we make virtio-net better turn off msi then.

cheers,
Gerd

#154 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 10 lines · Gerd Hoffmann

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087

Quoted 7 lines · Mark McLoughlin

Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.

hw/pc.c +4 -0
+enum {
+    COMPAT_DEFAULT = 0,
+    COMPAT_0_10, /* compatible with qemu 0.10.x */
+};

Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.

No, it's right. A machine type is nothing more than a default device tree. If we want to change what the default device tree is and wish to maintain compatibility, we need to introduce a new device tree so that the old one can be still accessed.

So basically, if we had device config files, it would look like:

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

For other board types, they would also need to version their device trees too.

Quoted 1 line

Another question: Is migrating from 0.11 in 0.10-compat mode to 0.10 supposed to work? If so we make virtio-net better turn off msi then.

If you mean live migration, no. However, live migration from 0.10 to 0.11 in 0.10-compat mode should work.

But from the guest perspective, 0.10-compat mode should look identical to 0.10 which means we do want to turn off msi.

Regards,

Anthony Liguori

Quoted 5 lines

cheers,
Gerd

#155 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087

Quoted 4 lines
hw/pc.c +4 -0
+enum {
+ COMPAT_DEFAULT = 0,
+ COMPAT_0_10, /* compatible with qemu 0.10.x */
+};

Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.

Quoted 2 lines

No, it's right. A machine type is nothing more than a default device tree.

Plain "-M pc" has no virtio blk device.

Quoted 5 lines

So basically, if we had device config files, it would look like:

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

Doesn't work. Your virtio blk device isn't in there.

cheers,
Gerd

#156 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 16 lines · Gerd Hoffmann
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann

hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087

Quoted 4 lines
hw/pc.c +4 -0
+enum {
+ COMPAT_DEFAULT = 0,
+ COMPAT_0_10, /* compatible with qemu 0.10.x */
+};

Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.

Quoted 2 lines

No, it's right. A machine type is nothing more than a default device tree.

Plain "-M pc" has no virtio blk device.

Quoted 7 lines
Quoted 5 lines

So basically, if we had device config files, it would look like:

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

Doesn't work. Your virtio blk device isn't in there.

Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.

Cheers,
Mark.

#157 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 9 lines · Mark McLoughlin
Quoted 4 lines · Gerd Hoffmann
Quoted 3 lines

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

Doesn't work. Your virtio blk device isn't in there.

Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.

Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at.

We have different versions of devices. We should model them that way. I'd start with a global compat_level. We might switch to a per-device compat level later if there is a need. With qdev it should be easy once the devices are converted. I think it will be much more better maintainable than adding new devices because there is a standardized way to switch a driver to an older version instead of having to know "oh, that driver has these compat versions, but this one hasn't".

virtio blk+console will switch class for compat_level < 0.11. virtio net will disable msi for compat_level < 0.11. ide might adapt the firmware version for the virtual disk/cdrom to the compat level. Everybody else is free to ignore it.

Note that different machine config versions might make sense nevertheless in case the set of (default) devices changes. i.e. if we turn on usb by default we might add a compat machine type without usb.

cheers,
Gerd

#158 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Mark McLoughlin
Quoted 3 lines · Gerd Hoffmann
Quoted 3 lines

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Doesn't work. Your virtio blk device isn't in there.

Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.

Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at. We have different versions of devices.

We have options that we can tweak for devices. That doesn't mean they're versioned. What the default set of options that is turned on for any given device is determined by the machine type (since the machine init is what creates the devices to start with).

Linear versioning doesn't work because there are too many forks of QEMU (each distro release that includes backported features is a fork).

Regards.

Anthony Liguori

#159 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 12 lines · Anthony Liguori
Quoted 11 lines · Gerd Hoffmann
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines · Gerd Hoffmann
Quoted 3 lines

/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts

Doesn't work. Your virtio blk device isn't in there.

Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.

Quoted 8 lines
Quoted 3 lines

Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at. We have different versions of devices.

We have options that we can tweak for devices. That doesn't mean they're versioned. What the default set of options that is turned on for any given device is determined by the machine type (since the machine init is what creates the devices to start with).

The machine init doesn't create all devices. USB devices are created outside machine init today, and that will become more and more common.

I expect long-term we will end up with one of these two models:

(1) - machine init creates just the bare devices, i.e. what is there when you specify just '-M pc'. Either hardcoded or from machine config file.
- generic code adds devices added by cmd line switches.

(2) - command line switches insert additional devices into the bare (-M pc) device tree.
- The virtual machine is created from that modified device tree.

I both cases it is not clear how the machine init / machine config will handle the versioning of the devices added by command line switches.

We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:

virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).

pc-0.10 could then register a list of default properties, i.e. something like

"virtio-blk-pci" => "class=0x??"
"virtio-console-pci" => "class=0x??"
"virtio-net-pci => "msi=0"
"ide-disk" => "fw-version=0.10.0"

When creating devices qdev would apply them.

I can prototype that.

comments?

Gerd

#188 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Anthony Liguori
Quoted 1 line · Anthony Liguori

Linear versioning doesn't work because there are too many forks of QEMU (each distro release that includes backported features is a fork).

So long as distro backports are non-default it should work out. If we can set things up so a backport naturally winds up non-default, maybe we can restore some sanity.

Signature · 1 line
error compiling committee.c: too many arguments to function
#160 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Gerd Hoffmann
Quoted 17 lines · Gerd Hoffmann

We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:

virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).

pc-0.10 could then register a list of default properties, i.e. something
like

   "virtio-blk-pci"     => "class=0x??"
   "virtio-console-pci" => "class=0x??"
   "virtio-net-pci      => "msi=0"
   "ide-disk"           => "fw-version=0.10.0"
Quoted 5 lines

When creating devices qdev would apply them.

I can prototype that.

comments?

I think this would be a very nice way of making what I did more generic, but with the same external interface.

Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.

If we're settled on adding '-M pc-0-10', I next want to:

1) add '-M pc-0-11' and make it the default

2) make '-M pc' a symlink to the latest machine type

i.e. 'qemu-system-x86_64 -M ?' would give:

Supported machines are:

  pc         Standard PC with latest features
  pc-0-11    Standard PC compatible with qemu 0.11.x (default)
  pc-0-10    Standard PC compatible with qemu 0.10.x
  isapc      ISA-only PC

and libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:

<os>

    <type arch='x86_64' machine='pc-0-11'>hvm</type>

</os>

Cheers,
Mark.

#161 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 46 lines · Mark McLoughlin
Quoted 17 lines · Gerd Hoffmann

We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:

virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).

pc-0.10 could then register a list of default properties, i.e. something
like

    "virtio-blk-pci"     =>  "class=0x??"
    "virtio-console-pci" =>  "class=0x??"
    "virtio-net-pci      =>  "msi=0"
    "ide-disk"           =>  "fw-version=0.10.0"
Quoted 6 lines

When creating devices qdev would apply them.

I can prototype that.

comments?

I think this would be a very nice way of making what I did more generic, but with the same external interface.

Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.

If we're settled on adding '-M pc-0-10', I next want to:

1) add '-M pc-0-11' and make it the default

2) make '-M pc' a symlink to the latest machine type

i.e. 'qemu-system-x86_64 -M ?' would give:

Supported machines are:

   pc         Standard PC with latest features
   pc-0-11    Standard PC compatible with qemu 0.11.x (default)
   pc-0-10    Standard PC compatible with qemu 0.10.x
   isapc      ISA-only PC
Quoted 8 lines

and libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:

   <os>
     <type arch='x86_64' machine='pc-0-11'>hvm</type>
   </os>

Looks good. But why 0-11 and not 0.11?

Signature · 1 line
error compiling committee.c: too many arguments to function
#162 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 50 lines · Avi Kivity
Quoted 49 lines · Mark McLoughlin
Quoted 17 lines · Gerd Hoffmann

We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:

virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).

pc-0.10 could then register a list of default properties, i.e. something
like

    "virtio-blk-pci"     =>  "class=0x??"
    "virtio-console-pci" =>  "class=0x??"
    "virtio-net-pci      =>  "msi=0"
    "ide-disk"           =>  "fw-version=0.10.0"
Quoted 6 lines

When creating devices qdev would apply them.

I can prototype that.

comments?

I think this would be a very nice way of making what I did more generic, but with the same external interface.

Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.

If we're settled on adding '-M pc-0-10', I next want to:

1) add '-M pc-0-11' and make it the default

2) make '-M pc' a symlink to the latest machine type

i.e. 'qemu-system-x86_64 -M ?' would give:

Supported machines are:

   pc         Standard PC with latest features
   pc-0-11    Standard PC compatible with qemu 0.11.x (default)
   pc-0-10    Standard PC compatible with qemu 0.10.x
   isapc      ISA-only PC

and libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:

Quoted 7 lines
Quoted 5 lines
   <os>
     <type arch='x86_64' machine='pc-0-11'>hvm</type>
   </os>

Looks good. But why 0-11 and not 0.11?

I really wanted to use an underscore, but I thought a hyphen was a good compromise.

Cheers,
Mark.

#163 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 7 lines · Mark McLoughlin
Quoted 2 lines

Looks good. But why 0-11 and not 0.11?

I really wanted to use an underscore, but I thought a hyphen was a good compromise.

A period is really a very short underscore.

Signature · 1 line
error compiling committee.c: too many arguments to function
#164 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Mark McLoughlin
Quoted 7 lines
Quoted 1 line

comments?

I think this would be a very nice way of making what I did more generic, but with the same external interface.

Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.

I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.

Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...

cheers,
Gerd

#165 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Hi,

Quoted 3 lines

I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.

To back that with some code here is a quick patch. Not splitted up yet.
Only virtio-blk is handled for demonstration purposes.

Will not apply cleanly as it depends on both posted and not-yet posted patches in my patch queue. Once my qdev properties patch is in it should be easy to rebase to upstream/master though.

cheers,
Gerd

hw/boards.h +1 -0
index f6733b7..5a07d07 100644
@@ -17,6 +17,7 @@ typedef struct QEMUMachine {
     int use_scsi;
     int max_cpus;
     int is_default;
+    struct CompatProperty *compat_props;
     struct QEMUMachine *next;
 } QEMUMachine;
 
hw/pc.c +16 -0
index 38678da..cd64ccf 100644
@@ -1460,6 +1460,21 @@ static QEMUMachine pc_machine = {
     .is_default = 1,
 };
 
+static QEMUMachine pc_machine_v0_10 = {
+    .name = "pc-0.10",
+    .desc = "Standard PC, qemu 0.10",
+    .init = pc_init_pci,
+    .max_cpus = 255,
+    .compat_props = (CompatProperty[]) {
+        {
+            .driver   = "virtio-blk-pci",
+            .property = "class",
+            .value    = "0x0180", /* PCI_CLASS_STORAGE_OTHER */
+        },
+        { /* end of list */ }
+    },
+};
+
 static QEMUMachine isapc_machine = {
     .name = "isapc",
     .desc = "ISA-only PC",
@@ -1470,6 +1485,7 @@ static QEMUMachine isapc_machine = {
 static void pc_machine_init(void)
 {
     qemu_register_machine(&pc_machine);
+    qemu_register_machine(&pc_machine_v0_10);
     qemu_register_machine(&isapc_machine);
 }
 
hw/qdev-properties.c +19 -0
index 720001b..bec756d 100644
@@ -228,3 +228,22 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props)
     }
 }
 
+static CompatProperty *compat_props;
+
+void qdev_register_compat_props(CompatProperty *props)
+{
+    compat_props = props;
+}
+
+void qdev_prop_set_compat(DeviceState *dev)
+{
+    CompatProperty *prop;
+
+    if (!compat_props)
+        return;
+    for (prop = compat_props; prop->driver != NULL; prop++) {
+        if (strcmp(dev->info->name, prop->driver) != 0)
+            continue;
+        qdev_prop_parse(dev, prop->property, prop->value);
+    }
+}
hw/qdev.c +1 -0
index 9f7ac0b..ebb6bcf 100644
@@ -130,6 +130,7 @@ DeviceState *qdev_create(BusState *bus, const char *name)
     dev->parent_bus = bus;
     qdev_prop_set_defaults(dev, dev->info->props);
     qdev_prop_set_defaults(dev, dev->parent_bus->info->props);
+    qdev_prop_set_compat(dev);
     LIST_INSERT_HEAD(&bus->children, dev, sibling);
     return dev;
 }
hw/qdev.h +11 -0
index be10f44..5b4c1b0 100644
@@ -8,6 +8,8 @@ typedef struct Property Property;
 
 typedef struct PropertyInfo PropertyInfo;
 
+typedef struct CompatProperty CompatProperty;
+
 typedef struct DeviceInfo DeviceInfo;
 
 typedef struct BusState BusState;
@@ -63,6 +65,12 @@ struct PropertyInfo {
     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
 };
 
+struct CompatProperty {
+    const char *driver;
+    const char *property;
+    const char *value;
+};
+
 /*** Board API.  This should go away once we have a machine config file.  ***/
 
 DeviceState *qdev_create(BusState *bus, const char *name);
@@ -152,4 +160,7 @@ int qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value);
 int qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
 void qdev_prop_set_defaults(DeviceState *dev, Property *props);
 
+void qdev_register_compat_props(CompatProperty *props);
+void qdev_prop_set_compat(DeviceState *dev);
+
 #endif
hw/virtio-pci.c +10 -8
index 96f3764..996dadb 100644
@@ -87,12 +87,7 @@ typedef struct {
     VirtIODevice *vdev;
     uint32_t addr;
 
-    uint16_t vendor;
-    uint16_t device;
-    uint16_t subvendor;
-    uint16_t class_code;
-    uint8_t pif;
-
+    uint32_t class_code;
     qname hostlink;
 } VirtIOPCIProxy;
 
@@ -421,12 +416,15 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
+    if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
+        proxy->class_code != PCI_CLASS_STORAGE_OTHER)
+        proxy->class_code = PCI_CLASS_STORAGE_SCSI;
+
     vdev = virtio_blk_init(&pci_dev->qdev, proxy->hostlink);
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    PCI_CLASS_STORAGE_OTHER,
-                    0x00);
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -478,6 +476,10 @@ static PCIDeviceInfo virtio_info[] = {
                 .name   = "drive",
                 .info   = &qdev_prop_name,
                 .offset = offsetof(VirtIOPCIProxy, hostlink),
+            },{
+                .name   = "class",
+                .info   = &qdev_prop_hex32,
+                .offset = offsetof(VirtIOPCIProxy, class_code),
             },
             {/* end of list */}
         },
vl.c +2 -0
index 0acc1de..2c5608f 100644
@@ -6030,6 +6030,8 @@ int main(int argc, char **argv, char **envp)
 
     module_call_init(MODULE_INIT_DEVICE);
 
+    if (machine->compat_props)
+        qdev_register_compat_props(machine->compat_props);
     machine->init(ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
#171 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Gerd Hoffmann
Quoted 3 lines · Gerd Hoffmann

Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...

I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.

I have a similar 'next' branch in qemu-kvm.git.

Signature · 1 line
error compiling committee.c: too many arguments to function
#172 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

Quoted 8 lines · Avi Kivity
Quoted 3 lines · Gerd Hoffmann

Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...

I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.

I have a similar 'next' branch in qemu-kvm.git.

Do you frequently rebase next? I was afraid that people would not be able to cope with a branch that rebased all of the time.

Regards,

Anthony Liguori

#166 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Gerd Hoffmann
Quoted 2 lines · Gerd Hoffmann

I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place.

Ah, I see why ... with your -device stuff, these new devices types would become part of the public interface.

If they were to be public, we'd probably want them to become virtio-$type-pci-$feature instead. As pointed out before, that becomes cumbersome.

Quoted 12 lines
hw/pc.c +4 -0
index 38678da..cd64ccf 100644
@@ -1460,6 +1460,21 @@ static QEMUMachine pc_machine = {
     .is_default = 1,
 };
 
+static QEMUMachine pc_machine_v0_10 = {
+    .name = "pc-0.10",
+    .desc = "Standard PC, qemu 0.10",
+    .init = pc_init_pci,

hw/pc.c static QEMUMachine pc_machine = { · line 1476

Quoted 10 lines
hw/pc.c +10 -0
+    .max_cpus = 255,
+    .compat_props = (CompatProperty[]) {
+        {
+            .driver   = "virtio-blk-pci",
+            .property = "class",
+            .value    = "0x0180", /* PCI_CLASS_STORAGE_OTHER */
+        },
+        { /* end of list */ }
+    },
+};

I did actually experiment with something similar to this, but backed off because I didn't like putting such details (i.e. the class value) in hw/pc.c rather than keeping them self contained in the driver code. Especially since it'll have to be replicated for every machine which can use the device.

Hmm, if this was a machine config file, would be do something like "include compat-props-0.10.conf"? Maybe something similar is in order here?

Cheers,
Mark.

#168 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.

To back that with some code here is a quick patch. Not splitted up yet. Only virtio-blk is handled for demonstration purposes.

Will not apply cleanly as it depends on both posted and not-yet posted patches in my patch queue. Once my qdev properties patch is in it should be easy to rebase to upstream/master though.

It came out looking pretty good. The literal syntax is new to me:

+ .compat_props = (CompatProperty[]) {
+ {

I assume this is a GCC-ism?

Regards,

Anthony Liguori

#167 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Mark McLoughlin
Quoted 12 lines · Mark McLoughlin
Quoted 12 lines
hw/pc.c +12 -0
+static QEMUMachine pc_machine_v0_10 = {
+    .name = "pc-0.10",
+    .desc = "Standard PC, qemu 0.10",
+    .init = pc_init_pci,
+    .max_cpus = 255,
+    .compat_props = (CompatProperty[]) {
+        {
+            .driver   = "virtio-blk-pci",
+            .property = "class",
+            .value    = "0x0180", /* PCI_CLASS_STORAGE_OTHER */
+        },
+        { /* end of list */ }
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+    },
+};

I did actually experiment with something similar to this, but backed off because I didn't like putting such details (i.e. the class value) in hw/pc.c rather than keeping them self contained in the driver code. Especially since it'll have to be replicated for every machine which can use the device.

We don't need to have the list inline. We can have

CompatProperty compat_qemu_0_10[] {
[ properties here ]
};

somewhere and then just reference it like this:

static QEMUMachine pc_machine_v0_10 = {
    .name = "pc-0.10",
    [ ... ]
    .compat_props = &compat_qemu_0_10,
};

from multiple machine types.

cheers,
Gerd

#169 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori

It came out looking pretty good. The literal syntax is new to me:

+ .compat_props = (CompatProperty[]) {
+ {

I assume this is a GCC-ism?

Not sure. Could also be C99. It is new to me too.

One of Pauls patches brought it in (check hw/syborg_timer.c, pretty close to the bottom). I found it very useful for building up static data structures and picked it up.

cheers,
Gerd

#173 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori
Quoted 3 lines

I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.

I have a similar 'next' branch in qemu-kvm.git.

Do you frequently rebase next?

'next' is a throwaway branch. It's subject to change without notice.

Quoted 1 line

I was afraid that people would not be able to cope with a branch that rebased all of the time.

It's a way to see what you're thinking; no one should base a long running branch on it. I think it's fairly safe to do, people who are likely to create long running branches will be fairly knowledgable about the processes we use.

Signature · 1 line
error compiling committee.c: too many arguments to function
#174 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Gerd Hoffmann
Quoted 11 lines · Gerd Hoffmann
Quoted 7 lines
Quoted 1 line

comments?

I think this would be a very nice way of making what I did more generic, but with the same external interface.

Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.

I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.

Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now.

Holiday + sudden non-QEMU work items. I'm trying to block off some time this afternoon but this has been a tough week for me.

Quoted 2 lines

There are lots of patches on the list unprocessed, ranging from
simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...

It's not so easy to just distribute commit access to loads of people. However, we still have a pretty low patch acceptance rate so peer review + testing would certainly help reduce the overall patch traffic.

So I'd encourage folks to take some time and review/test patches on the list. For those that already do, it's greatly appreciated.

Regards,

Anthony Liguori

#170 lore raw

Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x

In reply to Anthony Liguori
Quoted 6 lines

It came out looking pretty good. The literal syntax is new to me:

hw/pc.c +2 -0
+    .compat_props = (CompatProperty[]) {
+        {

I assume this is a GCC-ism?

Compound literals ("(Foo[]){...}") are a standard C99 feature, as are designated initializers (".foo = ...")

Paul

#189 lore raw

Re: [Qemu-devel] [PATCH 2/3] Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER

In reply to Mark McLoughlin
Quoted 5 lines · Mark McLoughlin
hw/pci_ids.h +0 -0
index 3afe674..2fe60ee 100644

hw/pci_ids.h line 43

Quoted 9 lines
hw/pci_ids.h +3 -0
@@ -35,6 +35,9 @@
 #define PCI_CLASS_BRIDGE_PCI             0x0604
 #define PCI_CLASS_BRIDGE_OTHER           0x0680
 
+#define PCI_CLASS_SERIAL_OTHER           0x0780
+
+#define PCI_CLASS_PROCESSOR_CO           0x0b40
 #define PCI_CLASS_COMMUNICATION_OTHER    0x0780
 
 #define PCI_CLASS_PROCESSOR_CO           0x0b40

Those defines already exist; they're also seen in the hunk:
PCI_CLASS_COMMUNICATION_OTHER and the other with the same name.

Amit

#175 lore raw

cover Add pc-0.11 machine type and make pc an alias to it

In reply to Mark McLoughlin

Hi,
Here's a series of small patches to finish off the machine type
compat work for 0.11.

The idea is that the likes of libvirt can canonicalize the 'pc'
machine type to the current latest version of the pc machine type and retain that in the VM configuration. That allows users to easily continue running their VMs with the same machine type with which they were originally created.

Thanks,
Mark.

#176 lore raw

PATCH 1/4 Remove the pc-0-10 machine type

In reply to Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

---
 hw/pc.c |   55 +++++--------------------------------------------------
 1 files changed, 5 insertions(+), 50 deletions(-)
hw/pc.c +5 -50
index a50f23d..0ebc329 100644
@@ -1100,11 +1100,6 @@ static CPUState *pc_new_cpu(const char *cpu_model)
     return env;
 }
 
-enum {
-    COMPAT_DEFAULT = 0,
-    COMPAT_0_10, /* compatible with qemu 0.10.x */
-};
-
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
@@ -1112,8 +1107,7 @@ static void pc_init1(ram_addr_t ram_size,
                      const char *kernel_cmdline,
                      const char *initrd_filename,
                      const char *cpu_model,
-                     int pci_enabled,
-                     int compat_level)
+                     int pci_enabled)
 {
     char *filename;
     int ret, linux_boot, i;
@@ -1131,7 +1125,6 @@ static void pc_init1(ram_addr_t ram_size,
     BlockDriverState *fd[MAX_FD];
     int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
     void *fw_cfg;
-    const char *virtio_blk_name, *virtio_console_name;
 
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
@@ -1422,26 +1415,13 @@ static void pc_init1(ram_addr_t ram_size,
         }
     }
 
-    switch (compat_level) {
-    case COMPAT_DEFAULT:
-    default:
-        virtio_blk_name = "virtio-blk-pci";
-        virtio_console_name = "virtio-console-pci";
-        break;
-
-    case COMPAT_0_10:
-        virtio_blk_name = "virtio-blk-pci-0-10";
-        virtio_console_name = "virtio-console-pci-0-10";
-        break;
-    }
-
     /* Add virtio block devices */
     if (pci_enabled) {
         int index;
         int unit_id = 0;
 
         while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) {
-            pci_dev = pci_create(virtio_blk_name,
+            pci_dev = pci_create("virtio-blk-pci",
                                  drives_table[index].devaddr);
             qdev_init(&pci_dev->qdev);
             unit_id++;
@@ -1458,7 +1438,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (pci_enabled) {
         for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
             if (virtcon_hds[i]) {
-                pci_create_simple(pci_bus, -1, virtio_console_name);
+                pci_create_simple(pci_bus, -1, "virtio-console-pci");
             }
         }
     }
@@ -1473,8 +1453,7 @@ static void pc_init_pci(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             1, COMPAT_DEFAULT);
+             initrd_filename, cpu_model, 1);
 }
 
 static void pc_init_isa(ram_addr_t ram_size,
@@ -1486,21 +1465,7 @@ static void pc_init_isa(ram_addr_t ram_size,
 {
     pc_init1(ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             0, COMPAT_DEFAULT);
-}
-
-static void pc_init_pci_0_10(ram_addr_t ram_size,
-                             const char *boot_device,
-                             const char *kernel_filename,
-                             const char *kernel_cmdline,
-                             const char *initrd_filename,
-                             const char *cpu_model)
-{
-    pc_init1(ram_size, boot_device,
-             kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model,
-             1, COMPAT_0_10);
+             initrd_filename, cpu_model, 0);
 }
 
 /* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1549,21 +1514,11 @@ static QEMUMachine isapc_machine = {
     .max_cpus = 1,
 };
 
-static QEMUMachine pc_0_10_machine = {
-    .name = "pc-0-10",
-    .desc = "Standard PC compatible with qemu 0.10.x",
-    .init = pc_init_pci_0_10,
-    .max_cpus = 255,
-};
-
 static void pc_machine_init(void)
 {
     qemu_register_machine(&pc_machine);
     qemu_register_machine(&pc_machine_v0_10);
     qemu_register_machine(&isapc_machine);
-
-    /* For compatibility with 0.10.x */
-    qemu_register_machine(&pc_0_10_machine);
 }
 
 machine_init(pc_machine_init);
Signature · 1 line
1.6.2.5
#185 lore raw

PATCH 2/4 Remove the virtio-{blk, console}-pci-0-10 device types

In reply to Mark McLoughlin

These are now unused.

However, perhaps the idea is that when we add -device, they will be useful? In that case, we should add virtio-net-pci-0-10 too.

---
 hw/virtio-pci.c |   57 ++++++++++--------------------------------------------
 1 files changed, 11 insertions(+), 46 deletions(-)
hw/virtio-pci.c +11 -46
index 1f922c2..703f4fe 100644
@@ -423,63 +423,37 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
     virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
 }
 
-static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev,
-                                           uint16_t class_code)
+static void virtio_blk_init_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
-    vdev = virtio_blk_init(&pci_dev->qdev);
-    virtio_init_pci(proxy, vdev,
-                    PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    class_code, 0x00);
-}
-
-static void virtio_blk_init_pci(PCIDevice *pci_dev)
-{
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-  
     if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
         proxy->class_code != PCI_CLASS_STORAGE_OTHER)
         proxy->class_code = PCI_CLASS_STORAGE_SCSI;
- 
-    virtio_blk_init_pci_with_class(pci_dev, proxy->class_code);
-}
-
-static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)
-{
-    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER);
-}
-
-static void virtio_console_init_pci_with_class(PCIDevice *pci_dev,
-                                               uint16_t class_code)
-{
-    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-    VirtIODevice *vdev;
 
-    vdev = virtio_console_init(&pci_dev->qdev);
+    vdev = virtio_blk_init(&pci_dev->qdev);
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
-                    PCI_DEVICE_ID_VIRTIO_CONSOLE,
-                    class_code, 0x00);
+                    PCI_DEVICE_ID_VIRTIO_BLOCK,
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
-  
+    VirtIODevice *vdev;
+
     if (proxy->class_code != PCI_CLASS_COMMUNICATION_OTHER &&
         proxy->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */
         proxy->class_code != PCI_CLASS_OTHERS)          /* qemu-kvm  */
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
-    virtio_console_init_pci_with_class(pci_dev, proxy->class_code);
-}
-
-static void virtio_console_init_pci_0_10(PCIDevice *pci_dev)
-{
-    virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_DISPLAY_OTHER);
+    vdev = virtio_console_init(&pci_dev->qdev);
+    virtio_init_pci(proxy, vdev,
+                    PCI_VENDOR_ID_REDHAT_QUMRANET,
+                    PCI_DEVICE_ID_VIRTIO_CONSOLE,
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_net_init_pci(PCIDevice *pci_dev)
@@ -561,15 +535,6 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_balloon_init_pci,
     },{
-        /* For compatibility with 0.10 */
-        .qdev.name = "virtio-blk-pci-0-10",
-        .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_blk_init_pci_0_10,
-    },{
-        .qdev.name = "virtio-console-pci-0-10",
-        .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_console_init_pci_0_10,
-    },{
         /* end of list */
     }
 };
Signature · 1 line
1.6.2.5
#186 lore raw

PATCH 3/4 Add machine type aliases

In reply to Mark McLoughlin

Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix.

Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future.

This is intended to mimic a symlink to a machine description file.

---
 hw/boards.h |    1 +
 vl.c        |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
hw/boards.h +1 -0
index 11acb89..d889341 100644
@@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size,
 
 typedef struct QEMUMachine {
     const char *name;
+    const char *alias;
     const char *desc;
     QEMUMachineInitFunc *init;
     int use_scsi;
vl.c +5 -0
index f475693..02d5da5 100644
@@ -3357,6 +3357,8 @@ static QEMUMachine *find_machine(const char *name)
     for(m = first_machine; m != NULL; m = m->next) {
         if (!strcmp(m->name, name))
             return m;
+        if (m->alias && !strcmp(m->alias, name))
+            return m;
     }
     return NULL;
 }
@@ -4993,6 +4995,9 @@ int main(int argc, char **argv, char **envp)
                     QEMUMachine *m;
                     printf("Supported machines are:\n");
                     for(m = first_machine; m != NULL; m = m->next) {
+                        if (m->alias)
+                            printf("%-10s %s (alias of %s)\n",
+                                   m->alias, m->desc, m->name);
                         printf("%-10s %s%s\n",
                                m->name, m->desc,
                                m->is_default ? " (default)" : "");
Signature · 1 line
1.6.2.5
#187 lore raw

PATCH 4/4 Add a pc-0.11 machine type and make the pc type an alias

In reply to Mark McLoughlin

The pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.

Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.

---
 hw/pc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/pc.c +2 -1
index 0ebc329..d262b76 100644
@@ -1477,7 +1477,8 @@ void cmos_set_s3_resume(void)
 }
 
 static QEMUMachine pc_machine = {
-    .name = "pc",
+    .name = "pc-0.11",
+    .alias = "pc",
     .desc = "Standard PC",
     .init = pc_init_pci,
     .max_cpus = 255,
Signature · 1 line
1.6.2.5
#177 lore raw

Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type

In reply to Mark McLoughlin
Quoted 2 lines · Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

Ah, I see Gerd fixed this already.

My other three patches should apply on top of his.

Cheers,
Mark.

#178 lore raw

Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type

Quoted 10 lines · Mark McLoughlin
Quoted 3 lines · Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

Ah, I see Gerd fixed this already.

My other three patches should apply on top of his.

Three or two? Can you take a closer look?

I tried earlier to drop the obvious ones but it didn't apply easily

Regards,

Anthony Liguori

#179 lore raw

Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type

Quoted 10 lines · Anthony Liguori
Quoted 7 lines · Mark McLoughlin
Quoted 2 lines · Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

Ah, I see Gerd fixed this already.

My other three patches should apply on top of his.

Three or two? Can you take a closer look?

Isn't going to work. I'd suggest to kick out my patch and take Mark's complete series instead. It does all my patch did, cleans up a bit more in virtio-pci.c (leading to conflicts) and adds the aliasing.

cheers,
Gerd

#181 lore raw

Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type

In reply to Anthony Liguori
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
Quoted 3 lines · Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

Quoted 8 lines
Quoted 4 lines

Ah, I see Gerd fixed this already.

My other three patches should apply on top of his.

Three or two? Can you take a closer look?

I tried earlier to drop the obvious ones but it didn't apply easily

You're right, Gerd's patch also removes the -0-10 devices, which is what my 2/4 patch did.

I'll re-send the two just to be clear.

Again, I think these two make sense to apply to both stable-0.11 and master.

Thanks,
Mark.

#182 lore raw

PATCH 1/2 Add machine type aliases

Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix.

Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future.

This is intended to mimic a symlink to a machine description file.

---
 hw/boards.h |    1 +
 vl.c        |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
hw/boards.h +1 -0
index 11acb89..d889341 100644
@@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size,
 
 typedef struct QEMUMachine {
     const char *name;
+    const char *alias;
     const char *desc;
     QEMUMachineInitFunc *init;
     int use_scsi;
vl.c +5 -0
index f475693..02d5da5 100644
@@ -3357,6 +3357,8 @@ static QEMUMachine *find_machine(const char *name)
     for(m = first_machine; m != NULL; m = m->next) {
         if (!strcmp(m->name, name))
             return m;
+        if (m->alias && !strcmp(m->alias, name))
+            return m;
     }
     return NULL;
 }
@@ -4993,6 +4995,9 @@ int main(int argc, char **argv, char **envp)
                     QEMUMachine *m;
                     printf("Supported machines are:\n");
                     for(m = first_machine; m != NULL; m = m->next) {
+                        if (m->alias)
+                            printf("%-10s %s (alias of %s)\n",
+                                   m->alias, m->desc, m->name);
                         printf("%-10s %s%s\n",
                                m->name, m->desc,
                                m->is_default ? " (default)" : "");
Signature · 1 line
1.6.2.5
#183 lore raw

PATCH 2/2 Add a pc-0.11 machine type and make the pc type an alias

In reply to Mark McLoughlin

The pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.

Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.

---
 hw/pc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/pc.c +2 -1
index a50f23d..c55c303 100644
@@ -1512,7 +1512,8 @@ void cmos_set_s3_resume(void)
 }
 
 static QEMUMachine pc_machine = {
-    .name = "pc",
+    .name = "pc-0.11",
+    .alias = "pc",
     .desc = "Standard PC",
     .init = pc_init_pci,
     .max_cpus = 255,
Signature · 1 line
1.6.2.5
#180 lore raw

Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type

In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
Quoted 2 lines · Mark McLoughlin

We have the pc-0.10 machine type now which does exactly the same thing.

Ah, I see Gerd fixed this already.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

My other three patches should apply on top of his.

Three or two? Can you take a closer look?

Isn't going to work. I'd suggest to kick out my patch and take Mark's complete series instead. It does all my patch did, cleans up a bit more in virtio-pci.c (leading to conflicts) and adds the aliasing.

Heh :-)

Either way is fine - the only difference between with Gerd's patch with the two I just posted and the original four is a small cleanup in virtio-pci.c

Cheers,
Mark.

#184 lore raw

Re: [Qemu-devel] [PATCH 2/2] Add a pc-0.11 machine type and make the pc type an alias

In reply to Mark McLoughlin

Hey,

Quoted 6 lines · Mark McLoughlin

The pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.

Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.

By the way, I think it would make sense to pull this into stable-0.11 before the 0.11 release.

It's a fairly minor code change which means users can start using the pc-0.11 machine type now so that, without doing anything in future, they can avoid compat issues when they update to qemu-0.12.

Cheers,
Mark.