All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: oenhan@gmail.com
Cc: sgarzare@redhat.com, qemu-devel@nongnu.org,
	qemu-stable@nongnu.org, Huaitong Han <hanht2@chinatelecom.cn>,
	Zhiyuan Yuan <yuanzhiyuan@chinatelecom.cn>
Subject: Re: [PATCH v2] vhost: Don't set vring call if guest notifier is disabled
Date: Thu, 20 Feb 2025 18:13:24 -0500	[thread overview]
Message-ID: <20250220181246-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250219015235.130194-1-hanht2@chinatelecom.cn>

On Wed, Feb 19, 2025 at 09:52:35AM +0800, oenhan@gmail.com wrote:
> From: Huaitong Han <hanht2@chinatelecom.cn>
> 
> The vring call fd is set even when the guest does not use MSIX (e.g., virtio
> PMD). This results in unnecessary CPU overhead for handling virtio interrupts.
> The previous patch only optimized the condition when query_queue_notifier was
> enabled and the vector was unset. However, if query_queue_notifier is disabled,
> the vring call FD should also be unset to avoid this inefficiency.
> 
> Fixes: 96a3d98d2c ("vhost: don't set vring call if no vector")
> 
> Reported-by: Zhiyuan Yuan <yuanzhiyuan@chinatelecom.cn>
> Signed-off-by: Huaitong Han <hanht2@chinatelecom.cn>


Fails make check:


https://gitlab.com/mstredhat/qemu/-/jobs/9201935243

how was this tested? Pls include data on testing in the commit log.

> ---
> v2: - add Fixes tag
>     - cc qemu-stable@nongnu.org
> 
>  hw/virtio/vhost.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 6aa72fd434..d17e7cc6fe 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1342,8 +1342,8 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
>      }
>  
>      if (k->query_guest_notifiers &&
> -        k->query_guest_notifiers(qbus->parent) &&
> -        virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) {
> +        (!k->query_guest_notifiers(qbus->parent) ||
> +            virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR)) {
>          file.fd = -1;
>          r = dev->vhost_ops->vhost_set_vring_call(dev, &file);
>          if (r) {
> -- 
> 2.43.5



      reply	other threads:[~2025-02-20 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  1:52 [PATCH v2] vhost: Don't set vring call if guest notifier is disabled oenhan
2025-02-20 23:13 ` 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=20250220181246-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=hanht2@chinatelecom.cn \
    --cc=oenhan@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=yuanzhiyuan@chinatelecom.cn \
    /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.