aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2017-07-06 14:01:07 -0400
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2017-08-31 09:45:55 -0400
commit5d520d8580b31d75a115ac58ab0a804b92581fd5 (patch)
treeb611ceb5e6b6955202275fe27c2dc956cd220085
parent0a85d23b8164c951a50512b84601decb9a5e4dd6 (diff)
xen/pvcalls: implement the ioworker functions
We have one ioworker per socket. Each ioworker goes through the list of outstanding read/write requests. Once all requests have been dealt with, it returns. We use one atomic counter per socket for "read" operations and one for "write" operations to keep track of the reads/writes to do. We also use one atomic counter ("io") per ioworker to keep track of how many outstanding requests we have in total assigned to the ioworker. The ioworker finishes when there are none. Signed-off-by: Stefano Stabellini <stefano@aporeto.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Juergen Gross <jgross@suse.com> CC: boris.ostrovsky@oracle.com CC: jgross@suse.com Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
-rw-r--r--drivers/xen/pvcalls-back.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index 7bdf9245cfab..97d6fb159e8a 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -96,8 +96,34 @@ static int pvcalls_back_release_active(struct xenbus_device *dev,
96 struct pvcalls_fedata *fedata, 96 struct pvcalls_fedata *fedata,
97 struct sock_mapping *map); 97 struct sock_mapping *map);
98 98
99static void pvcalls_conn_back_read(void *opaque)
100{
101}
102
103static void pvcalls_conn_back_write(struct sock_mapping *map)
104{
105}
106
99static void pvcalls_back_ioworker(struct work_struct *work) 107static void pvcalls_back_ioworker(struct work_struct *work)
100{ 108{
109 struct pvcalls_ioworker *ioworker = container_of(work,
110 struct pvcalls_ioworker, register_work);
111 struct sock_mapping *map = container_of(ioworker, struct sock_mapping,
112 ioworker);
113
114 while (atomic_read(&map->io) > 0) {
115 if (atomic_read(&map->release) > 0) {
116 atomic_set(&map->release, 0);
117 return;
118 }
119
120 if (atomic_read(&map->read) > 0)
121 pvcalls_conn_back_read(map);
122 if (atomic_read(&map->write) > 0)
123 pvcalls_conn_back_write(map);
124
125 atomic_dec(&map->io);
126 }
101} 127}
102 128
103static int pvcalls_back_socket(struct xenbus_device *dev, 129static int pvcalls_back_socket(struct xenbus_device *dev,