Skip to contentSkip to conversation

MMIO: Make coalesced mmio use a device per zone

PATCH Superseded Sasha Levin 3 participants 8 messages Jul 19, 2011 – Feb 13, 2012 KVM

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MMIO: Make coalesced mmio use a device per zone

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

---
 include/linux/kvm_host.h  |    7 ++-
 virt/kvm/coalesced_mmio.c |  114 ++++++++++++++++----------------------------
 virt/kvm/coalesced_mmio.h |    7 +--
 3 files changed, 50 insertions(+), 78 deletions(-)
include/linux/kvm_host.h +5 -2
index eabb21a..b1d7f2d 100644
@@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
  */
 struct kvm_io_bus {
 	int                   dev_count;
-#define NR_IOBUS_DEVS 200
+#define NR_IOBUS_DEVS 300
 	struct kvm_io_device *devs[NR_IOBUS_DEVS];
 };
 
@@ -256,8 +256,11 @@ struct kvm {
 	struct kvm_arch arch;
 	atomic_t users_count;
 #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
-	struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
 	struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
+	struct {
+		spinlock_t lock;
+		struct list_head items;
+	} coalesced_zones;
 #endif
 
 	struct mutex irq_lock;
virt/kvm/coalesced_mmio.c +42 -72

177 lines not on this page · raw message

virt/kvm/coalesced_mmio.h +3 -4
index 8a5959e..b280c20 100644
@@ -12,14 +12,13 @@
 
 #ifdef CONFIG_KVM_MMIO
 
-#define KVM_COALESCED_MMIO_ZONE_MAX 100
+#include <linux/list.h>
 
 struct kvm_coalesced_mmio_dev {
+	struct list_head list;
 	struct kvm_io_device dev;
 	struct kvm *kvm;
-	spinlock_t lock;
-	int nb_zones;
-	struct kvm_coalesced_mmio_zone zone[KVM_COALESCED_MMIO_ZONE_MAX];
+	struct kvm_coalesced_mmio_zone zone;
 };
 
 int kvm_coalesced_mmio_init(struct kvm *kvm);
Signature · 1 line
1.7.6
#1 lore raw
Quoted 8 lines · Sasha Levin

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

include/linux/kvm_host.h extern struct kmem_cache *kvm_vcpu_cache; · line 68

Quoted 7 lines
include/linux/kvm_host.h +1 -1
@@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
   */
  struct kvm_io_bus {
  	int                   dev_count;
-#define NR_IOBUS_DEVS 200
+#define NR_IOBUS_DEVS 300
  	struct kvm_io_device *devs[NR_IOBUS_DEVS];
  };

This means that a lot of non-coalesced-mmio users can squeeze out coalesced-mmio. I don't know if it's really worthwhile, but the 100 coalesced mmio slots should be reserved so we are guaranteed they are available.

virt/kvm/coalesced_mmio.c static void coalesced_mmio_destructor(struct kvm_io_device *this) · line 92

Quoted 10 lines
virt/kvm/coalesced_mmio.c +2 -0
@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)
  {
  	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
 
+	list_del(&dev->list);
+
  	kfree(dev);
  }
 

No lock?

Quoted 22 lines

int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
struct kvm_coalesced_mmio_zone *zone)
{

virt/kvm/coalesced_mmio.c +1 -15
-	int i;
-	struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev;
-	struct kvm_coalesced_mmio_zone *z;
-
-	if (dev == NULL)
-		return -ENXIO;
+	struct kvm_coalesced_mmio_dev *dev;
 
  	mutex_lock(&kvm->slots_lock);
 
-	i = dev->nb_zones;
-	while (i) {
-		z =&dev->zone[i - 1];
-
-		/* unregister all zones
-		 * included in (zone->addr, zone->size)
-		 */
-
-		if (zone->addr<= z->addr&&

virt/kvm/coalesced_mmio.c void kvm_coalesced_mmio_free(struct kvm *kvm) · line 198

Quoted 10 lines
virt/kvm/coalesced_mmio.c +4 -5
-		    z->addr + z->size<= zone->addr + zone->size) {
-			dev->nb_zones--;
-			*z = dev->zone[dev->nb_zones];
+	list_for_each_entry(dev,&kvm->coalesced_zones.items, list)
+		if (coalesced_mmio_in_range(dev, zone->addr, zone->size)) {
+			kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,&dev->dev);
+			kvm_iodevice_destructor(&dev->dev);
  		}
-		i--;
-	}

No lock?

virt/kvm/coalesced_mmio.h line 22

Quoted 11 lines
  struct kvm_coalesced_mmio_dev {
virt/kvm/coalesced_mmio.h +2 -3
+	struct list_head list;
  	struct kvm_io_device dev;
  	struct kvm *kvm;
-	spinlock_t lock;
-	int nb_zones;
-	struct kvm_coalesced_mmio_zone zone[KVM_COALESCED_MMIO_ZONE_MAX];
+	struct kvm_coalesced_mmio_zone zone;
  };

Why a list instead of a linear array?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 8 lines · Avi Kivity
Quoted 7 lines · Sasha Levin

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

Quoted 13 lines

include/linux/kvm_host.h extern struct kmem_cache *kvm_vcpu_cache; · line 68

Quoted 8 lines
include/linux/kvm_host.h +1 -1
@@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
   */
  struct kvm_io_bus {
  	int                   dev_count;
-#define NR_IOBUS_DEVS 200
+#define NR_IOBUS_DEVS 300
  	struct kvm_io_device *devs[NR_IOBUS_DEVS];
  };

This means that a lot of non-coalesced-mmio users can squeeze out coalesced-mmio. I don't know if it's really worthwhile, but the 100 coalesced mmio slots should be reserved so we are guaranteed they are available.

We are currently registering 4 devices, plus how many ioeventfds/coalesced mmio zones the user wants. I felt bad about upping it to 300 really.

Quoted 6 lines
Quoted 6 lines
virt/kvm/coalesced_mmio.c +0 -0
@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)
  {
  	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
 
Quoted 7 lines

virt/kvm/coalesced_mmio.c static void coalesced_mmio_destructor(struct kvm_io_device *this) · line 92

Quoted 5 lines
virt/kvm/coalesced_mmio.c +2 -0
+	list_del(&dev->list);
+
  	kfree(dev);
  }
 

No lock?

The lock is there to synchronize access to the coalesced ring (it was here before this patch too, it's not something new), not the device list.

The device list is only accessed when kvm->slots_lock is held, so it takes care of that.

Quoted 37 lines
Quoted 23 lines

int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
struct kvm_coalesced_mmio_zone *zone)
{

virt/kvm/coalesced_mmio.c +1 -15
-	int i;
-	struct kvm_coalesced_mmio_dev *dev = kvm->coalesced_mmio_dev;
-	struct kvm_coalesced_mmio_zone *z;
-
-	if (dev == NULL)
-		return -ENXIO;
+	struct kvm_coalesced_mmio_dev *dev;
 
  	mutex_lock(&kvm->slots_lock);
 
-	i = dev->nb_zones;
-	while (i) {
-		z =&dev->zone[i - 1];
-
-		/* unregister all zones
-		 * included in (zone->addr, zone->size)
-		 */
-
-		if (zone->addr<= z->addr&&

virt/kvm/coalesced_mmio.c void kvm_coalesced_mmio_free(struct kvm *kvm) · line 198

Quoted 10 lines
virt/kvm/coalesced_mmio.c +4 -5
-		    z->addr + z->size<= zone->addr + zone->size) {
-			dev->nb_zones--;
-			*z = dev->zone[dev->nb_zones];
+	list_for_each_entry(dev,&kvm->coalesced_zones.items, list)
+		if (coalesced_mmio_in_range(dev, zone->addr, zone->size)) {
+			kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,&dev->dev);
+			kvm_iodevice_destructor(&dev->dev);
  		}
-		i--;
-	}

No lock?

Quoted 1 line
Quoted 13 lines

virt/kvm/coalesced_mmio.h line 22

Quoted 10 lines
  struct kvm_coalesced_mmio_dev {
virt/kvm/coalesced_mmio.h +2 -3
+	struct list_head list;
  	struct kvm_io_device dev;
  	struct kvm *kvm;
-	spinlock_t lock;
-	int nb_zones;
-	struct kvm_coalesced_mmio_zone zone[KVM_COALESCED_MMIO_ZONE_MAX];
+	struct kvm_coalesced_mmio_zone zone;
  };

Why a list instead of a linear array?

We have an unknown amount of coalesced devices which we allocate dynamically on creation, it sounded more logical to me to just chain them in a list.

Signature · 1 line
Sasha.
#3 lore raw
Quoted 18 lines · Sasha Levin
Quoted 17 lines · Avi Kivity
Quoted 15 lines · Sasha Levin

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

 @@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
    */
   struct kvm_io_bus {
   	int                   dev_count;
 -#define NR_IOBUS_DEVS 200
 +#define NR_IOBUS_DEVS 300
   	struct kvm_io_device *devs[NR_IOBUS_DEVS];
   };
Quoted 8 lines
Quoted 4 lines

This means that a lot of non-coalesced-mmio users can squeeze out coalesced-mmio. I don't know if it's really worthwhile, but the 100 coalesced mmio slots should be reserved so we are guaranteed they are available.

We are currently registering 4 devices, plus how many ioeventfds/coalesced mmio zones the user wants. I felt bad about upping it to 300 really.

It's just a few kilobytes, where even a small guest occupies half a gigabyte. Even just its pagetables swallow up megabytes.

An array means less opportunities to screw up the code and better cache usage with small objects.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)

   {
   	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);

+ list_del(&dev->list);
+

   	kfree(dev);
   }
Quoted 8 lines
Quoted 1 line

No lock?

The lock is there to synchronize access to the coalesced ring (it was here before this patch too, it's not something new), not the device list.

The device list is only accessed when kvm->slots_lock is held, so it takes care of that.

Right. A comment please.

btw, don't we leak all zones on guest destruction? the array didn't need any cleanup, but this list does.

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw
Quoted 52 lines · Avi Kivity
Quoted 18 lines · Sasha Levin
Quoted 17 lines · Avi Kivity
Quoted 15 lines · Sasha Levin

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

 @@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
    */
   struct kvm_io_bus {
   	int                   dev_count;
 -#define NR_IOBUS_DEVS 200
 +#define NR_IOBUS_DEVS 300
   	struct kvm_io_device *devs[NR_IOBUS_DEVS];
   };
Quoted 8 lines
Quoted 4 lines

This means that a lot of non-coalesced-mmio users can squeeze out coalesced-mmio. I don't know if it's really worthwhile, but the 100 coalesced mmio slots should be reserved so we are guaranteed they are available.

We are currently registering 4 devices, plus how many ioeventfds/coalesced mmio zones the user wants. I felt bad about upping it to 300 really.

It's just a few kilobytes, where even a small guest occupies half a gigabyte. Even just its pagetables swallow up megabytes.

An array means less opportunities to screw up the code and better cache usage with small objects.

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines

@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)

   {
   	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
Quoted 7 lines
Quoted 5 lines

+ list_del(&dev->list);
+

   	kfree(dev);
   }

No lock?

The lock is there to synchronize access to the coalesced ring (it was here before this patch too, it's not something new), not the device list.

Quoted 8 lines
Quoted 2 lines

The device list is only accessed when kvm->slots_lock is held, so it takes care of that.

Right. A comment please.

btw, don't we leak all zones on guest destruction? the array didn't need any cleanup, but this list does.

No, the destructor is called for all devices on the bus when the bus is going down. We're handling it in coalesced_mmio_destructor() which frees the device.

Signature · 1 line
Sasha.
#5 lore raw
Quoted 8 lines · Sasha Levin
Quoted 4 lines

btw, don't we leak all zones on guest destruction? the array didn't need any cleanup, but this list does.

No, the destructor is called for all devices on the bus when the bus is going down. We're handling it in coalesced_mmio_destructor() which frees the device.

Ah, okay. A somewhat strange setup.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw
In reply to Avi Kivity

----- Original Message -----

Quoted 35 lines · Sasha Levin
Quoted 29 lines · Avi Kivity
Quoted 20 lines · Sasha Levin
Quoted 10 lines

This patch changes coalesced mmio to create one mmio device per
zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents
a race condition between coalesced mmio registration/unregistration
and lookups.

Quoted 8 lines
 @@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
    */
   struct kvm_io_bus {
   	int                   dev_count;
 -#define NR_IOBUS_DEVS 200
 +#define NR_IOBUS_DEVS 300
   	struct kvm_io_device *devs[NR_IOBUS_DEVS];
   };
Quoted 7 lines

This means that a lot of non-coalesced-mmio users can squeeze out
coalesced-mmio. I don't know if it's really worthwhile, but the 100
coalesced mmio slots should be reserved so we are guaranteed they are
available.

Quoted 4 lines

We are currently registering 4 devices, plus how many ioeventfds/coalesced mmio zones the user wants. I felt bad about upping
it to 300 really.

Quoted 6 lines

It's just a few kilobytes, where even a small guest occupies half a gigabyte. Even just its pagetables swallow up megabytes.

An array means less opportunities to screw up the code and better cache
usage with small objects.

In commit e80e2a60, it increase NR_IOBUS_DEVS because virtio-net(vhost=on) device requests 2 iobus devices.

Quoted 6 lines

commit e80e2a60ff7914dae691345a976c80bbbff3ec74

Author: Sridhar Samudrala <[email protected]>
Date:   Tue Mar 30 16:48:25 2010 -0700

KVM: Increase NR_IOBUS_DEVS limit to 200

Quoted 7 lines

This patch increases the current hardcoded limit of NR_IOBUS_DEVS from 6 to 200. We are hitting this limit when creating a guest with more than 1 virtio-net device using vhost-net backend. Each virtio-net device requires 2 such devices to service notifications from rx/tx queues.

Hi all,

#define KVM_COALESCED_MMIO_ZONE_MAX 100
Old maximum of coalesced mmio zone is 100. After apply this patch, each zone has an iobus devices, so the NR_IOBUS_DEVS is increased by 100.

Quoted 9 lines

commit 8c99ce360904ba2f46d4840f1b8df7451331ea38

Author: Sasha Levin <[email protected]>
Date:   Wed Jul 20 20:59:00 2011 +0300

KVM: Make coalesced mmio use a device per zone

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Quoted 7 lines

Doing so enables us to take advantage of existing locking and prevents a race condition between coalesced mmio registration/unregistration and lookups.

kvm_io_bus devices are used for ioevent, pit, pic, ioapic, coalesced_mmio.

virt/kvm/coalesced_mmio.c:144:  ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, zone->addr,               -->  kvm_vm_ioctl_register_coalesced_mmio()
virt/kvm/eventfd.c:589: ret = kvm_io_bus_register_dev(kvm, bus_idx, p->addr, p->length,                    -->  kvm_assign_ioeventfd()
virt/kvm/ioapic.c:397:  ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, ioapic->base_address,             -->  kvm_ioapic_init()
arch/x86/kvm/i8254.c:716:       ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, KVM_PIT_BASE_ADDRESS,      -->  kvm_create_pit()
arch/x86/kvm/i8254.c:723:               ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS,
arch/x86/kvm/i8259.c:613:       ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, 0x20, 2,                   ---> kvm_create_pic()
arch/x86/kvm/i8259.c:618:       ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, 0xa0, 2, &s->dev_slave);
arch/x86/kvm/i8259.c:622:       ret = kvm_io_bus_register_dev(kvm, KVM_PIO_BUS, 0x4d0, 2, &s->dev_eclr);

Each virtio-blk device needs 1 iobus device ? Each virtio-net(vhost=on) device needs 2 iobus devices?

Currently Qemu only emulates one PCI bus, it contains 32 slots, one slot contains 8 functions. maximum of supported PCI devices: 1 * 32 * 8 = 256, '300' IOBUS devices are enough?

Thanks, Amos

Quoted 37 lines
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)

   {
   	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
Quoted 7 lines
Quoted 5 lines

+ list_del(&dev->list);
+

   	kfree(dev);
   }

No lock?

Quoted 8 lines

The lock is there to synchronize access to the coalesced ring (it was
here before this patch too, it's not something new), not the device list.

The device list is only accessed when kvm->slots_lock is held, so it
takes care of that.

Right. A comment please.

btw, don't we leak all zones on guest destruction? the array didn't need
any cleanup, but this list does.

--
error compiling committee.c: too many arguments to function

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

#7 lore raw

----- Original Message -----

Quoted 118 lines

----- Original Message -----

Quoted 37 lines · Sasha Levin
Quoted 31 lines · Avi Kivity
Quoted 21 lines · Sasha Levin
Quoted 11 lines

This patch changes coalesced mmio to create one mmio device per
zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and
prevents
a race condition between coalesced mmio registration/unregistration
and lookups.

Quoted 8 lines
 @@ -63,7 +63,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
    */
   struct kvm_io_bus {
   	int                   dev_count;
 -#define NR_IOBUS_DEVS 200
 +#define NR_IOBUS_DEVS 300
   	struct kvm_io_device *devs[NR_IOBUS_DEVS];
   };
Quoted 8 lines

This means that a lot of non-coalesced-mmio users can squeeze out
coalesced-mmio. I don't know if it's really worthwhile, but the
100
coalesced mmio slots should be reserved so we are guaranteed they are
available.

Quoted 4 lines

We are currently registering 4 devices, plus how many ioeventfds/coalesced mmio zones the user wants. I felt bad about upping
it to 300 really.

Quoted 6 lines

It's just a few kilobytes, where even a small guest occupies half a gigabyte. Even just its pagetables swallow up megabytes.

An array means less opportunities to screw up the code and better cache
usage with small objects.

In commit e80e2a60, it increase NR_IOBUS_DEVS because virtio-net(vhost=on)
device requests 2 iobus devices.

Quoted 15 lines

commit e80e2a60ff7914dae691345a976c80bbbff3ec74

Author: Sridhar Samudrala <[email protected]>
Date:   Tue Mar 30 16:48:25 2010 -0700

KVM: Increase NR_IOBUS_DEVS limit to 200

This patch increases the current hardcoded limit of NR_IOBUS_DEVS
from 6 to 200. We are hitting this limit when creating a guest with more
than 1 virtio-net device using vhost-net backend. Each virtio-net
device requires 2 such devices to service notifications from rx/tx queues.

Quoted 2 lines

Hi all,

#define KVM_COALESCED_MMIO_ZONE_MAX 100
Old maximum of coalesced mmio zone is 100. After apply this patch, each zone has an iobus devices, so the NR_IOBUS_DEVS is increased by 100.

Quoted 15 lines

commit 8c99ce360904ba2f46d4840f1b8df7451331ea38

Author: Sasha Levin <[email protected]>
Date:   Wed Jul 20 20:59:00 2011 +0300

KVM: Make coalesced mmio use a device per zone

This patch changes coalesced mmio to create one mmio device per zone instead of handling all zones in one device.

Doing so enables us to take advantage of existing locking and prevents
a race condition between coalesced mmio registration/unregistration
and lookups.

Quoted 3 lines

kvm_io_bus devices are used for ioevent, pit, pic, ioapic, coalesced_mmio.

virt/kvm/coalesced_mmio.c:144: ret = kvm_io_bus_register_dev(kvm,
KVM_MMIO_BUS, zone->addr, -->
kvm_vm_ioctl_register_coalesced_mmio()
virt/kvm/eventfd.c:589: ret = kvm_io_bus_register_dev(kvm, bus_idx,
p->addr, p->length, --> kvm_assign_ioeventfd()
virt/kvm/ioapic.c:397: ret = kvm_io_bus_register_dev(kvm,
KVM_MMIO_BUS, ioapic->base_address, -->
kvm_ioapic_init()
arch/x86/kvm/i8254.c:716: ret = kvm_io_bus_register_dev(kvm,
KVM_PIO_BUS, KVM_PIT_BASE_ADDRESS, --> kvm_create_pit()
arch/x86/kvm/i8254.c:723: ret =
kvm_io_bus_register_dev(kvm, KVM_PIO_BUS,
arch/x86/kvm/i8259.c:613: ret = kvm_io_bus_register_dev(kvm,
KVM_PIO_BUS, 0x20, 2, ---> kvm_create_pic()
arch/x86/kvm/i8259.c:618: ret = kvm_io_bus_register_dev(kvm,
KVM_PIO_BUS, 0xa0, 2, &s->dev_slave);
arch/x86/kvm/i8259.c:622: ret = kvm_io_bus_register_dev(kvm,
KVM_PIO_BUS, 0x4d0, 2, &s->dev_eclr);

Quoted 7 lines

Each virtio-blk device needs 1 iobus device ? Each virtio-net(vhost=on) device needs 2 iobus devices?

Currently Qemu only emulates one PCI bus, it contains 32 slots, one slot contains 8 functions.
maximum of supported PCI devices: 1 * 32 * 8 = 256, '300' IOBUS devices are enough?

Hi everyone,

Any thoughts about this?

Thanks,
Amos

Quoted 30 lines
Quoted 30 lines
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines

@@ -95,6 +85,8 @@ static void coalesced_mmio_destructor(struct kvm_io_device *this)

   {
   	struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
Quoted 7 lines
Quoted 5 lines

+ list_del(&dev->list);
+

   	kfree(dev);
   }

No lock?

The lock is there to synchronize access to the coalesced ring (it was
here before this patch too, it's not something new), not the device
list.

Quoted 3 lines

The device list is only accessed when kvm->slots_lock is held, so it
takes care of that.

Right. A comment please.

btw, don't we leak all zones on guest destruction? the array didn't need
any cleanup, but this list does.