qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Felipe Franciosi <felipe@nutanix.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] vhost: Update 'ioeventfd_started' with host notifiers
Date: Thu, 10 Nov 2016 15:45:14 +0100	[thread overview]
Message-ID: <2fa5b181-6246-3db1-beb2-e8fdbc15980c@de.ibm.com> (raw)
In-Reply-To: <1478695476-19272-1-git-send-email-felipe@nutanix.com>

On 11/09/2016 01:44 PM, Felipe Franciosi wrote:
> Following the recent refactor of virtio notfiers [1], more specifically
> the patch that uses virtio_bus_set_host_notifier [2] by default, core
> virtio code requires 'ioeventfd_started' to be set to true/false when
> the host notifiers are configured. Because not all vhost devices were
> update (eg. vhost-scsi) to use the new interface, this value is always
> set to false.
> 
> When booting a guest with a vhost-scsi backend controller, SeaBIOS will
> initially configure the device which sets all notifiers. The guest will
> continue to boot fine until the kernel virtio-scsi driver reinitialises
> the device causing a stop followed by another start. Since
> ioeventfd_started was never set to true, the 'stop' operation triggered
> by virtio_bus_set_host_notifier() will not result in a call to
> virtio_pci_ioeventfd_assign(assign=false). This leaves the memory
> regions with stale notifiers and results on the next start triggering
> the following assertion:
> 
>   kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
>   Aborted
> 
> This patch updates ioeventfd_started whenever the notifiers are set or
> cleared, fixing this issue.
> 
> Signed-off-by: Felipe Franciosi <felipe@nutanix.com>

This also fixes vhost-net after reboot on s390/kvm for me

Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

> 
> [1] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07748.html
> [2] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07760.html
> ---
>  v1->v2:
>   - Update ioeventfd_started in vhost_dev_enable/disable_notifiers()
>     instead of vhost_scsi_start/stop().
>   - Reword the commit message accordingly.
> ---
>  hw/virtio/vhost.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 131f164..1290963 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1205,6 +1205,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
>              goto fail_vq;
>          }
>      }
> +    VIRTIO_BUS(qbus)->ioeventfd_started = true;
> 
>      return 0;
>  fail_vq:
> @@ -1239,6 +1240,7 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
>          }
>          assert (r >= 0);
>      }
> +    VIRTIO_BUS(qbus)->ioeventfd_started = false;
>      virtio_device_start_ioeventfd(vdev);
>  }
> 

  reply	other threads:[~2016-11-10 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 12:44 [Qemu-devel] [PATCH v2] vhost: Update 'ioeventfd_started' with host notifiers Felipe Franciosi
2016-11-10 14:45 ` Christian Borntraeger [this message]
2016-11-16  4:05   ` Alexey Kardashevskiy
2016-11-16  8:38     ` Felipe Franciosi
2016-11-17  5:23       ` Alexey Kardashevskiy

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=2fa5b181-6246-3db1-beb2-e8fdbc15980c@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=felipe@nutanix.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).