]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
xen/pvcalls: implement the ioworker functions
authorStefano Stabellini <sstabellini@kernel.org>
Thu, 6 Jul 2017 18:01:07 +0000 (11:01 -0700)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Thu, 31 Aug 2017 13:45:55 +0000 (09:45 -0400)
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>
drivers/xen/pvcalls-back.c

index 7bdf9245cfaba0a77d98a4b671151af8c239eacb..97d6fb159e8a4ae6d273be35c0ce276b2bb23d08 100644 (file)
@@ -96,8 +96,34 @@ static int pvcalls_back_release_active(struct xenbus_device *dev,
                                       struct pvcalls_fedata *fedata,
                                       struct sock_mapping *map);
 
+static void pvcalls_conn_back_read(void *opaque)
+{
+}
+
+static void pvcalls_conn_back_write(struct sock_mapping *map)
+{
+}
+
 static void pvcalls_back_ioworker(struct work_struct *work)
 {
+       struct pvcalls_ioworker *ioworker = container_of(work,
+               struct pvcalls_ioworker, register_work);
+       struct sock_mapping *map = container_of(ioworker, struct sock_mapping,
+               ioworker);
+
+       while (atomic_read(&map->io) > 0) {
+               if (atomic_read(&map->release) > 0) {
+                       atomic_set(&map->release, 0);
+                       return;
+               }
+
+               if (atomic_read(&map->read) > 0)
+                       pvcalls_conn_back_read(map);
+               if (atomic_read(&map->write) > 0)
+                       pvcalls_conn_back_write(map);
+
+               atomic_dec(&map->io);
+       }
 }
 
 static int pvcalls_back_socket(struct xenbus_device *dev,