[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd with po
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd with postcopy |
Date: |
Tue, 20 Mar 2018 05:17:46 +0200 |
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>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <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 ceb17b0..5900583 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)
@@ -797,6 +798,17 @@ out:
}
/*
+ * 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;
}
--
MST
- [Qemu-devel] [PULL v2 20/50] test/acpi-test-data: add ACPI tables for dimmpxm test, (continued)
- [Qemu-devel] [PULL v2 20/50] test/acpi-test-data: add ACPI tables for dimmpxm test, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 21/50] Makefile: add target to print generated files, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 22/50] migrate: Update ram_block_discard_range for shared, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 23/50] qemu_ram_block_host_offset, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 26/50] postcopy: Add vhost-user flag for postcopy and check it, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 24/50] postcopy: use UFFDIO_ZEROPAGE only when available, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 25/50] postcopy: Add notifier chain, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 27/50] vhost-user: Add 'VHOST_USER_POSTCOPY_ADVISE' message, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 28/50] libvhost-user: Support sending fds back to qemu, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 29/50] libvhost-user: Open userfaultfd, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 31/50] vhost+postcopy: Register shared ufd with postcopy,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 32/50] vhost+postcopy: Transmit 'listen' to slave, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 33/50] postcopy+vhost-user: Split set_mem_table for postcopy, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 34/50] migration/ram: ramblock_recv_bitmap_test_byte_offset, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 37/50] vhost+postcopy: Stash RAMBlock and offset, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 36/50] vhost+postcopy: Send address back to qemu, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 38/50] vhost+postcopy: Helper to send requests to source for shared pages, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 39/50] vhost+postcopy: Resolve client address, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 30/50] postcopy: Allow registering of fd handler, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 40/50] postcopy: helper for waking shared, Michael S. Tsirkin, 2018/03/19
- [Qemu-devel] [PULL v2 46/50] vhost+postcopy: Wire up POSTCOPY_END notify, Michael S. Tsirkin, 2018/03/19