All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: lidong chen <chen.lidong.kernel@gmail.com>
Cc: Gleb Natapov <gleb@redhat.com>, Avi Kivity <avi@redhat.com>,
	aliguori@us.ibm.com, rusty@rustcorp.com.au, kvm@vger.kernel.org
Subject: Re: Performance test result between virtio_pci MSI-X disable and enable
Date: Wed, 22 Dec 2010 15:52:32 +0200	[thread overview]
Message-ID: <20101222135232.GA8019@redhat.com> (raw)
In-Reply-To: <AANLkTik9gD+=NiGeZmq9stVXnZrs3xm5Wi=k4sF3qyhJ@mail.gmail.com>

On Tue, Nov 23, 2010 at 10:53:10AM +0800, lidong chen wrote:
> Test method:
> Send the same traffic load between virtio_pci MSI-X disable and
> enable,and compare the cpu rate of host os.
> I used the same version of virtio driver, only modify the msi-x option.
> the host os version is 2.6.32.
> the virtio dirver is from rhel6.
> the guest version  os is 2.6.16.
> 
> Test result:
> with msi-x disable, the cpu rate of host os is 110%.
> with msi-x enable, the cpu rate of host os is 140%.
> 
> the /proc/interrupt with msi-x disable is below:
>            CPU0       CPU1
>   0:   12326706          0    IO-APIC-edge  timer
>   1:          8          0    IO-APIC-edge  i8042
>   8:          0          0    IO-APIC-edge  rtc
>   9:          0          0   IO-APIC-level  acpi
>  10:    4783008          0   IO-APIC-level  virtio2, virtio3
>  11:    5363828          0   IO-APIC-level  virtio1, virtio4, virtio5
>  12:        104          0    IO-APIC-edge  i8042
> NMI:    2857871    2650796
> LOC:   12324952   12325609
> ERR:          0
> MIS:          0
> 
> the /proc/interrupt with msi-x enable is below:
>           CPU0       CPU1
>  0:    1896802          0    IO-APIC-edge  timer
>  1:          8          0    IO-APIC-edge  i8042
>  4:         14          0    IO-APIC-edge  serial
>  8:          0          0    IO-APIC-edge  rtc
>  9:          0          0   IO-APIC-level  acpi
>  10:          0          0   IO-APIC-level  virtio1, virtio2, virtio5
>  11:          1          0   IO-APIC-level  virtio0, virtio3, virtio4

This one probably means there's a bug: when msix
is enabled there should not be any level interrupts.

>  12:        104          0    IO-APIC-edge  i8042
>  50:          1          0       PCI-MSI-X  virtio2-output
>  58:          0          0       PCI-MSI-X  virtio3-config
>  66:    2046985          0       PCI-MSI-X  virtio3-input
>  74:          2          0       PCI-MSI-X  virtio3-output
>  82:          0          0       PCI-MSI-X  virtio4-config
>  90:        217          0       PCI-MSI-X  virtio4-input
>  98:          0          0       PCI-MSI-X  virtio4-output
> 177:          0          0       PCI-MSI-X  virtio0-config
> 185:     341831          0       PCI-MSI-X  virtio0-input
> 193:          1          0       PCI-MSI-X  virtio0-output
> 201:          0          0       PCI-MSI-X  virtio1-config
> 209:     188747          0       PCI-MSI-X  virtio1-input
> 217:          1          0       PCI-MSI-X  virtio1-output
> 225:          0          0       PCI-MSI-X  virtio2-config
> 233:    2204149          0       PCI-MSI-X  virtio2-input
> NMI:    1455767    1426226
> LOC:    1896099    1896637
> ERR:          0
> MIS:          0

I just noticed that above msi-x shows 4M interrupts
and 1.5M NMI but non-MSI shows 10M and 3M.

> Code difference:
> I disalbe msi-x by modify the function  vp_find_vqs like this:

You can simply supply nvectors=0 in qemu.

> static int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs,
>                       struct virtqueue *vqs[],
>                       vq_callback_t *callbacks[],
>                       const char *names[])
> {
> 
> #if 0
>        int err;
> 
>        /* Try MSI-X with one vector per queue. */
>        err = vp_try_to_find_vqs(vdev, nvqs, vqs, callbacks, names, true, true);
>        if (!err)
>                return 0;
>        /* Fallback: MSI-X with one vector for config, one shared for queues. */
>        err = vp_try_to_find_vqs(vdev, nvqs, vqs, callbacks, names,
>                                 true, false);
>        if (!err)
>                return 0;
>        /* Finally fall back to regular interrupts. */
> #endif
> 
>        return vp_try_to_find_vqs(vdev, nvqs, vqs, callbacks, names,
>                                  false, false);
> }
> 
> Conclusion:
> msi-x enable waste more cpu resource is caused by MSIX mask bit. In
> older kernels program this bit twice
> on every interrupt. and caused ept violation.

Wait a second, older kernels don't have msix support in virtio,
do they?

> So I think we should add a param to control this.with older kernels,
> we should disable MSIX.
> And I think this should deal by qemu.

I would like to see a comparison of msix enabled and disabled
with a guest that supports msix natively.

-- 
MST

      parent reply	other threads:[~2010-12-22 13:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23  2:53 Performance test result between virtio_pci MSI-X disable and enable lidong chen
2010-11-23  6:20 ` Avi Kivity
2010-11-23  6:42   ` Gleb Natapov
2010-11-23  7:27   ` lidong chen
2010-11-23  7:39     ` Avi Kivity
2010-11-30  9:10       ` lidong chen
2010-11-30  9:24         ` Yang, Sheng
2010-12-01  8:41           ` lidong chen
2010-12-01  8:49             ` Yang, Sheng
2010-12-01  8:54               ` lidong chen
2010-12-01  9:02                 ` Yang, Sheng
2010-12-01  9:29                   ` lidong chen
2010-12-01  9:37                     ` Yang, Sheng
2010-12-01  9:34                   ` Yang, Sheng
2010-12-01  8:56             ` Yang, Sheng
2010-12-01 14:03             ` Michael S. Tsirkin
2010-12-02  1:13               ` Yang, Sheng
2010-12-02  9:49                 ` Michael S. Tsirkin
2010-12-02 11:52                   ` Sheng Yang
2010-12-02 12:23                     ` Michael S. Tsirkin
2010-12-02 14:01                       ` lidong chen
2010-12-22 13:52 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101222135232.GA8019@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=chen.lidong.kernel@gmail.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.