Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-19 Thread Eric Blake
On 08/18/2010 05:26 AM, Daniel P. Berrange wrote: On Wed, Aug 18, 2010 at 01:15:55PM +0200, Jiri Denemark wrote: Why do we need it to be exactly the same value ? nextslot is just an efficiency optimization isn't it. ie, so instead of starting from slot 0 and iterating over 'N' already used

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-19 Thread Jiri Denemark
There's no requirement to plug devices in ascending slot order - we can have gaps at will with any ordering. At this point, I'm starting to think that we can just drop this 2/2 patch and not worry about nextslot being stable across libvirtd restarts. Which means we don't even need most of

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-19 Thread Daniel P. Berrange
On Thu, Aug 19, 2010 at 04:57:17PM +0200, Jiri Denemark wrote: There's no requirement to plug devices in ascending slot order - we can have gaps at will with any ordering. At this point, I'm starting to think that we can just drop this 2/2 patch and not worry about nextslot being

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-18 Thread Daniel P. Berrange
On Tue, Aug 17, 2010 at 11:37:34PM +0200, Jiri Denemark wrote: The hash iterator visits in an unpredictable order. It shouldn't matter because for this usage, all that is important is that 'nextslot' eventually ends up with the largest slot ID + 1. We don't want the first unused

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-18 Thread Jiri Denemark
Why do we need it to be exactly the same value ? nextslot is just an efficiency optimization isn't it. ie, so instead of starting from slot 0 and iterating over 'N' already used slots till we find a free slot, we can get the next free slot in 1 step. As such do we really need to worry about

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-18 Thread Daniel P. Berrange
On Wed, Aug 18, 2010 at 01:15:55PM +0200, Jiri Denemark wrote: Why do we need it to be exactly the same value ? nextslot is just an efficiency optimization isn't it. ie, so instead of starting from slot 0 and iterating over 'N' already used slots till we find a free slot, we can get the

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-17 Thread Eric Blake
On 08/16/2010 11:08 AM, Jiri Denemark wrote: +void +qemuDomainPCIAddressSetUpdate(qemuDomainPCIAddressSetPtr addrs) +{ + +if (!addrs) +return; + +virHashForEach(addrs-used, qemuDomainPCIAddressSetUpdateIter, addrs); Does virHashForEach visit the hash table in the same

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-17 Thread Daniel P. Berrange
On Tue, Aug 17, 2010 at 09:11:30AM -0600, Eric Blake wrote: On 08/16/2010 11:08 AM, Jiri Denemark wrote: +void +qemuDomainPCIAddressSetUpdate(qemuDomainPCIAddressSetPtr addrs) +{ + +if (!addrs) +return; + +virHashForEach(addrs-used,

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-17 Thread Eric Blake
On 08/17/2010 09:18 AM, Daniel P. Berrange wrote: On Tue, Aug 17, 2010 at 09:11:30AM -0600, Eric Blake wrote: On 08/16/2010 11:08 AM, Jiri Denemark wrote: +void +qemuDomainPCIAddressSetUpdate(qemuDomainPCIAddressSetPtr addrs) +{ + +if (!addrs) +return; + +

Re: [libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-17 Thread Jiri Denemark
The hash iterator visits in an unpredictable order. It shouldn't matter because for this usage, all that is important is that 'nextslot' eventually ends up with the largest slot ID + 1. We don't want the first unused slot, rather the last slot reservation that was in place before the

[libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

2010-08-16 Thread Jiri Denemark
--- src/qemu/qemu_conf.c | 40 +++- src/qemu/qemu_conf.h |1 + src/qemu/qemu_driver.c |2 ++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 38d28bf..bf950f2 100644 ---