diff mbox

[(resend,rebase),3/3] virtio-serial: Enable ioeventfd

Message ID 0948831a888a7047d9e1ce945197a0210c922b1b.1298891447.git.amit.shah@redhat.com
State New
Headers show

Commit Message

Amit Shah Feb. 28, 2011, 11:12 a.m. UTC
Enable ioeventfd for virtio-serial devices by default.  Commit
25db9ebe15125deb32958c6df74996f745edf1f9 lists the benefits of using
ioeventfd.

Copying a file from guest to host over a virtio-serial channel didn't
show much difference in time or io_exit rate.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Stefan Hajnoczi Feb. 28, 2011, 3:28 p.m. UTC | #1
On Mon, Feb 28, 2011 at 11:12 AM, Amit Shah <amit.shah@redhat.com> wrote:
> Enable ioeventfd for virtio-serial devices by default.  Commit
> 25db9ebe15125deb32958c6df74996f745edf1f9 lists the benefits of using
> ioeventfd.
>
> Copying a file from guest to host over a virtio-serial channel didn't
> show much difference in time or io_exit rate.

The cost of enabling ioeventfd is one eventfd file descriptor and KVM
in-kernel device slot per virtqueue.  The current maximum number per
VM is 200, this is a kernel limit in
include/linux/kvm_host.h:NR_IOBUS_DEVS.

Do you really want to use ioeventfd for virtio-serial?  Perhaps this
is more useful for high-frequency device interfaces.

Stefan
Amit Shah March 1, 2011, 6:41 a.m. UTC | #2
On (Mon) 28 Feb 2011 [15:28:49], Stefan Hajnoczi wrote:
> On Mon, Feb 28, 2011 at 11:12 AM, Amit Shah <amit.shah@redhat.com> wrote:
> > Enable ioeventfd for virtio-serial devices by default.  Commit
> > 25db9ebe15125deb32958c6df74996f745edf1f9 lists the benefits of using
> > ioeventfd.
> >
> > Copying a file from guest to host over a virtio-serial channel didn't
> > show much difference in time or io_exit rate.
> 
> The cost of enabling ioeventfd is one eventfd file descriptor and KVM
> in-kernel device slot per virtqueue.  The current maximum number per
> VM is 200, this is a kernel limit in
> include/linux/kvm_host.h:NR_IOBUS_DEVS.
> 
> Do you really want to use ioeventfd for virtio-serial?  Perhaps this
> is more useful for high-frequency device interfaces.

I guess virtio-serial is being used heavily -- by almost all guest
agents nowadays.  The primary use-case, though, is not for
high-bandwidth communication.

This setting could be default off, it didn't show any difference in my
test run, but depends on what people who use it see and think.

		Amit
Stefan Hajnoczi March 1, 2011, 10:23 a.m. UTC | #3
On Tue, Mar 1, 2011 at 6:41 AM, Amit Shah <amit.shah@redhat.com> wrote:
> On (Mon) 28 Feb 2011 [15:28:49], Stefan Hajnoczi wrote:
>> On Mon, Feb 28, 2011 at 11:12 AM, Amit Shah <amit.shah@redhat.com> wrote:
>> > Enable ioeventfd for virtio-serial devices by default.  Commit
>> > 25db9ebe15125deb32958c6df74996f745edf1f9 lists the benefits of using
>> > ioeventfd.
>> >
>> > Copying a file from guest to host over a virtio-serial channel didn't
>> > show much difference in time or io_exit rate.
>>
>> The cost of enabling ioeventfd is one eventfd file descriptor and KVM
>> in-kernel device slot per virtqueue.  The current maximum number per
>> VM is 200, this is a kernel limit in
>> include/linux/kvm_host.h:NR_IOBUS_DEVS.
>>
>> Do you really want to use ioeventfd for virtio-serial?  Perhaps this
>> is more useful for high-frequency device interfaces.
>
> I guess virtio-serial is being used heavily -- by almost all guest
> agents nowadays.  The primary use-case, though, is not for
> high-bandwidth communication.
>
> This setting could be default off, it didn't show any difference in my
> test run, but depends on what people who use it see and think.

I don't have strong opinions about this but wanted to make you aware
that there is a limited number of ioeventfds to go around.

Stefan
diff mbox

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 952b5d2..ef65590 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -789,6 +789,7 @@  static int virtio_serial_exit_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
 
+    virtio_pci_stop_ioeventfd(proxy);
     virtio_serial_exit(proxy->vdev);
     return virtio_exit_pci(pci_dev);
 }
@@ -898,6 +899,8 @@  static PCIDeviceInfo virtio_info[] = {
         .init      = virtio_serial_init_pci,
         .exit      = virtio_serial_exit_pci,
         .qdev.props = (Property[]) {
+            DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
+                            VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
             DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
                                DEV_NVECTORS_UNSPECIFIED),
             DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),