[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 10/29] vhost+postcopy: Register shared ufd with p
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v4 10/29] vhost+postcopy: Register shared ufd with postcopy |
Date: |
Thu, 8 Mar 2018 19:57:52 +0000 |
From: "Dr. David Alan Gilbert" <address@hidden>
Register the UFD that comes in as the response to the 'advise' method
with the postcopy code.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
hw/virtio/vhost-user.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 431858b219..9f74111e92 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -171,6 +171,7 @@ struct vhost_user {
CharBackend *chr;
int slave_fd;
NotifierWithReturn postcopy_notifier;
+ struct PostCopyFD postcopy_fd;
};
static bool ioeventfd_enabled(void)
@@ -796,6 +797,17 @@ out:
return ret;
}
+/*
+ * Called back from the postcopy fault thread when a fault is received on our
+ * ufd.
+ * TODO: This is Linux specific
+ */
+static int vhost_user_postcopy_fault_handler(struct PostCopyFD *pcfd,
+ void *ufd)
+{
+ return 0;
+}
+
/*
* Called at the start of an inbound postcopy on reception of the
* 'advise' command.
@@ -835,8 +847,14 @@ static int vhost_user_postcopy_advise(struct vhost_dev
*dev, Error **errp)
error_setg(errp, "%s: Failed to get ufd", __func__);
return -1;
}
+ fcntl(ufd, F_SETFL, O_NONBLOCK);
- /* TODO: register ufd with userfault thread */
+ /* register ufd with userfault thread */
+ u->postcopy_fd.fd = ufd;
+ u->postcopy_fd.data = dev;
+ u->postcopy_fd.handler = vhost_user_postcopy_fault_handler;
+ u->postcopy_fd.idstr = "vhost-user"; /* Need to find unique name */
+ postcopy_register_shared_ufd(&u->postcopy_fd);
return 0;
}
--
2.14.3
- Re: [Qemu-devel] [PATCH v4 06/29] vhost-user: Add 'VHOST_USER_POSTCOPY_ADVISE' message, (continued)
- [Qemu-devel] [PATCH v4 05/29] postcopy: Add vhost-user flag for postcopy and check it, Dr. David Alan Gilbert (git), 2018/03/08
- [Qemu-devel] [PATCH v4 04/29] postcopy: Add notifier chain, Dr. David Alan Gilbert (git), 2018/03/08
- [Qemu-devel] [PATCH v4 07/29] libvhost-user: Support sending fds back to qemu, Dr. David Alan Gilbert (git), 2018/03/08
- [Qemu-devel] [PATCH v4 08/29] libvhost-user: Open userfaultfd, Dr. David Alan Gilbert (git), 2018/03/08
- [Qemu-devel] [PATCH v4 09/29] postcopy: Allow registering of fd handler, Dr. David Alan Gilbert (git), 2018/03/08
- [Qemu-devel] [PATCH v4 10/29] vhost+postcopy: Register shared ufd with postcopy,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v4 14/29] libvhost-user+postcopy: Register new regions with the ufd, Dr. David Alan Gilbert (git), 2018/03/08
Re: [Qemu-devel] [PATCH v4 14/29] libvhost-user+postcopy: Register new regions with the ufd, Marc-André Lureau, 2018/03/12
[Qemu-devel] [PATCH v4 11/29] vhost+postcopy: Transmit 'listen' to client, Dr. David Alan Gilbert (git), 2018/03/08