|
|
9ae3a8 |
From 5134b54a7e8941d6e6c112e03b7e85b578606fc0 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <5134b54a7e8941d6e6c112e03b7e85b578606fc0.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:52:42 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 06/46] rdma: export yield_until_fd_readable()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-7-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55691
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 06/42] rdma: export yield_until_fd_readable()
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 9f05d0c3a4f9e8fcb13ed09cc350af45a627809a
|
|
|
9ae3a8 |
Author: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Date: Tue Jun 25 21:35:29 2013 -0400
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: export yield_until_fd_readable()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The RDMA event channel can be made non-blocking just like a TCP
|
|
|
9ae3a8 |
socket. Exporting this function allows us to yield so that the
|
|
|
9ae3a8 |
QEMU monitor remains available.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>
|
|
|
9ae3a8 |
Tested-by: Chegu Vinod <chegu_vinod@hp.com>
|
|
|
9ae3a8 |
Tested-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/block/coroutine.h | 6 ++++++
|
|
|
9ae3a8 |
qemu-coroutine-io.c | 23 +++++++++++++++++++++++
|
|
|
9ae3a8 |
savevm.c | 28 ----------------------------
|
|
|
9ae3a8 |
3 files changed, 29 insertions(+), 28 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/block/coroutine.h | 6 ++++++
|
|
|
9ae3a8 |
qemu-coroutine-io.c | 23 +++++++++++++++++++++++
|
|
|
9ae3a8 |
savevm.c | 28 ----------------------------
|
|
|
9ae3a8 |
3 files changed, 29 insertions(+), 28 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/block/coroutine.h b/include/block/coroutine.h
|
|
|
9ae3a8 |
index a978162..377805a 100644
|
|
|
9ae3a8 |
--- a/include/block/coroutine.h
|
|
|
9ae3a8 |
+++ b/include/block/coroutine.h
|
|
|
9ae3a8 |
@@ -209,4 +209,10 @@ void qemu_co_rwlock_unlock(CoRwlock *lock);
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
void coroutine_fn co_sleep_ns(QEMUClock *clock, int64_t ns);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+/**
|
|
|
9ae3a8 |
+ * Yield until a file descriptor becomes readable
|
|
|
9ae3a8 |
+ *
|
|
|
9ae3a8 |
+ * Note that this function clobbers the handlers for the file descriptor.
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+void coroutine_fn yield_until_fd_readable(int fd);
|
|
|
9ae3a8 |
#endif /* QEMU_COROUTINE_H */
|
|
|
9ae3a8 |
diff --git a/qemu-coroutine-io.c b/qemu-coroutine-io.c
|
|
|
9ae3a8 |
index e8ad1a4..c4df35a 100644
|
|
|
9ae3a8 |
--- a/qemu-coroutine-io.c
|
|
|
9ae3a8 |
+++ b/qemu-coroutine-io.c
|
|
|
9ae3a8 |
@@ -63,3 +63,26 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send)
|
|
|
9ae3a8 |
struct iovec iov = { .iov_base = buf, .iov_len = bytes };
|
|
|
9ae3a8 |
return qemu_co_sendv_recvv(sockfd, &iov, 1, 0, bytes, do_send);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+typedef struct {
|
|
|
9ae3a8 |
+ Coroutine *co;
|
|
|
9ae3a8 |
+ int fd;
|
|
|
9ae3a8 |
+} FDYieldUntilData;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static void fd_coroutine_enter(void *opaque)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ FDYieldUntilData *data = opaque;
|
|
|
9ae3a8 |
+ qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
|
|
|
9ae3a8 |
+ qemu_coroutine_enter(data->co, NULL);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+void coroutine_fn yield_until_fd_readable(int fd)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ FDYieldUntilData data;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ assert(qemu_in_coroutine());
|
|
|
9ae3a8 |
+ data.co = qemu_coroutine_self();
|
|
|
9ae3a8 |
+ data.fd = fd;
|
|
|
9ae3a8 |
+ qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data);
|
|
|
9ae3a8 |
+ qemu_coroutine_yield();
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
diff --git a/savevm.c b/savevm.c
|
|
|
9ae3a8 |
index f68f7f2..9304788 100644
|
|
|
9ae3a8 |
--- a/savevm.c
|
|
|
9ae3a8 |
+++ b/savevm.c
|
|
|
9ae3a8 |
@@ -149,34 +149,6 @@ typedef struct QEMUFileSocket
|
|
|
9ae3a8 |
QEMUFile *file;
|
|
|
9ae3a8 |
} QEMUFileSocket;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-typedef struct {
|
|
|
9ae3a8 |
- Coroutine *co;
|
|
|
9ae3a8 |
- int fd;
|
|
|
9ae3a8 |
-} FDYieldUntilData;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-static void fd_coroutine_enter(void *opaque)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- FDYieldUntilData *data = opaque;
|
|
|
9ae3a8 |
- qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
|
|
|
9ae3a8 |
- qemu_coroutine_enter(data->co, NULL);
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-/**
|
|
|
9ae3a8 |
- * Yield until a file descriptor becomes readable
|
|
|
9ae3a8 |
- *
|
|
|
9ae3a8 |
- * Note that this function clobbers the handlers for the file descriptor.
|
|
|
9ae3a8 |
- */
|
|
|
9ae3a8 |
-static void coroutine_fn yield_until_fd_readable(int fd)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- FDYieldUntilData data;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- assert(qemu_in_coroutine());
|
|
|
9ae3a8 |
- data.co = qemu_coroutine_self();
|
|
|
9ae3a8 |
- data.fd = fd;
|
|
|
9ae3a8 |
- qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data);
|
|
|
9ae3a8 |
- qemu_coroutine_yield();
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt,
|
|
|
9ae3a8 |
int64_t pos)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|