multi-process: add functions to synchronize proxy and remote endpoints
RFC PATCH v2 8/35 multi-process: add functions to synchronize proxy and remote endpoints
From: Jagannathan Raman <[email protected]>
In some cases, for example MMIO read, QEMU has to wait for the remote to complete a command before proceeding. An eventfd based mechanism is added to synchronize QEMU & remote process.
Signed-off-by John G Johnson <[email protected]>
Signed-off-by Jagannathan Raman <[email protected]>
Signed-off-by Elena Ufimtseva <[email protected]>
---
Changes in v2:
- Added timeout to communication channel.
--- include/io/proxy-link.h | 9 +++++++++ io/proxy-link.c | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)
include/io/proxy-link.h +9 -0
@@ -28,7 +28,9 @@#include <stddef.h> #include <stdint.h> #include <glib.h> +#include <unistd.h> #include <pthread.h> +#include <sys/eventfd.h> #include "qemu/osdep.h" #include "qom/object.h"
@@ -124,11 +126,18 @@ struct ProxyLinkState {proxy_link_callback callback; }; +#define GET_REMOTE_WAIT eventfd(0, 0) +#define PUT_REMOTE_WAIT (wait) close(wait) +#define PROXY_LINK_WAIT_DONE 1 +ProxyLinkState *proxy_link_create (void );void proxy_link_finalize (ProxyLinkState *s);void proxy_proc_send (ProxyLinkState *s,ProcMsg *msg);int proxy_proc_recv (ProxyLinkState *s,ProcMsg *msg); +uint64_t wait_for_remote (int efd); +void notify_proxy (int fd,uint64_t val); +void proxy_link_set_sock (ProxyLinkState *s,int fd);void proxy_link_set_callback (ProxyLinkState *s,proxy_link_callback callback);void start_handler (ProxyLinkState *s);
io/proxy-link.c +42 -0
54 lines not on this page · raw message
Signature · 1 line
2.17.1