qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steven Sistare <steven.sistare@oracle.com>
To: qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
	Hamza Khan <hamza.khan@nutanix.com>
Subject: Re: [RFC V2 5/8] Revert "vhost-backend: remove vhost_kernel_reset_device()"
Date: Fri, 22 Aug 2025 14:26:16 -0400	[thread overview]
Message-ID: <a352eadd-1d43-40d7-a46f-ba5b52409a26@oracle.com> (raw)
In-Reply-To: <1752777568-236368-6-git-send-email-steven.sistare@oracle.com>

On 7/17/2025 2:39 PM, Steve Sistare wrote:
> This reverts commit e6383293eb01928692047e617665a742cca87e23.
> The reset function is needed for CPR.
> 
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
>   hw/virtio/vhost-backend.c | 6 ++++++
>   1 file changed, 6 insertions(+)

This is broken.
Drop this patch 5/8 and replace it with the following.
I still need to refactor this slightly versus patch
   [RFC V2 3/8] vhost: reset vhost devices for cpr
before posting V3.

- Steve

-------------------------
From: Steve Sistare <steven.sistare@oracle.com>
Date: Mon, 19 Aug 2024 11:16:27 -0700
Subject: [PATCH] vhost: vhost_reset_owner

Define vhost_reset_owner, needed for CPR.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
  hw/virtio/vhost-backend.c         | 6 ++++++
  hw/virtio/vhost.c                 | 4 ++--
  include/hw/virtio/vhost-backend.h | 1 +
  3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
index 833804d..54fc8ee 100644
--- a/hw/virtio/vhost-backend.c
+++ b/hw/virtio/vhost-backend.c
@@ -221,6 +221,11 @@ static int vhost_kernel_set_owner(struct vhost_dev *dev)
      return vhost_kernel_call(dev, VHOST_SET_OWNER, NULL);
  }

+static int vhost_kernel_reset_owner(struct vhost_dev *dev)
+{
+    return vhost_kernel_call(dev, VHOST_RESET_OWNER, NULL);
+}
+
  static int vhost_kernel_get_vq_index(struct vhost_dev *dev, int idx)
  {
      assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
@@ -345,6 +350,7 @@ const VhostOps kernel_ops = {
          .vhost_get_features = vhost_kernel_get_features,
          .vhost_set_backend_cap = vhost_kernel_set_backend_cap,
          .vhost_set_owner = vhost_kernel_set_owner,
+        .vhost_reset_owner = vhost_kernel_reset_owner,
          .vhost_get_vq_index = vhost_kernel_get_vq_index,
          .vhost_vsock_set_guest_cid = vhost_kernel_vsock_set_guest_cid,
          .vhost_vsock_set_running = vhost_kernel_vsock_set_running,
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 40d5cd8..72e010f 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1522,9 +1522,9 @@ static int vhost_cpr_notifier(NotifierWithReturn *notifier,
      }

      if (e->type == MIG_EVENT_PRECOPY_SETUP) {
-        r = dev->vhost_ops->vhost_reset_device(dev);
+        r = dev->vhost_ops->vhost_reset_owner(dev);
          if (r < 0) {
-            VHOST_OPS_DEBUG(r, "vhost_reset_device failed");
+            VHOST_OPS_DEBUG(r, "vhost_reset_owner failed");
          }
      } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
          r = dev->vhost_ops->vhost_set_owner(dev);
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index d6df209..5b68bfb 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -190,6 +190,7 @@ typedef struct VhostOps {
      vhost_get_features_op vhost_get_features;
      vhost_set_backend_cap_op vhost_set_backend_cap;
      vhost_set_owner_op vhost_set_owner;
+    vhost_set_owner_op vhost_reset_owner;
      vhost_reset_device_op vhost_reset_device;
      vhost_get_vq_index_op vhost_get_vq_index;
      vhost_set_vring_enable_op vhost_set_vring_enable;
--
1.8.3.1

-------------------------


  reply	other threads:[~2025-08-22 18:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 18:39 [RFC V2 0/8] Live update: tap and vhost Steve Sistare
2025-07-17 18:39 ` [RFC V2 1/8] migration: stop vm earlier for cpr Steve Sistare
2025-07-17 18:39 ` [RFC V2 2/8] migration: cpr setup notifier Steve Sistare
2025-07-17 18:39 ` [RFC V2 3/8] vhost: reset vhost devices for cpr Steve Sistare
2025-08-27 11:29   ` Vladimir Sementsov-Ogievskiy
2025-08-27 18:38     ` Steven Sistare
2025-07-17 18:39 ` [RFC V2 4/8] cpr: delete all fds Steve Sistare
2025-07-17 18:39 ` [RFC V2 5/8] Revert "vhost-backend: remove vhost_kernel_reset_device()" Steve Sistare
2025-08-22 18:26   ` Steven Sistare [this message]
2025-07-17 18:39 ` [RFC V2 6/8] tap: common return label Steve Sistare
2025-07-17 18:39 ` [RFC V2 7/8] tap: cpr support Steve Sistare
2025-07-17 18:39 ` [RFC V2 8/8] tap: postload fix for cpr Steve Sistare
2025-07-18  8:48 ` [RFC V2 0/8] Live update: tap and vhost Lei Yang
2025-07-18 17:31   ` Steven Sistare
2025-07-24  5:46   ` Lei Yang
2025-08-05 13:54 ` Fabiano Rosas
2025-08-05 19:53   ` Steven Sistare
2025-08-06 15:51     ` Peter Xu
2025-08-11 18:24     ` Steven Sistare
2025-08-23 21:53 ` Vladimir Sementsov-Ogievskiy
2025-08-28 15:48   ` Steven Sistare
2025-08-29 19:37     ` Steven Sistare
2025-09-01 11:44       ` Vladimir Sementsov-Ogievskiy
2025-09-02 15:33         ` Steven Sistare
2025-09-02 17:09           ` Vladimir Sementsov-Ogievskiy
2025-09-05 16:16             ` Peter Xu

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=a352eadd-1d43-40d7-a46f-ba5b52409a26@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=farosas@suse.de \
    --cc=hamza.khan@nutanix.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.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).